Skip to content

Commit

Permalink
feat(kms): add logs-to-customer module
Browse files Browse the repository at this point in the history
ref: MANAGER-15966

Signed-off-by: Romain Jamet <[email protected]>
  • Loading branch information
Romain Jamet committed Nov 28, 2024
1 parent 5f42187 commit 60879a6
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/manager/apps/key-management-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@ovh-ux/logs-to-customer": "^1.0.0",
"@ovh-ux/manager-config": "^8.0.0",
"@ovh-ux/manager-core-api": "^0.9.0",
"@ovh-ux/manager-core-utils": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"key_management_service_logs": "logs",
"key_management_service_logs_description": "Une description à définir."
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ const Dashboard: React.FC<DashboardLayoutProps> = ({ 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]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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[] = [
Expand All @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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 (
<div className="flex flex-col gap-4">
<Description>{t('key_management_service_logs_description')}</Description>
<LogsToCustomerModule
logApiVersion="v2"
logApiBaseUrl={`/okms/resource/${okmsId}/log`}
/>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const ROUTES_URLS = {
okmsUpdateName: 'update-name',
keys: 'keys',
keyId: ':keyId',
logs: 'logs',
createKmsServiceKey: 'create',
serviceKeyEditName: 'edit-name',
serviceKeyDeactivate: 'deactivate',
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -157,6 +158,13 @@ export default [
},
],
},
{
path: `${ROUTES_URLS.logs}/*`,
...lazyRouteConfig(() =>
import('@/pages/dashboard/logs/Logs.page'),
),
children: [...logsRoutes],
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}',
Expand Down

0 comments on commit 60879a6

Please sign in to comment.