From 0ca01deee1a05e89b89bcfc21f510cf8fd3f5850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Matias=CC=8Cko?= Date: Thu, 6 Jul 2023 00:03:30 +0200 Subject: [PATCH] Menu disabled items --- http-gateway/web/packages/shared-ui | 2 +- .../web/src/containers/App/App.i18n.ts | 80 +++++++++ http-gateway/web/src/routes.tsx | 156 +++++++++++++++++- 3 files changed, 232 insertions(+), 6 deletions(-) diff --git a/http-gateway/web/packages/shared-ui b/http-gateway/web/packages/shared-ui index 9f98551cb..2222d7969 160000 --- a/http-gateway/web/packages/shared-ui +++ b/http-gateway/web/packages/shared-ui @@ -1 +1 @@ -Subproject commit 9f98551cb55c9405843879b7c4b5644a1011373d +Subproject commit 2222d79693a4588f7e3348cb754b6571b51a8d5b diff --git a/http-gateway/web/src/containers/App/App.i18n.ts b/http-gateway/web/src/containers/App/App.i18n.ts index a1afbd0e2..0de6f2f14 100644 --- a/http-gateway/web/src/containers/App/App.i18n.ts +++ b/http-gateway/web/src/containers/App/App.i18n.ts @@ -41,4 +41,84 @@ export const messages = defineMessages({ id: 'app.clickHere', defaultMessage: 'Click here!', }, + menuMainMenu: { + id: 'app.menuMainMenu', + defaultMessage: 'Main Menu', + }, + menuDashboard: { + id: 'app.menuDashboard', + defaultMessage: 'Dashboard', + }, + menuDevices: { + id: 'app.menuDevices', + defaultMessage: 'Devices', + }, + menuIntegrations: { + id: 'app.menuIntegrations', + defaultMessage: 'Integrations', + }, + menuRemoteClients: { + id: 'app.menuRemoteClients', + defaultMessage: 'Remote clients', + }, + menuPendingCommands: { + id: 'app.menuPendingCommands', + defaultMessage: 'Pending commands', + }, + menuOthers: { + id: 'app.menuOthers', + defaultMessage: 'Others', + }, + menuDeviceProvisioning: { + id: 'app.menuDeviceProvisioning', + defaultMessage: 'Device provisioning', + }, + menuQuickstart: { + id: 'app.menuQuickstart', + defaultMessage: 'Quickstart', + }, + menuManageEnrollments: { + id: 'app.menuManageEnrollments', + defaultMessage: 'Manage enrollments', + }, + menuLinkedHubs: { + id: 'app.menuLinkedHubs', + defaultMessage: 'Linked hubs', + }, + menuCertificates: { + id: 'app.menuCertificates', + defaultMessage: 'Certificates', + }, + menuRegistrationRecords: { + id: 'app.menuRegistrationRecords', + defaultMessage: 'Registration records', + }, + menuDeviceFirmwareUpdate: { + id: 'app.menuDeviceFirmwareUpdate', + defaultMessage: 'Device Firmware update', + }, + menuDeviceLogs: { + id: 'app.menuDeviceLogs', + defaultMessage: 'Device logs', + }, + menuApiTokens: { + id: 'app.menuApiTokens', + defaultMessage: 'API tokens', + }, + menuSchemaHub: { + id: 'app.menuSchemaHub', + defaultMessage: 'Schema Hub', + }, + menuSupport: { + id: 'app.menuSupport', + defaultMessage: 'Support', + }, + menuDocs: { + id: 'app.menuDocs', + defaultMessage: 'Docs', + }, + menuChatRoom: { + id: 'app.menuChatRoom', + defaultMessage: 'Chat room', + }, }) diff --git a/http-gateway/web/src/routes.tsx b/http-gateway/web/src/routes.tsx index e8ef5e295..9f370260c 100644 --- a/http-gateway/web/src/routes.tsx +++ b/http-gateway/web/src/routes.tsx @@ -2,31 +2,177 @@ import { Routes as RoutesGroup, Route, matchPath } from 'react-router-dom' import { useIntl } from 'react-intl' import NotFoundPage from '@shared-ui/components/Templates/NotFoundPage' -import { IconDevices, IconSettings } from '@shared-ui/components/Atomic/Icon/' +import { + IconDevices, + IconSettings, + IconDashboard, + IconIntegrations, + IconRemoteClients, + IconPendingCommands, + IconNetwork, + IconDeviceUpdate, + IconLog, + IconLock, + IconNet, + IconDocs, + IconChat, +} from '@shared-ui/components/Atomic/Icon/' import DevicesListPage from '@/containers/Devices/List/DevicesListPage' import DevicesDetailsPage from '@/containers/Devices/Detail/DevicesDetailsPage' import { messages as t } from './containers/App/App.i18n' import TestPage from './containers/Test' +import { MenuGroup } from '@shared-ui/components/Layout/LeftPanel/LeftPanel.types' -export const menu = [ +const MenuTranslate = (props: { id: string }) => { + const { id } = props + const { formatMessage: _ } = useIntl() + + // @ts-ignore + return {_(t[id])} +} + +export const menu: MenuGroup[] = [ { - title: 'Main menu', + title: , items: [ + { + icon: , + id: '0', + title: , + link: '/dashboard', + paths: ['/dashboard'], + exact: true, + disabled: true, + }, { icon: , id: '1', - title: 'Devices', + title: , link: '/', paths: ['/', '/devices/:id', '/devices/:id/resources', '/devices/:id/resources/:href'], exact: true, }, + { + icon: , + id: '2', + title: , + link: '/integrations', + paths: ['/integrations'], + exact: true, + disabled: true, + }, + { + icon: , + id: '3', + title: , + link: '/remote-clients', + paths: ['/remote-clients'], + exact: true, + disabled: true, + }, + { + icon: , + id: '3', + title: , + link: '/pending-commands', + paths: ['/pending-commands'], + exact: true, + disabled: true, + }, + ], + }, + { + title: , + items: [ + { + icon: , + id: '10', + title: , + link: '/device-provisioning', + paths: ['/device-provisioning'], + exact: true, + disabled: true, + children: [ + { id: '101', title: , tag: { variant: 'success', text: 'New' } }, + { id: '102', title: }, + { id: '103', title: }, + { id: '104', title: , tag: { variant: 'info', text: 'Soon!' } }, + { id: '105', title: }, + ], + }, + { + icon: , + id: '11', + title: , + link: '/device-firmware-update', + paths: ['/device-firmware-update'], + exact: true, + disabled: true, + children: [ + { id: '111', title: 'Quickstart 2', tag: { variant: 'success', text: 'New 2' } }, + { id: '112', title: 'Manage enrollments 2' }, + { id: '113', title: 'Linked hubs 2' }, + { id: '114', title: 'Certificates 2', tag: { variant: 'info', text: 'Soon!' } }, + { id: '115', title: 'Registration records 2' }, + ], + }, + { + icon: , + id: '12', + title: , + link: '/device-firmware-update', + paths: ['/device-firmware-update'], + exact: true, + disabled: true, + }, + { + icon: , + id: '13', + title: , + link: '/api-tokens', + paths: ['/api-tokens'], + exact: true, + disabled: true, + }, + { + icon: , + id: '14', + title: , + link: '/schema-hub', + paths: ['/schema-hub'], + exact: true, + disabled: true, + }, + ], + }, + { + title: , + items: [ + { + icon: , + id: '20', + title: , + link: '/docs', + paths: ['/docs'], + exact: true, + disabled: true, + }, + { + icon: , + id: '21', + title: , + link: '/chat-room', + paths: ['/hat-room'], + exact: true, + disabled: true, + }, ], }, ] if (process.env?.REACT_APP_TEST_VIEW === 'true') { - menu[0].items.push({ + menu[0]?.items?.push({ icon: , id: '999', title: 'Test',