1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

F #5422: Add route to VM Template detail (#2037)

This commit is contained in:
Sergio Betanzos 2022-05-12 15:39:19 +02:00 committed by GitHub
parent bb715f162e
commit 4092379f0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 1 deletions

View File

@ -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,
},
],
},
{

View File

@ -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 <Redirect to="/" />
}
return (
<Stack height={1} overflow="auto">
<VmTemplateTabs id={id} />
</Stack>
)
}
export default VMTemplateDetail