diff --git a/packages/manager/apps/key-management-service/package.json b/packages/manager/apps/key-management-service/package.json index 7f028a30c22c..a5115e3fd575 100644 --- a/packages/manager/apps/key-management-service/package.json +++ b/packages/manager/apps/key-management-service/package.json @@ -23,6 +23,7 @@ "test:coverage": "vitest run --coverage" }, "dependencies": { + "@ovh-ux/logs-to-customer": "^1.0.0", "@ovh-ux/manager-config": "^8.0.1", "@ovh-ux/manager-core-api": "^0.9.0", "@ovh-ux/manager-core-utils": "*", @@ -39,13 +40,13 @@ "@tanstack/react-query": "^5.51.21", "@tanstack/react-table": "^8.20.1", "date-fns": "^3.6.0", - "i18next": "^23.8.2", "i18next-http-backend": "^2.4.3", - "react": "^18.2.0", + "i18next": "^23.8.2", "react-dom": "18.2.0", "react-i18next": "^14.0.5", - "react-router": "^6.21.3", "react-router-dom": "^6.3.0", + "react-router": "^6.21.3", + "react": "^18.2.0", "tailwindcss": "^3.4.4" }, "devDependencies": { diff --git a/packages/manager/apps/key-management-service/public/translations/key-management-service/dashboard/Messages_fr_FR.json b/packages/manager/apps/key-management-service/public/translations/key-management-service/dashboard/Messages_fr_FR.json index ba9595df8f1a..21ea554c53b1 100644 --- a/packages/manager/apps/key-management-service/public/translations/key-management-service/dashboard/Messages_fr_FR.json +++ b/packages/manager/apps/key-management-service/public/translations/key-management-service/dashboard/Messages_fr_FR.json @@ -5,6 +5,7 @@ "general_informations": "Informations générales", "encrypted_keys": "Clés de chiffrement", "access_certificates": "Certificats d'accès", + "logs": "Logs", "key_management_service_dashboard_back_link": "Retour à la liste des KMS", "key_management_service_dashboard_tab_comming_soon": "prochainement", "key_management_service_dashboard_field_label_name": "Nom du KMS", diff --git a/packages/manager/apps/key-management-service/public/translations/key-management-service/logs/Messages_fr_FR.json b/packages/manager/apps/key-management-service/public/translations/key-management-service/logs/Messages_fr_FR.json new file mode 100644 index 000000000000..9f67132b7a4e --- /dev/null +++ b/packages/manager/apps/key-management-service/public/translations/key-management-service/logs/Messages_fr_FR.json @@ -0,0 +1,4 @@ +{ + "key_management_service_logs": "logs", + "key_management_service_logs_description": "Une description à définir." +} diff --git a/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/Dashboard.tsx b/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/Dashboard.tsx index 89e276f66743..42dec3805858 100644 --- a/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/Dashboard.tsx +++ b/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/Dashboard.tsx @@ -38,8 +38,10 @@ const Dashboard: React.FC = ({ tabs }) => { useEffect(() => { const activeTab = tabs.find( - (tab) => `/${okmsId}/${tab.url}` === location.pathname, + (tab) => + tab.url !== '' && location.pathname.startsWith(`/${okmsId}/${tab.url}`), ); + if (!activeTab) return; setActivePanel(activeTab?.url); }, [location]); diff --git a/packages/manager/apps/key-management-service/src/pages/dashboard/index.tsx b/packages/manager/apps/key-management-service/src/pages/dashboard/index.tsx index b98b684f651f..859f4b3774c8 100644 --- a/packages/manager/apps/key-management-service/src/pages/dashboard/index.tsx +++ b/packages/manager/apps/key-management-service/src/pages/dashboard/index.tsx @@ -32,6 +32,8 @@ export default function DashboardPage() { const { t: tCredentials } = useTranslation( 'key-management-service/credential', ); + const { t: tLogs } = useTranslation('key-management-service/logs'); + const { okmsId } = useParams(); const { data: okms, @@ -82,6 +84,10 @@ export default function DashboardPage() { url: ROUTES_URLS.credentials, title: tDashboard('access_certificates'), }, + { + url: ROUTES_URLS.logs, + title: tDashboard('logs'), + }, ]; const breadcrumbItems: BreadcrumbItem[] = [ @@ -105,6 +111,11 @@ export default function DashboardPage() { label: tDashboard('key_management_service_update_name'), navigateTo: `/${okmsId}/${ROUTES_URLS.okmsUpdateName}`, }, + { + id: ROUTES_URLS.logs, + label: tLogs('key_management_service_logs'), + navigateTo: `/${okmsId}/${ROUTES_URLS.logs}`, + }, ]; const headerProps: HeadersProps = { diff --git a/packages/manager/apps/key-management-service/src/pages/dashboard/logs/Logs.page.tsx b/packages/manager/apps/key-management-service/src/pages/dashboard/logs/Logs.page.tsx new file mode 100644 index 000000000000..edd8f1dfcf83 --- /dev/null +++ b/packages/manager/apps/key-management-service/src/pages/dashboard/logs/Logs.page.tsx @@ -0,0 +1,24 @@ +import LogsToCustomerModule from '@ovh-ux/logs-to-customer/src/LogsToCustomer.module'; +import { Description } from '@ovh-ux/manager-react-components'; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { useParams } from 'react-router-dom'; + +export default function KmsLogs() { + const { okmsId } = useParams(); + const { t } = useTranslation('key-management-service/logs'); + + return ( +
+ {t('key_management_service_logs_description')} + +
+ ); +} diff --git a/packages/manager/apps/key-management-service/src/routes/routes.constants.ts b/packages/manager/apps/key-management-service/src/routes/routes.constants.ts index 0041c5ff8b1e..417bd7945936 100644 --- a/packages/manager/apps/key-management-service/src/routes/routes.constants.ts +++ b/packages/manager/apps/key-management-service/src/routes/routes.constants.ts @@ -8,6 +8,7 @@ export const ROUTES_URLS = { okmsUpdateName: 'update-name', keys: 'keys', keyId: ':keyId', + logs: 'logs', createKmsServiceKey: 'create', serviceKeyEditName: 'edit-name', serviceKeyDeactivate: 'deactivate', diff --git a/packages/manager/apps/key-management-service/src/routes/routes.tsx b/packages/manager/apps/key-management-service/src/routes/routes.tsx index fddde97f6f77..5f57a831f113 100644 --- a/packages/manager/apps/key-management-service/src/routes/routes.tsx +++ b/packages/manager/apps/key-management-service/src/routes/routes.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { logsRoutes } from '@ovh-ux/logs-to-customer'; import { PageType } from '@ovh-ux/manager-react-shell-client'; import NotFound from '../pages/404'; import { ROUTES_URLS } from './routes.constants'; @@ -157,6 +158,13 @@ export default [ }, ], }, + { + path: `${ROUTES_URLS.logs}/*`, + ...lazyRouteConfig(() => + import('@/pages/dashboard/logs/Logs.page'), + ), + children: [...logsRoutes], + }, ], }, { diff --git a/packages/manager/apps/key-management-service/tailwind.config.js b/packages/manager/apps/key-management-service/tailwind.config.js index 657ab11bb87d..62c2564c3f56 100644 --- a/packages/manager/apps/key-management-service/tailwind.config.js +++ b/packages/manager/apps/key-management-service/tailwind.config.js @@ -6,6 +6,10 @@ module.exports = { ...config, content: [ './src/**/*.{js,jsx,ts,tsx}', + path.join( + path.dirname(require.resolve('@ovh-ux/logs-to-customer')), + '**/*.{js,jsx,ts,tsx}', + ), path.join( path.dirname(require.resolve('@ovh-ux/manager-react-components')), '**/*.{js,jsx,ts,tsx}',