diff --git a/src/fireedge/src/client/components/Tabs/Backup/index.js b/src/fireedge/src/client/components/Tabs/Backup/index.js index b7fa9a66f4..a5c90b34c1 100644 --- a/src/fireedge/src/client/components/Tabs/Backup/index.js +++ b/src/fireedge/src/client/components/Tabs/Backup/index.js @@ -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 - } - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) BackupTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Cluster/index.js b/src/fireedge/src/client/components/Tabs/Cluster/index.js index 9920d6d2f8..c8af8ae8c7 100644 --- a/src/fireedge/src/client/components/Tabs/Cluster/index.js +++ b/src/fireedge/src/client/components/Tabs/Cluster/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) ClusterTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Datastore/index.js b/src/fireedge/src/client/components/Tabs/Datastore/index.js index 1dc105524d..5beb21a23d 100644 --- a/src/fireedge/src/client/components/Tabs/Datastore/index.js +++ b/src/fireedge/src/client/components/Tabs/Datastore/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) DatastoreTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Group/index.js b/src/fireedge/src/client/components/Tabs/Group/index.js index 2f6ba4f569..0c56b89df9 100644 --- a/src/fireedge/src/client/components/Tabs/Group/index.js +++ b/src/fireedge/src/client/components/Tabs/Group/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) GroupTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Host/index.js b/src/fireedge/src/client/components/Tabs/Host/index.js index 291b609ad2..89bd9fd9e4 100644 --- a/src/fireedge/src/client/components/Tabs/Host/index.js +++ b/src/fireedge/src/client/components/Tabs/Host/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) HostTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Image/index.js b/src/fireedge/src/client/components/Tabs/Image/index.js index fd20cdfbfc..9c9662b954 100644 --- a/src/fireedge/src/client/components/Tabs/Image/index.js +++ b/src/fireedge/src/client/components/Tabs/Image/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) ImageTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Marketplace/index.js b/src/fireedge/src/client/components/Tabs/Marketplace/index.js index e2c2bb4852..ad1be84d43 100644 --- a/src/fireedge/src/client/components/Tabs/Marketplace/index.js +++ b/src/fireedge/src/client/components/Tabs/Marketplace/index.js @@ -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 - } - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) MarketplaceTabs.propTypes = { id: PropTypes.string.isRequired } MarketplaceTabs.displayName = 'MarketplaceTabs' diff --git a/src/fireedge/src/client/components/Tabs/MarketplaceApp/index.js b/src/fireedge/src/client/components/Tabs/MarketplaceApp/index.js index f4424a1dea..7a6264d270 100644 --- a/src/fireedge/src/client/components/Tabs/MarketplaceApp/index.js +++ b/src/fireedge/src/client/components/Tabs/MarketplaceApp/index.js @@ -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 - } - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) MarketplaceAppTabs.propTypes = { id: PropTypes.string.isRequired } MarketplaceAppTabs.displayName = 'MarketplaceAppTabs' diff --git a/src/fireedge/src/client/components/Tabs/SecurityGroup/index.js b/src/fireedge/src/client/components/Tabs/SecurityGroup/index.js index ec4df71684..5d8f9402b0 100644 --- a/src/fireedge/src/client/components/Tabs/SecurityGroup/index.js +++ b/src/fireedge/src/client/components/Tabs/SecurityGroup/index.js @@ -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 - } - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) SecurityGroupTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Service/index.js b/src/fireedge/src/client/components/Tabs/Service/index.js index 270ef9a6fb..8caa82d83f 100644 --- a/src/fireedge/src/client/components/Tabs/Service/index.js +++ b/src/fireedge/src/client/components/Tabs/Service/index.js @@ -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 - } - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) ServiceTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/ServiceTemplate/index.js b/src/fireedge/src/client/components/Tabs/ServiceTemplate/index.js index 1eaf445fc5..aad0c019ae 100644 --- a/src/fireedge/src/client/components/Tabs/ServiceTemplate/index.js +++ b/src/fireedge/src/client/components/Tabs/ServiceTemplate/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) ServiceTemplateTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/User/index.js b/src/fireedge/src/client/components/Tabs/User/index.js index e99ad943f8..bc2a2b84ce 100644 --- a/src/fireedge/src/client/components/Tabs/User/index.js +++ b/src/fireedge/src/client/components/Tabs/User/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) UserTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/VNetwork/index.js b/src/fireedge/src/client/components/Tabs/VNetwork/index.js index 657d3e62fe..35297dbe34 100644 --- a/src/fireedge/src/client/components/Tabs/VNetwork/index.js +++ b/src/fireedge/src/client/components/Tabs/VNetwork/index.js @@ -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 - } - - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) VNetworkTabs.propTypes = { id: PropTypes.string.isRequired } VNetworkTabs.displayName = 'VNetworkTabs' diff --git a/src/fireedge/src/client/components/Tabs/VNetworkTemplate/index.js b/src/fireedge/src/client/components/Tabs/VNetworkTemplate/index.js index 5e1513b95b..e7dc67ddf8 100644 --- a/src/fireedge/src/client/components/Tabs/VNetworkTemplate/index.js +++ b/src/fireedge/src/client/components/Tabs/VNetworkTemplate/index.js @@ -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 - } - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) VNetTemplateTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/Vm/index.js b/src/fireedge/src/client/components/Tabs/Vm/index.js index e2fc421ce7..19c279d2a5 100644 --- a/src/fireedge/src/client/components/Tabs/Vm/index.js +++ b/src/fireedge/src/client/components/Tabs/Vm/index.js @@ -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 - } - if (status === 'fulfilled') { + if (status === 'fulfilled' || id === ID) { return ( <> @@ -132,7 +128,7 @@ const VmTabs = memo(({ id }) => { ) } - return <> + return }) VmTabs.propTypes = { id: PropTypes.string.isRequired } diff --git a/src/fireedge/src/client/components/Tabs/VmTemplate/index.js b/src/fireedge/src/client/components/Tabs/VmTemplate/index.js index 50f18d821d..f53ca56f8e 100644 --- a/src/fireedge/src/client/components/Tabs/VmTemplate/index.js +++ b/src/fireedge/src/client/components/Tabs/VmTemplate/index.js @@ -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 }) => { ) } - if (isLoading || status === 'pending') { - return - } - if (status === 'fulfilled') { + + if (status === 'fulfilled' || id === data?.ID) { return } - return <> + return }) VmTemplateTabs.propTypes = { id: PropTypes.string.isRequired } VmTemplateTabs.displayName = 'VmTemplateTabs'