mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
(cherry picked from commit 05d17aa6b3ed2cc3da20e1aadbd4931e09919d3e)
This commit is contained in:
parent
8f365a30ae
commit
2d2103ea16
@ -36,7 +36,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const BackupTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetImageQuery({ id })
|
||||
const { isError, error, status, data } = useGetImageQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.BACKUP
|
||||
@ -53,14 +53,11 @@ const BackupTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
BackupTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -32,7 +32,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const ClusterTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetClusterQuery({ id })
|
||||
const { isError, error, status, data } = useGetClusterQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.CLUSTER
|
||||
@ -48,14 +48,12 @@ const ClusterTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
ClusterTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -32,7 +32,9 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const DatastoreTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetDatastoreQuery({ id })
|
||||
const { isError, error, status, data } = useGetDatastoreQuery({
|
||||
id,
|
||||
})
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.DATASTORE
|
||||
@ -48,14 +50,12 @@ const DatastoreTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
DatastoreTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -32,7 +32,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const GroupTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetGroupQuery({ id })
|
||||
const { isError, error, status, data } = useGetGroupQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.GROUP
|
||||
@ -48,14 +48,12 @@ const GroupTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
GroupTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -40,7 +40,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const HostTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetHostQuery(
|
||||
const { isError, error, status, data } = useGetHostQuery(
|
||||
{ id },
|
||||
{ refetchOnMountOrArgChange: 10 }
|
||||
)
|
||||
@ -59,14 +59,12 @@ const HostTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
HostTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -36,7 +36,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const ImageTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetImageQuery({ id })
|
||||
const { isError, error, status, data } = useGetImageQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.IMAGE
|
||||
@ -52,14 +52,12 @@ const ImageTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
ImageTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -32,7 +32,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const MarketplaceTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetMarketplaceQuery({ id })
|
||||
const { isError, error, status, data } = useGetMarketplaceQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.MARKETPLACE
|
||||
@ -49,14 +49,11 @@ const MarketplaceTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
MarketplaceTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
MarketplaceTabs.displayName = 'MarketplaceTabs'
|
||||
|
@ -34,7 +34,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const MarketplaceAppTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetMarketplaceAppQuery(
|
||||
const { isError, error, status, data } = useGetMarketplaceAppQuery(
|
||||
{ id },
|
||||
{ refetchOnMountOrArgChange: 10 }
|
||||
)
|
||||
@ -54,14 +54,11 @@ const MarketplaceAppTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
MarketplaceAppTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
MarketplaceAppTabs.displayName = 'MarketplaceAppTabs'
|
||||
|
@ -33,7 +33,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const SecurityGroupTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetSecGroupQuery({ id })
|
||||
const { isError, error, status, data } = useGetSecGroupQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.SEC_GROUP
|
||||
@ -50,14 +50,11 @@ const SecurityGroupTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
SecurityGroupTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -38,7 +38,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const ServiceTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetServiceQuery({ id })
|
||||
const { isError, error, status, data } = useGetServiceQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.SERVICE
|
||||
@ -55,14 +55,11 @@ const ServiceTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
ServiceTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -36,7 +36,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const ServiceTemplateTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetServiceTemplateQuery({
|
||||
const { isError, error, status, data } = useGetServiceTemplateQuery({
|
||||
id,
|
||||
})
|
||||
|
||||
@ -54,14 +54,12 @@ const ServiceTemplateTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
ServiceTemplateTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -32,7 +32,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const UserTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetUserQuery({ id })
|
||||
const { isError, error, status, data } = useGetUserQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.USER
|
||||
@ -48,14 +48,12 @@ const UserTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
UserTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -42,7 +42,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const VNetworkTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetVNetworkQuery({
|
||||
const { isError, error, status, data } = useGetVNetworkQuery({
|
||||
id,
|
||||
})
|
||||
|
||||
@ -61,15 +61,11 @@ const VNetworkTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
VNetworkTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
VNetworkTabs.displayName = 'VNetworkTabs'
|
||||
|
@ -32,7 +32,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const VNetTemplateTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetVNTemplateQuery({ id })
|
||||
const { isError, error, status, data } = useGetVNTemplateQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.VN_TEMPLATE
|
||||
@ -49,14 +49,11 @@ const VNetTemplateTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
VNetTemplateTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -71,14 +71,13 @@ const VmTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const {
|
||||
status,
|
||||
isLoading,
|
||||
isError,
|
||||
error,
|
||||
data: vm = {},
|
||||
} = useGetVmQuery({ id }, { refetchOnMountOrArgChange: 10 })
|
||||
const [dismissError] = useUpdateUserTemplateMutation()
|
||||
|
||||
const { USER_TEMPLATE } = vm
|
||||
const { USER_TEMPLATE, ID } = vm
|
||||
|
||||
const handleDismissError = async () => {
|
||||
const { ERROR, SCHED_MESSAGE, ...templateWithoutError } = USER_TEMPLATE
|
||||
@ -104,10 +103,7 @@ const VmTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
if (status === 'fulfilled' || id === ID) {
|
||||
return (
|
||||
<>
|
||||
<Fade in={!!vmError} unmountOnExit>
|
||||
@ -132,7 +128,7 @@ const VmTabs = memo(({ id }) => {
|
||||
)
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
|
||||
VmTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
|
@ -34,7 +34,7 @@ const getTabComponent = (tabName) =>
|
||||
|
||||
const VmTemplateTabs = memo(({ id }) => {
|
||||
const { view, getResourceView } = useViews()
|
||||
const { isLoading, isError, error, status } = useGetTemplateQuery({ id })
|
||||
const { isError, error, status, data } = useGetTemplateQuery({ id })
|
||||
|
||||
const tabsAvailable = useMemo(() => {
|
||||
const resource = RESOURCE_NAMES.VM_TEMPLATE
|
||||
@ -50,14 +50,12 @@ const VmTemplateTabs = memo(({ id }) => {
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
if (isLoading || status === 'pending') {
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
}
|
||||
if (status === 'fulfilled') {
|
||||
|
||||
if (status === 'fulfilled' || id === data?.ID) {
|
||||
return <Tabs addBorder tabs={tabsAvailable ?? []} />
|
||||
}
|
||||
|
||||
return <></>
|
||||
return <LinearProgress color="secondary" sx={{ width: '100%' }} />
|
||||
})
|
||||
VmTemplateTabs.propTypes = { id: PropTypes.string.isRequired }
|
||||
VmTemplateTabs.displayName = 'VmTemplateTabs'
|
||||
|
Loading…
x
Reference in New Issue
Block a user