From b8e488efa4066487cca0ee6caf8fcff93e22c18e Mon Sep 17 00:00:00 2001 From: Yaacov Zamir Date: Wed, 14 Feb 2024 09:51:01 +0200 Subject: [PATCH] Refactor plan details suspend Signed-off-by: Yaacov Zamir --- .../Plans/views/details/PlanDetailsPage.tsx | 17 ++++++++++------- .../views/details/tabs/Details/PlanDetails.tsx | 9 +++------ .../views/details/tabs/Hooks/PlanHooks.tsx | 6 ++---- .../details/tabs/Mappings/PlanMappings.tsx | 6 ++---- .../VirtualMachines/PlanVirtualMachines.tsx | 6 ++---- .../Plans/views/details/tabs/YAML/PlanYAML.tsx | 16 +--------------- 6 files changed, 20 insertions(+), 40 deletions(-) diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx index 259e76fe3..547d70995 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/PlanDetailsPage.tsx @@ -9,6 +9,7 @@ import { useK8sWatchResource, } from '@openshift-console/dynamic-plugin-sdk'; +import { Suspend } from './components'; import { PlanDetails, PlanHooks, PlanMappings, PlanVirtualMachines, PlanYAML } from './tabs'; import './PlanDetailsPage.style.css'; @@ -94,13 +95,15 @@ export const PlanDetailsPage: React.FC = ({ name, namespac }); return ( - + + + ); }; PlanDetailsPage.displayName = 'PlanDetailsPage'; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Details/PlanDetails.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Details/PlanDetails.tsx index 53bed3fba..fa0821f71 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Details/PlanDetails.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Details/PlanDetails.tsx @@ -3,17 +3,14 @@ import { useForkliftTranslation } from 'src/utils/i18n'; import { PageSection, Title } from '@patternfly/react-core'; -import { Suspend } from '../../components'; import { PlanDetailsTabProps } from '../../PlanDetailsPage'; export const PlanDetails: React.FC = ({ plan, loaded, loadError }) => { const { t } = useForkliftTranslation(); return ( - - - {t('Details')} - - + + {t('Details')} + ); }; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx index 00ba1dc10..41f6e68f0 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Hooks/PlanHooks.tsx @@ -5,18 +5,16 @@ import { HookModelGroupVersionKind } from '@kubev2v/types'; import { ResourceLink } from '@openshift-console/dynamic-plugin-sdk'; import { PageSection, Title } from '@patternfly/react-core'; -import { Suspend } from '../../components'; import { PlanDetailsTabProps } from '../../PlanDetailsPage'; export const PlanHooks: React.FC = ({ plan, loaded, loadError }) => { const { t } = useForkliftTranslation(); return ( - + <> {t('Hooks')} - {plan?.spec?.vms?.[0]?.hooks?.[0]?.hook && ( = ({ plan, loaded, loadErr /> )} - + ); }; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Mappings/PlanMappings.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Mappings/PlanMappings.tsx index c9f92806d..0f0135b79 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Mappings/PlanMappings.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/Mappings/PlanMappings.tsx @@ -5,18 +5,16 @@ import { NetworkMapModelGroupVersionKind, StorageMapModelGroupVersionKind } from import { ResourceLink } from '@openshift-console/dynamic-plugin-sdk'; import { PageSection, Title } from '@patternfly/react-core'; -import { Suspend } from '../../components'; import { PlanDetailsTabProps } from '../../PlanDetailsPage'; export const PlanMappings: React.FC = ({ plan, loaded, loadError }) => { const { t } = useForkliftTranslation(); return ( - + <> {t('Mappings')} - = ({ plan, loaded, load namespace={plan.spec.map.storage.namespace} /> - + ); }; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx index 8119e9b0a..539c0aa2b 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx @@ -3,18 +3,16 @@ import { useForkliftTranslation } from 'src/utils/i18n'; import { PageSection, Title } from '@patternfly/react-core'; -import { Suspend } from '../../components'; import { PlanDetailsTabProps } from '../../PlanDetailsPage'; export const PlanVirtualMachines: React.FC = ({ plan, loaded, loadError }) => { const { t } = useForkliftTranslation(); return ( - + <> {t('Virtual machines')} -
    {plan.spec.vms.map((vm) => ( @@ -22,6 +20,6 @@ export const PlanVirtualMachines: React.FC = ({ plan, loade ))}
-
+ ); }; diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/YAML/PlanYAML.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/YAML/PlanYAML.tsx index 601f4704d..dfdb9f65c 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/YAML/PlanYAML.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/YAML/PlanYAML.tsx @@ -2,25 +2,11 @@ import React from 'react'; import { useForkliftTranslation } from 'src/utils/i18n'; import { ResourceYAMLEditor } from '@openshift-console/dynamic-plugin-sdk'; -import { Bullseye } from '@patternfly/react-core'; -import { Loading } from '../../components'; import { PlanDetailsTabProps } from '../../PlanDetailsPage'; export const PlanYAML: React.FC = ({ plan, loaded, loadError }) => { const { t } = useForkliftTranslation(); - return ( - - - - } - > - {plan && loaded && !loadError && ( - - )} - - ); + return ; };