F OpenNebula/One#7133: buttons added to individual resources (#3763)

This commit is contained in:
Jorge Miguel Lobo Escalona authored and GitHub committed 2025-08-22 12:34:33 +02:00
1 parent 99c0e3670d
commit f3bb947485
25 files changed
+299 -112

No files matched your search

@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
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
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
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
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
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
@@ -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 <Tabs addBorder tabs={tabsAvailable} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable} />
</>
)
}
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
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
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
@@ -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 (
<Box marginBottom={2}>
<GlobalActions
className={styles.actions}
globalActions={actions}
selectedRows={parsedSelectedRows}
/>
</Box>
)
})
SingleDetailActions.propTypes = {
selectedRows: PropTypes.array,
actions: PropTypes.array,
}
SingleDetailActions.displayName = 'SingleDetailActions'
export default SingleDetailActions
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
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
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
return (
@@ -72,7 +81,10 @@ const VDCTabs = memo(({ id }) => {
</Stack>
)
})
VDCTabs.propTypes = { id: PropTypes.string.isRequired }
VDCTabs.propTypes = {
id: PropTypes.string.isRequired,
singleActions: PropTypes.func,
}
VDCTabs.displayName = 'VDCTabs'
export default VDCTabs
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
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
@@ -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}
</Alert>
</Fade>
<SingleDetailActions selectedRows={vm} singleActions={singleActions} />
<Tabs addBorder tabs={tabsAvailable} />
</>
)
@@ -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
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
return (
@@ -74,7 +83,10 @@ const VmTemplateTabs = memo(({ id }) => {
</Stack>
)
})
VmTemplateTabs.propTypes = { id: PropTypes.string.isRequired }
VmTemplateTabs.propTypes = {
id: PropTypes.string.isRequired,
singleActions: PropTypes.func,
}
VmTemplateTabs.displayName = 'VmTemplateTabs'
export default VmTemplateTabs
@@ -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 <Tabs addBorder tabs={tabsAvailable ?? []} />
return (
<>
<SingleDetailActions
selectedRows={data}
singleActions={singleActions}
/>
<Tabs addBorder tabs={tabsAvailable ?? []} />
</>
)
}
return (
@@ -82,7 +91,10 @@ const VnTabs = memo(({ id }) => {
</Stack>
)
})
VnTabs.propTypes = { id: PropTypes.string.isRequired }
VnTabs.propTypes = {
id: PropTypes.string.isRequired,
singleActions: PropTypes.func,
}
VnTabs.displayName = 'VnTabs'
export default VnTabs
@@ -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 (
<TranslateProvider>
<VDCTabs id={id} />
<VDCTabs id={id} singleActions={VDCsTable.Actions} />
</TranslateProvider>
)
}
@@ -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 (
<TranslateProvider>
<ClusterTabs id={id} />
<ClusterTabs id={id} singleActions={ClustersTable.Actions} />
</TranslateProvider>
)
}
@@ -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 (
<TranslateProvider>
<DatastoreTabs id={id} />
<DatastoreTabs id={id} singleActions={DatastoresTable.Actions} />
</TranslateProvider>
)
}
@@ -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 <Redirect to="/" />
return <Redirect to="/" singleActions={GroupsTable.Actions} />
}
return <GroupTabs id={id} />
@@ -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 (
<>
<TranslateProvider>
<HostTabs id={id} />
<HostTabs id={id} singleActions={HostsTable.Actions} />
</TranslateProvider>
</>
)
@@ -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 (
<TranslateProvider>
<ServiceTemplateTabs id={id} />
<ServiceTemplateTabs
id={id}
singleActions={ServiceTemplatesTable.Actions}
/>
</TranslateProvider>
)
}
@@ -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 <Redirect to="/" />
return <Redirect to="/" singleActions={UsersTable.Actions} />
}
return <UserTabs id={id} />
@@ -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 (
<TranslateProvider>
<VDCTabs id={id} />
<VDCTabs id={id} singleActions={VDCsTable.Actions} />
</TranslateProvider>
)
}
@@ -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 (
<TranslateProvider>
<VmTabs id={id} />
<VmTabs id={id} singleActions={VmsTable.Actions} />
</TranslateProvider>
)
}
@@ -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 (
<TranslateProvider>
<VnTabs id={id} />
<VnTabs id={id} singleActions={VnsTable.Actions} />
</TranslateProvider>
)
}
@@ -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 (
<TranslateProvider>
<VmTemplateTabs id={id} />
<VmTemplateTabs id={id} singleActions={VmTemplatesTable.Actions} />
</TranslateProvider>
)
}
@@ -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 (
<TranslateProvider>
<VrTabs id={id} />
<VrTabs id={id} singleActions={VrsTable.Actions} />
</TranslateProvider>
)
}
@@ -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 (
<TranslateProvider>
<VmTemplateTabs id={id} />
<VmTemplateTabs id={id} singleActions={VmTemplatesTable.Actions} />
</TranslateProvider>
)
}