From 4092379f0f84728ddd93e7e4bde34db71c785d4b Mon Sep 17 00:00:00 2001 From: Sergio Betanzos Date: Thu, 12 May 2022 15:39:19 +0200 Subject: [PATCH] F #5422: Add route to VM Template detail (#2037) --- .../src/client/apps/sunstone/routesOne.js | 12 +++++- .../client/containers/VmTemplates/Detail.js | 41 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/fireedge/src/client/containers/VmTemplates/Detail.js diff --git a/src/fireedge/src/client/apps/sunstone/routesOne.js b/src/fireedge/src/client/apps/sunstone/routesOne.js index 4e7dc0070d..603338767a 100644 --- a/src/fireedge/src/client/apps/sunstone/routesOne.js +++ b/src/fireedge/src/client/apps/sunstone/routesOne.js @@ -63,6 +63,10 @@ const CreateVmTemplate = loadable( () => import('client/containers/VmTemplates/Create'), { ssr: false } ) +const VMTemplateDetail = loadable( + () => import('client/containers/VmTemplates/Detail'), + { ssr: false } +) // const VrTemplates = loadable(() => import('client/containers/VrTemplates'), { ssr: false }) // const VmGroups = loadable(() => import('client/containers/VmGroups'), { ssr: false }) @@ -137,9 +141,9 @@ export const PATH = { TEMPLATE: { VMS: { LIST: `/${RESOURCE_NAMES.VM_TEMPLATE}`, - DETAIL: `/${RESOURCE_NAMES.VM_TEMPLATE}/:id`, INSTANTIATE: `/${RESOURCE_NAMES.VM_TEMPLATE}/instantiate`, CREATE: `/${RESOURCE_NAMES.VM_TEMPLATE}/create`, + DETAIL: `/${RESOURCE_NAMES.VM_TEMPLATE}/:id`, }, }, STORAGE: { @@ -255,6 +259,12 @@ const ENDPOINTS = [ path: PATH.TEMPLATE.VMS.CREATE, Component: CreateVmTemplate, }, + { + title: T.VMTemplate, + description: (params) => `#${params?.id}`, + path: PATH.TEMPLATE.VMS.DETAIL, + Component: VMTemplateDetail, + }, ], }, { diff --git a/src/fireedge/src/client/containers/VmTemplates/Detail.js b/src/fireedge/src/client/containers/VmTemplates/Detail.js new file mode 100644 index 0000000000..4510ab831c --- /dev/null +++ b/src/fireedge/src/client/containers/VmTemplates/Detail.js @@ -0,0 +1,41 @@ +/* ------------------------------------------------------------------------- * + * Copyright 2002-2022, OpenNebula Project, OpenNebula Systems * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); you may * + * not use this file except in compliance with the License. You may obtain * + * a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * ------------------------------------------------------------------------- */ +import { ReactElement } from 'react' +import { Stack } from '@mui/material' +import { useParams, Redirect } from 'react-router-dom' + +import VmTemplateTabs from 'client/components/Tabs/VmTemplate' + +/** + * Displays the detail information about a VM Template. + * + * @returns {ReactElement} VM Template detail component. + */ +function VMTemplateDetail() { + const { id } = useParams() + + if (Number.isNaN(+id)) { + return + } + + return ( + + + + ) +} + +export default VMTemplateDetail