diff --git a/src/fireedge/src/modules/components/Tabs/Cluster/index.js b/src/fireedge/src/modules/components/Tabs/Cluster/index.js index 29b0c71fc3..95e0d68b7a 100644 --- a/src/fireedge/src/modules/components/Tabs/Cluster/index.js +++ b/src/fireedge/src/modules/components/Tabs/Cluster/index.js @@ -13,21 +13,22 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, ClusterAPI } from '@FeaturesModule' +import { ClusterAPI, useViews } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' -import Info from '@modules/components/Tabs/Cluster/Info' -import Hosts from '@modules/components/Tabs/Cluster/Hosts' -import Vnets from '@modules/components/Tabs/Cluster/Vnets' import Datastores from '@modules/components/Tabs/Cluster/Datastores' import PlanOptimization from '@modules/components/Tabs/Cluster/Drs' +import Hosts from '@modules/components/Tabs/Cluster/Hosts' +import Info from '@modules/components/Tabs/Cluster/Info' +import Vnets from '@modules/components/Tabs/Cluster/Vnets' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' const getTabComponent = (tabName) => ({ @@ -38,7 +39,7 @@ const getTabComponent = (tabName) => drs: PlanOptimization, }[tabName]) -const ClusterTabs = memo(({ id }) => { +const ClusterTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = ClusterAPI.useGetClusterQuery({ id }) @@ -58,7 +59,15 @@ const ClusterTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -71,7 +80,10 @@ const ClusterTabs = memo(({ id }) => { ) }) -ClusterTabs.propTypes = { id: PropTypes.string.isRequired } +ClusterTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.array.isRequired, +} ClusterTabs.displayName = 'ClusterTabs' export default ClusterTabs diff --git a/src/fireedge/src/modules/components/Tabs/Datastore/index.js b/src/fireedge/src/modules/components/Tabs/Datastore/index.js index 26b8cd614c..3ab4dbfbb0 100644 --- a/src/fireedge/src/modules/components/Tabs/Datastore/index.js +++ b/src/fireedge/src/modules/components/Tabs/Datastore/index.js @@ -13,19 +13,20 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, DatastoreAPI } from '@FeaturesModule' +import { DatastoreAPI, useViews } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' import Clusters from '@modules/components/Tabs/Datastore/Clusters' import Images from '@modules/components/Tabs/Datastore/Images' import Info from '@modules/components/Tabs/Datastore/Info' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' const getTabComponent = (tabName) => ({ @@ -34,7 +35,7 @@ const getTabComponent = (tabName) => clusters: Clusters, }[tabName]) -const DatastoreTabs = memo(({ id }) => { +const DatastoreTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = DatastoreAPI.useGetDatastoreQuery({ id, @@ -56,7 +57,15 @@ const DatastoreTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -69,7 +78,10 @@ const DatastoreTabs = memo(({ id }) => { ) }) -DatastoreTabs.propTypes = { id: PropTypes.string.isRequired } +DatastoreTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} DatastoreTabs.displayName = 'DatastoreTabs' export default DatastoreTabs diff --git a/src/fireedge/src/modules/components/Tabs/Group/index.js b/src/fireedge/src/modules/components/Tabs/Group/index.js index 1c65a1b7af..4ce83d7721 100644 --- a/src/fireedge/src/modules/components/Tabs/Group/index.js +++ b/src/fireedge/src/modules/components/Tabs/Group/index.js @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, GroupAPI } from '@FeaturesModule' +import { GroupAPI, useViews } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' - import { BaseTab as Tabs } from '@modules/components/Tabs' +import generateAccountingInfoTab from '@modules/components/Tabs/Accounting' import Info from '@modules/components/Tabs/Group/Info' import GroupUsersTab from '@modules/components/Tabs/Group/Users' import generateQuotasInfoTab from '@modules/components/Tabs/Quota' -import generateAccountingInfoTab from '@modules/components/Tabs/Accounting' import generateShowbackInfoTab from '@modules/components/Tabs/Showback' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' const getTabComponent = (tabName) => ({ @@ -38,7 +38,7 @@ const getTabComponent = (tabName) => showback: generateShowbackInfoTab({ groups: true }), }[tabName]) -const GroupTabs = memo(({ id }) => { +const GroupTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = GroupAPI.useGetGroupQuery({ id }) @@ -58,7 +58,15 @@ const GroupTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -71,7 +79,10 @@ const GroupTabs = memo(({ id }) => { ) }) -GroupTabs.propTypes = { id: PropTypes.string.isRequired } +GroupTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} GroupTabs.displayName = 'GroupTabs' export default GroupTabs diff --git a/src/fireedge/src/modules/components/Tabs/Host/index.js b/src/fireedge/src/modules/components/Tabs/Host/index.js index 6a00f13d91..37b9c03379 100644 --- a/src/fireedge/src/modules/components/Tabs/Host/index.js +++ b/src/fireedge/src/modules/components/Tabs/Host/index.js @@ -18,18 +18,19 @@ import PropTypes from 'prop-types' import { memo, useMemo } from 'react' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, HostAPI } from '@FeaturesModule' +import { HostAPI, useViews } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' +import { OpenNebulaLogo } from '@modules/components/Icons' import { BaseTab as Tabs } from '@modules/components/Tabs' -import Info from '@modules/components/Tabs/Host/Info' import Graph from '@modules/components/Tabs/Host/Graphs' -import PCI from '@modules/components/Tabs/Host/PCI' +import Info from '@modules/components/Tabs/Host/Info' import Numa from '@modules/components/Tabs/Host/Numa' +import PCI from '@modules/components/Tabs/Host/PCI' import Vms from '@modules/components/Tabs/Host/Vms' import Wilds from '@modules/components/Tabs/Host/Wilds' import Zombies from '@modules/components/Tabs/Host/Zombies' -import { OpenNebulaLogo } from '@modules/components/Icons' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' const getTabComponent = (tabName) => ({ @@ -42,7 +43,7 @@ const getTabComponent = (tabName) => zombies: Zombies, }[tabName]) -const HostTabs = memo(({ id }) => { +const HostTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, @@ -69,7 +70,15 @@ const HostTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -82,7 +91,10 @@ const HostTabs = memo(({ id }) => { ) }) -HostTabs.propTypes = { id: PropTypes.string.isRequired } +HostTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} HostTabs.displayName = 'HostTabs' export default HostTabs diff --git a/src/fireedge/src/modules/components/Tabs/ServiceTemplate/index.js b/src/fireedge/src/modules/components/Tabs/ServiceTemplate/index.js index bd2609390e..87886adcd4 100644 --- a/src/fireedge/src/modules/components/Tabs/ServiceTemplate/index.js +++ b/src/fireedge/src/modules/components/Tabs/ServiceTemplate/index.js @@ -13,19 +13,20 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, ServiceTemplateAPI } from '@FeaturesModule' +import { ServiceTemplateAPI, useViews } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' import Info from '@modules/components/Tabs/ServiceTemplate/Info' import Roles from '@modules/components/Tabs/ServiceTemplate/Roles' import Template from '@modules/components/Tabs/ServiceTemplate/Template' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' const getTabComponent = (tabName) => ({ @@ -34,7 +35,7 @@ const getTabComponent = (tabName) => template: Template, }[tabName]) -const ServiceTemplateTabs = memo(({ id }) => { +const ServiceTemplateTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = ServiceTemplateAPI.useGetServiceTemplateQuery({ @@ -57,7 +58,15 @@ const ServiceTemplateTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -70,7 +79,10 @@ const ServiceTemplateTabs = memo(({ id }) => { ) }) -ServiceTemplateTabs.propTypes = { id: PropTypes.string.isRequired } +ServiceTemplateTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} ServiceTemplateTabs.displayName = 'ServiceTemplateTabs' export default ServiceTemplateTabs diff --git a/src/fireedge/src/modules/components/Tabs/SingleDetailActions.js b/src/fireedge/src/modules/components/Tabs/SingleDetailActions.js new file mode 100644 index 0000000000..2e68390d4b --- /dev/null +++ b/src/fireedge/src/modules/components/Tabs/SingleDetailActions.js @@ -0,0 +1,56 @@ +/* ------------------------------------------------------------------------- * + * Copyright 2002-2025, 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 EnhancedTableStyles from '@modules/components/Tables/Enhanced/styles' +import { GlobalActions } from '@modules/components/Tables/Enhanced/Utils' +import { Box, useTheme } from '@mui/material' +import PropTypes from 'prop-types' +import { memo, useMemo } from 'react' + +const SingleDetailActions = memo(({ selectedRows = [], singleActions }) => { + const theme = useTheme() + const styles = useMemo( + () => + EnhancedTableStyles({ + ...theme, + readOnly: false, + }), + [theme] + ) + + if (!selectedRows || typeof singleActions !== 'function') { + return null + } + + const parsedSelectedRows = [{ original: selectedRows }] + const actions = singleActions({ selectedRows: parsedSelectedRows }) + + return ( + + + + ) +}) + +SingleDetailActions.propTypes = { + selectedRows: PropTypes.array, + actions: PropTypes.array, +} +SingleDetailActions.displayName = 'SingleDetailActions' +export default SingleDetailActions diff --git a/src/fireedge/src/modules/components/Tabs/User/index.js b/src/fireedge/src/modules/components/Tabs/User/index.js index 5292ba5781..0908430c57 100644 --- a/src/fireedge/src/modules/components/Tabs/User/index.js +++ b/src/fireedge/src/modules/components/Tabs/User/index.js @@ -13,21 +13,22 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, UserAPI } from '@FeaturesModule' +import { UserAPI, useViews } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' -import Info from '@modules/components/Tabs/User/Info' -import Group from '@modules/components/Tabs/User/Group' -import generateQuotasInfoTab from '@modules/components/Tabs/Quota' import generateAccountingInfoTab from '@modules/components/Tabs/Accounting' +import generateQuotasInfoTab from '@modules/components/Tabs/Quota' import generateShowbackInfoTab from '@modules/components/Tabs/Showback' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' import Authentication from '@modules/components/Tabs/User/Authentication' +import Group from '@modules/components/Tabs/User/Group' +import Info from '@modules/components/Tabs/User/Info' const getTabComponent = (tabName) => ({ @@ -39,7 +40,7 @@ const getTabComponent = (tabName) => authentication: Authentication, }[tabName]) -const UserTabs = memo(({ id }) => { +const UserTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = UserAPI.useGetUserQuery({ id }) @@ -59,7 +60,15 @@ const UserTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -72,7 +81,10 @@ const UserTabs = memo(({ id }) => { ) }) -UserTabs.propTypes = { id: PropTypes.string.isRequired } +UserTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} UserTabs.displayName = 'UserTabs' export default UserTabs diff --git a/src/fireedge/src/modules/components/Tabs/Vdc/index.js b/src/fireedge/src/modules/components/Tabs/Vdc/index.js index 803a254700..594b592ed4 100644 --- a/src/fireedge/src/modules/components/Tabs/Vdc/index.js +++ b/src/fireedge/src/modules/components/Tabs/Vdc/index.js @@ -13,22 +13,23 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' import { useViews, VdcAPI } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' +import Clusters from '@modules/components/Tabs/Vdc/Clusters' import Datastores from '@modules/components/Tabs/Vdc/Datastores' import Groups from '@modules/components/Tabs/Vdc/Groups' import Hosts from '@modules/components/Tabs/Vdc/Hosts' import Info from '@modules/components/Tabs/Vdc/Info' import Vnets from '@modules/components/Tabs/Vdc/Vnets' -import Clusters from '@modules/components/Tabs/Vdc/Clusters' const getTabComponent = (tabName) => ({ @@ -40,7 +41,7 @@ const getTabComponent = (tabName) => datastores: Datastores, }[tabName]) -const VDCTabs = memo(({ id }) => { +const VDCTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = VdcAPI.useGetVDCQuery({ id }) @@ -60,7 +61,15 @@ const VDCTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -72,7 +81,10 @@ const VDCTabs = memo(({ id }) => { ) }) -VDCTabs.propTypes = { id: PropTypes.string.isRequired } +VDCTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} VDCTabs.displayName = 'VDCTabs' export default VDCTabs diff --git a/src/fireedge/src/modules/components/Tabs/VirtualRouter/index.js b/src/fireedge/src/modules/components/Tabs/VirtualRouter/index.js index 4e3d55a8f1..cec5dafaca 100644 --- a/src/fireedge/src/modules/components/Tabs/VirtualRouter/index.js +++ b/src/fireedge/src/modules/components/Tabs/VirtualRouter/index.js @@ -13,16 +13,17 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' import { useViews, VrAPI } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' import Info from '@modules/components/Tabs/VirtualRouter/Info' import VmInfo from '@modules/components/Tabs/VirtualRouter/Vms' @@ -32,7 +33,7 @@ const getTabComponent = (tabName) => vms: VmInfo, }[tabName]) -const VirtualRouterTabs = memo(({ id }) => { +const VirtualRouterTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = VrAPI.useGetVrQuery({ id, @@ -54,7 +55,15 @@ const VirtualRouterTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -67,7 +76,10 @@ const VirtualRouterTabs = memo(({ id }) => { ) }) -VirtualRouterTabs.propTypes = { id: PropTypes.string.isRequired } +VirtualRouterTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} VirtualRouterTabs.displayName = 'VirtualRouterTabs' export default VirtualRouterTabs diff --git a/src/fireedge/src/modules/components/Tabs/Vm/index.js b/src/fireedge/src/modules/components/Tabs/Vm/index.js index 1851ccd6fa..7d8db88642 100644 --- a/src/fireedge/src/modules/components/Tabs/Vm/index.js +++ b/src/fireedge/src/modules/components/Tabs/Vm/index.js @@ -13,30 +13,31 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { Alert, Fade, Stack, useTheme } from '@mui/material' -import { OpenNebulaLogo } from '@modules/components/Icons' import { css } from '@emotion/css' +import { OpenNebulaLogo } from '@modules/components/Icons' +import { Alert, Fade, Stack, useTheme } from '@mui/material' import { Cancel as CloseIcon } from 'iconoir-react' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { Translate } from '@modules/components/HOC' import { RESOURCE_NAMES, T } from '@ConstantsModule' -import { useViews, useSystemData, VmAPI } from '@FeaturesModule' +import { useSystemData, useViews, VmAPI } from '@FeaturesModule' import { getAvailableInfoTabs, getErrorMessage, jsonToXml } from '@ModelsModule' +import { Translate } from '@modules/components/HOC' import { SubmitButton } from '@modules/components/FormControl' import { BaseTab as Tabs } from '@modules/components/Tabs' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' import Backup from '@modules/components/Tabs/Vm/Backup' import Configuration from '@modules/components/Tabs/Vm/Configuration' import History from '@modules/components/Tabs/Vm/History' import Info from '@modules/components/Tabs/Vm/Info' import Network from '@modules/components/Tabs/Vm/Network' +import Pci from '@modules/components/Tabs/Vm/Pci' import SchedActions from '@modules/components/Tabs/Vm/SchedActions' import Snapshot from '@modules/components/Tabs/Vm/Snapshot' import Storage from '@modules/components/Tabs/Vm/Storage' import Template from '@modules/components/Tabs/Vm/Template' -import Pci from '@modules/components/Tabs/Vm/Pci' const useStyles = ({ palette }) => ({ vmError: css({ @@ -61,7 +62,7 @@ const getTabComponent = (tabName) => template: Template, }[tabName]) -const VmTabs = memo(({ id }) => { +const VmTabs = memo(({ id, singleActions }) => { const theme = useTheme() const classes = useMemo(() => useStyles(theme), [theme]) const { view, getResourceView } = useViews() @@ -127,6 +128,7 @@ const VmTabs = memo(({ id }) => { {vmError} + ) @@ -142,7 +144,10 @@ const VmTabs = memo(({ id }) => { ) }) -VmTabs.propTypes = { id: PropTypes.string.isRequired } +VmTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} VmTabs.displayName = 'VmTabs' export default VmTabs diff --git a/src/fireedge/src/modules/components/Tabs/VmTemplate/index.js b/src/fireedge/src/modules/components/Tabs/VmTemplate/index.js index e91afe2e2a..3db8cbd580 100644 --- a/src/fireedge/src/modules/components/Tabs/VmTemplate/index.js +++ b/src/fireedge/src/modules/components/Tabs/VmTemplate/index.js @@ -13,16 +13,17 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, useSystemData, VmTemplateAPI } from '@FeaturesModule' +import { useSystemData, useViews, VmTemplateAPI } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' import Info from '@modules/components/Tabs/VmTemplate/Info' import Template from '@modules/components/Tabs/VmTemplate/Template' @@ -32,7 +33,7 @@ const getTabComponent = (tabName) => template: Template, }[tabName]) -const VmTemplateTabs = memo(({ id }) => { +const VmTemplateTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = VmTemplateAPI.useGetTemplateQuery({ id, @@ -62,7 +63,15 @@ const VmTemplateTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -74,7 +83,10 @@ const VmTemplateTabs = memo(({ id }) => { ) }) -VmTemplateTabs.propTypes = { id: PropTypes.string.isRequired } +VmTemplateTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} VmTemplateTabs.displayName = 'VmTemplateTabs' export default VmTemplateTabs diff --git a/src/fireedge/src/modules/components/Tabs/Vn/index.js b/src/fireedge/src/modules/components/Tabs/Vn/index.js index 295e904e77..28cabcb57e 100644 --- a/src/fireedge/src/modules/components/Tabs/Vn/index.js +++ b/src/fireedge/src/modules/components/Tabs/Vn/index.js @@ -13,16 +13,17 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { OpenNebulaLogo } from '@modules/components/Icons' import { Alert, Stack } from '@mui/material' import PropTypes from 'prop-types' import { memo, useMemo } from 'react' -import { OpenNebulaLogo } from '@modules/components/Icons' import { RESOURCE_NAMES } from '@ConstantsModule' -import { useViews, useSystemData, VnAPI } from '@FeaturesModule' +import { useSystemData, useViews, VnAPI } from '@FeaturesModule' import { getAvailableInfoTabs } from '@ModelsModule' import { BaseTab as Tabs } from '@modules/components/Tabs' +import SingleDetailActions from '@modules/components/Tabs/SingleDetailActions' import Address from '@modules/components/Tabs/Vn/Address' import Clusters from '@modules/components/Tabs/Vn/Clusters' import Info from '@modules/components/Tabs/Vn/Info' @@ -40,7 +41,7 @@ const getTabComponent = (tabName) => cluster: Clusters, }[tabName]) -const VnTabs = memo(({ id }) => { +const VnTabs = memo(({ id, singleActions }) => { const { view, getResourceView } = useViews() const { isError, error, status, data } = VnAPI.useGetVNetworkQuery({ id, @@ -70,7 +71,15 @@ const VnTabs = memo(({ id }) => { } if (status === 'fulfilled' || id === data?.ID) { - return + return ( + <> + + + + ) } return ( @@ -82,7 +91,10 @@ const VnTabs = memo(({ id }) => { ) }) -VnTabs.propTypes = { id: PropTypes.string.isRequired } +VnTabs.propTypes = { + id: PropTypes.string.isRequired, + singleActions: PropTypes.func, +} VnTabs.displayName = 'VnTabs' export default VnTabs diff --git a/src/fireedge/src/modules/containers/BackupJobs/Detail.js b/src/fireedge/src/modules/containers/BackupJobs/Detail.js index b4a3e2b75a..1c56f43c44 100644 --- a/src/fireedge/src/modules/containers/BackupJobs/Detail.js +++ b/src/fireedge/src/modules/containers/BackupJobs/Detail.js @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { TranslateProvider, VDCTabs } from '@ComponentsModule' +import { VDCsTable } from '@modules/components/Tables' import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' - -import { VDCTabs, TranslateProvider } from '@ComponentsModule' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a VDC. @@ -32,7 +32,7 @@ export function BackupJobDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/Clusters/Detail.js b/src/fireedge/src/modules/containers/Clusters/Detail.js index 86e41a3a7b..16e7294894 100644 --- a/src/fireedge/src/modules/containers/Clusters/Detail.js +++ b/src/fireedge/src/modules/containers/Clusters/Detail.js @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' - import { ClusterTabs, TranslateProvider } from '@ComponentsModule' +import { ClustersTable } from '@modules/components/Tables' +import { ReactElement } from 'react' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a Cluster. @@ -32,7 +32,7 @@ export function ClusterDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/Datastores/Detail.js b/src/fireedge/src/modules/containers/Datastores/Detail.js index 5a14802764..6bafe35cb2 100644 --- a/src/fireedge/src/modules/containers/Datastores/Detail.js +++ b/src/fireedge/src/modules/containers/Datastores/Detail.js @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' import { DatastoreTabs, TranslateProvider } from '@ComponentsModule' +import { DatastoresTable } from '@modules/components/Tables' +import { ReactElement } from 'react' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a Datastore. @@ -31,7 +32,7 @@ export function DatastoreDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/Groups/Detail.js b/src/fireedge/src/modules/containers/Groups/Detail.js index 8081d09ca6..a46b3bf404 100644 --- a/src/fireedge/src/modules/containers/Groups/Detail.js +++ b/src/fireedge/src/modules/containers/Groups/Detail.js @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' - import { GroupTabs } from '@ComponentsModule' +import { GroupsTable } from '@modules/components/Tables' +import { ReactElement } from 'react' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a Group. @@ -27,7 +27,7 @@ export function GroupDetail() { const { id } = useParams() if (Number.isNaN(+id)) { - return + return } return diff --git a/src/fireedge/src/modules/containers/Hosts/Detail.js b/src/fireedge/src/modules/containers/Hosts/Detail.js index a492e20315..40d85f23b1 100644 --- a/src/fireedge/src/modules/containers/Hosts/Detail.js +++ b/src/fireedge/src/modules/containers/Hosts/Detail.js @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { HostTabs, TranslateProvider } from '@ComponentsModule' +import { HostsTable } from '@modules/components/Tables' import { ReactElement } from 'react' import { Redirect, useParams } from 'react-router-dom' -import { HostTabs, TranslateProvider } from '@ComponentsModule' - /** * Displays the detail information about a Host. * @@ -33,7 +33,7 @@ export function HostDetail() { return ( <> - + ) diff --git a/src/fireedge/src/modules/containers/ServiceTemplates/Detail.js b/src/fireedge/src/modules/containers/ServiceTemplates/Detail.js index 3908eabc58..09c118bbc8 100644 --- a/src/fireedge/src/modules/containers/ServiceTemplates/Detail.js +++ b/src/fireedge/src/modules/containers/ServiceTemplates/Detail.js @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { ServiceTemplatesTable } from '@modules/components/Tables' import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' +import { Redirect, useParams } from 'react-router-dom' import { ServiceTemplateTabs, TranslateProvider } from '@ComponentsModule' @@ -32,7 +33,10 @@ export function ServiceTemplateDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/Users/Detail.js b/src/fireedge/src/modules/containers/Users/Detail.js index 4362466372..1046f4de0c 100644 --- a/src/fireedge/src/modules/containers/Users/Detail.js +++ b/src/fireedge/src/modules/containers/Users/Detail.js @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' - import { UserTabs } from '@ComponentsModule' +import { UsersTable } from '@modules/components/Tables' +import { ReactElement } from 'react' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a User. @@ -27,7 +27,7 @@ export function UserDetail() { const { id } = useParams() if (Number.isNaN(+id)) { - return + return } return diff --git a/src/fireedge/src/modules/containers/VDCs/Detail.js b/src/fireedge/src/modules/containers/VDCs/Detail.js index 77d5ddadca..027d4131fc 100644 --- a/src/fireedge/src/modules/containers/VDCs/Detail.js +++ b/src/fireedge/src/modules/containers/VDCs/Detail.js @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { TranslateProvider, VDCTabs } from '@ComponentsModule' +import { VDCsTable } from '@modules/components/Tables' import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' - -import { VDCTabs, TranslateProvider } from '@ComponentsModule' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a VDC. @@ -32,7 +32,7 @@ export function VDCDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/VirtualMachines/Detail.js b/src/fireedge/src/modules/containers/VirtualMachines/Detail.js index 43376cb84c..57cb1e3e49 100644 --- a/src/fireedge/src/modules/containers/VirtualMachines/Detail.js +++ b/src/fireedge/src/modules/containers/VirtualMachines/Detail.js @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { TranslateProvider, VmTabs } from '@ComponentsModule' +import { VmsTable } from '@modules/components/Tables' import { ReactElement } from 'react' import { Redirect, useParams } from 'react-router-dom' -import { VmTabs, TranslateProvider } from '@ComponentsModule' - /** * Displays the detail information about a Virtual Machine. * @@ -32,7 +32,7 @@ export function VirtualMachineDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/VirtualNetworks/Detail.js b/src/fireedge/src/modules/containers/VirtualNetworks/Detail.js index 56f0314afb..e0beff86a5 100644 --- a/src/fireedge/src/modules/containers/VirtualNetworks/Detail.js +++ b/src/fireedge/src/modules/containers/VirtualNetworks/Detail.js @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { TranslateProvider, VnTabs } from '@ComponentsModule' +import { VnsTable } from '@modules/components/Tables' import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' - -import { VnTabs, TranslateProvider } from '@ComponentsModule' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a VM Template. @@ -32,7 +32,7 @@ export function VirtualNetworkDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/VirtualRouterTemplates/Detail.js b/src/fireedge/src/modules/containers/VirtualRouterTemplates/Detail.js index d4ba891707..de0b8f9105 100644 --- a/src/fireedge/src/modules/containers/VirtualRouterTemplates/Detail.js +++ b/src/fireedge/src/modules/containers/VirtualRouterTemplates/Detail.js @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { TranslateProvider, VmTemplateTabs } from '@ComponentsModule' +import { VmTemplatesTable } from '@modules/components/Tables' import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' - -import { VmTemplateTabs, TranslateProvider } from '@ComponentsModule' +import { Redirect, useParams } from 'react-router-dom' /** * Displays the detail information about a VR Template. * * @returns {ReactElement} VR Template detail component. */ -export function VrTemplateDetails() { +export function VrTemplateDetail() { const { id } = useParams() if (Number.isNaN(+id)) { @@ -32,7 +32,7 @@ export function VrTemplateDetails() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/VirtualRouters/Detail.js b/src/fireedge/src/modules/containers/VirtualRouters/Detail.js index ce95d2b080..068199b3b3 100644 --- a/src/fireedge/src/modules/containers/VirtualRouters/Detail.js +++ b/src/fireedge/src/modules/containers/VirtualRouters/Detail.js @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { VrsTable } from '@modules/components/Tables' import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' +import { Redirect, useParams } from 'react-router-dom' -import { VrTabs, TranslateProvider } from '@ComponentsModule' +import { TranslateProvider, VrTabs } from '@ComponentsModule' /** * Displays the detail information about a Service Template. @@ -32,7 +33,7 @@ export function VirtualRouterDetail() { return ( - + ) } diff --git a/src/fireedge/src/modules/containers/VmTemplates/Detail.js b/src/fireedge/src/modules/containers/VmTemplates/Detail.js index 2fb3a2eb48..93c1c97769 100644 --- a/src/fireedge/src/modules/containers/VmTemplates/Detail.js +++ b/src/fireedge/src/modules/containers/VmTemplates/Detail.js @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ +import { VmTemplatesTable } from '@modules/components/Tables' import { ReactElement } from 'react' -import { useParams, Redirect } from 'react-router-dom' +import { Redirect, useParams } from 'react-router-dom' -import { VmTemplateTabs, TranslateProvider } from '@ComponentsModule' +import { TranslateProvider, VmTemplateTabs } from '@ComponentsModule' /** * Displays the detail information about a VM Template. @@ -32,7 +33,7 @@ export function VmTemplateDetail() { return ( - + ) }