From 1458f0b95f23d0f5cd01b69dcf00aac1ac5e1ff3 Mon Sep 17 00:00:00 2001 From: vichansson Date: Tue, 20 Oct 2026 10:44:43 +0300 Subject: [PATCH] B OpenNebula/one#8037: Add missing service inst. dialog (#4569) Signed-off-by: Victor Hansson --- .../etc/sunstone/tabs/10-instances-tab.yaml | 2 +- .../composed/TemplateSelectorDialog/index.js | 127 ++++++++++++++++++ .../src/modules/components/composed/index.js | 1 + .../src/modules/containers/Services/Create.js | 50 +++++++ .../src/modules/containers/Services/index.js | 1 + .../containers/VirtualMachines/Create.js | 77 ++--------- 6 files changed, 190 insertions(+), 68 deletions(-) create mode 100644 src/fireedge/src/modules/components/composed/TemplateSelectorDialog/index.js create mode 100644 src/fireedge/src/modules/containers/Services/Create.js diff --git a/src/fireedge/etc/sunstone/tabs/10-instances-tab.yaml b/src/fireedge/etc/sunstone/tabs/10-instances-tab.yaml index 17d44abad5..cbf89c9858 100644 --- a/src/fireedge/etc/sunstone/tabs/10-instances-tab.yaml +++ b/src/fireedge/etc/sunstone/tabs/10-instances-tab.yaml @@ -27,7 +27,7 @@ Component: Services - title: Instantiate Service Template path: /service/instantiate/ - Component: InstantiateServiceTemplate + Component: CreateService - title: Service path: /service/:id Component: ServiceDetail diff --git a/src/fireedge/src/modules/components/composed/TemplateSelectorDialog/index.js b/src/fireedge/src/modules/components/composed/TemplateSelectorDialog/index.js new file mode 100644 index 0000000000..50005f0802 --- /dev/null +++ b/src/fireedge/src/modules/components/composed/TemplateSelectorDialog/index.js @@ -0,0 +1,127 @@ +/* ------------------------------------------------------------------------- * + * Copyright 2002-2026, 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 { Dialog, DialogContent, DialogTitle, Stack } from '@mui/material' +import { Cancel } from 'iconoir-react' +import PropTypes from 'prop-types' +import { ReactElement } from 'react' + +import { Button } from '@modules/components/primitives/Buttons' +import { Table } from '@modules/components/primitives/Tables' +import { Text } from '@modules/components/primitives/Text' +import { T, TEXT_VARIANTS, TEXT_WEIGHTS } from '@ConstantsModule' + +/** + * Displays a searchable template selector dialog. + * + * @param {object} props - Dialog and table configuration + * @param {string} props.title - Dialog title + * @param {object} props.table - Template table model + * @param {object[]} props.data - Templates to display + * @param {boolean} props.isRefreshing - Whether templates are loading + * @param {Function} props.onRefresh - Refreshes the templates + * @param {Function} props.onClose - Closes the dialog + * @param {Function} props.onSelect - Opens the selected template + * @returns {ReactElement} Template selector dialog + */ +export function TemplateSelectorDialog({ + title, + table, + data, + isRefreshing, + onRefresh, + onClose, + onSelect, +}) { + return ( + + + + +