From a4bb2170a4a14823c642030ff732e377fa985eef Mon Sep 17 00:00:00 2001 From: Gowtham Shanmugasundaram Date: Mon, 21 Oct 2024 11:41:01 +0530 Subject: [PATCH] Enhance the DRPolicy creation page to select client clusters for RDR Signed-off-by: Gowtham Shanmugasundaram --- locales/en/plugin__odf-console.json | 7 +++---- .../create-dr-policy/select-cluster-list.tsx | 10 +++++----- .../create-dr-policy/selected-cluster-validator.tsx | 6 +++--- packages/shared/src/table/selectable-table.tsx | 10 +++++----- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/locales/en/plugin__odf-console.json b/locales/en/plugin__odf-console.json index 25195dde4..287a07cb5 100644 --- a/locales/en/plugin__odf-console.json +++ b/locales/en/plugin__odf-console.json @@ -50,7 +50,6 @@ "Online": "Online", "Offline": "Offline", "Not Installed": "Not Installed", - "1 connected": "1 connected", "Unavailable": "Unavailable", "Replication interval": "Replication interval", "Replication policy": "Replication policy", @@ -66,11 +65,11 @@ "checks unsuccessful on the {{clusterName}}:": "checks unsuccessful on the {{clusterName}}:", "We could not retrieve any information about the managed cluster {{clusterName}}": "We could not retrieve any information about the managed cluster {{clusterName}}", "Running checks to ensure that the selected managed cluster meets all necessary conditions so it can enroll in a Disaster Recovery policy.": "Running checks to ensure that the selected managed cluster meets all necessary conditions so it can enroll in a Disaster Recovery policy.", - "All disaster recovery prerequisites met for both cluster.": "All disaster recovery prerequisites met for both cluster.", + "All disaster recovery prerequisites met for both clusters.": "All disaster recovery prerequisites met for both clusters.", "Version mismatch across selected clusters": "Version mismatch across selected clusters", "The selected clusters are running different versions of Data Foundation. Peering clusters with different versions can lead to potential issues and is not recommended. Ensure all clusters are upgraded to the same version before proceeding with peering to avoid operational risks.": "The selected clusters are running different versions of Data Foundation. Peering clusters with different versions can lead to potential issues and is not recommended. Ensure all clusters are upgraded to the same version before proceeding with peering to avoid operational risks.", - "1 or more cluster do not meet disaster recovery cluster prerequisites.": "1 or more cluster do not meet disaster recovery cluster prerequisites.", - "The selected managed cluster does not meet all necessary conditions to be eligible for disaster recovery policy. Resolve the following issues to proceed with policy creation.": "The selected managed cluster does not meet all necessary conditions to be eligible for disaster recovery policy. Resolve the following issues to proceed with policy creation.", + "1 or more clusters do not meet disaster recovery cluster prerequisites.": "1 or more clusters do not meet disaster recovery cluster prerequisites.", + "The selected managed cluster(s) does not meet all necessary conditions to be eligible for disaster recovery policy. Resolve the following issues to proceed with policy creation.": "The selected managed cluster(s) does not meet all necessary conditions to be eligible for disaster recovery policy. Resolve the following issues to proceed with policy creation.", "Information unavailable": "Information unavailable", "Managed Cluster": "Managed Cluster", "Availability status": "Availability status", diff --git a/packages/mco/components/create-dr-policy/select-cluster-list.tsx b/packages/mco/components/create-dr-policy/select-cluster-list.tsx index e57f775bb..3b8168b89 100644 --- a/packages/mco/components/create-dr-policy/select-cluster-list.tsx +++ b/packages/mco/components/create-dr-policy/select-cluster-list.tsx @@ -4,7 +4,7 @@ import { getName } from '@odf/shared/selectors'; import { RowComponentType } from '@odf/shared/table'; import { SelectableTable, - TABLE_VARINAT, + TABLE_VARIANT, } from '@odf/shared/table/selectable-table'; import { useCustomTranslation } from '@odf/shared/useCustomTranslationHook'; import { getPageRange, referenceForModel } from '@odf/shared/utils'; @@ -51,7 +51,7 @@ const ClusterRow: React.FC> = ({ }) => { const { t } = useCustomTranslation(); const { odfInfo, region, isManagedClusterAvailable } = cluster; - const isClientExists = !!odfInfo?.storageClusterInfo?.clientInfo; + const clientName = !!odfInfo?.storageClusterInfo?.clientInfo?.name; const odfVersion = odfInfo?.odfVersion; return ( <> @@ -91,8 +91,8 @@ const ClusterRow: React.FC> = ({ translate={null} dataLabel={getColumnHelper(COLUMN_NAMES.StorageClients, t).columnName} > - - {isClientExists ? t('1 connected') : t('Unavailable')} + + {clientName ? clientName : t('Unavailable')} = ({ setSelectedRows={onChange} loaded={isLoaded} loadError={error} - variant={TABLE_VARINAT.DEFAULT} + variant={TABLE_VARIANT.DEFAULT} isColumnSelectableHidden isRowSelectable={(cluster) => isRowSelectable(cluster, selectedClusters) diff --git a/packages/mco/components/create-dr-policy/selected-cluster-validator.tsx b/packages/mco/components/create-dr-policy/selected-cluster-validator.tsx index 579ea2178..c219fc07b 100644 --- a/packages/mco/components/create-dr-policy/selected-cluster-validator.tsx +++ b/packages/mco/components/create-dr-policy/selected-cluster-validator.tsx @@ -280,7 +280,7 @@ export const SelectedClusterValidation: React.FC data-test="odf-not-found-alert" className="odf-alert mco-create-data-policy__alert" title={t( - 'All disaster recovery prerequisites met for both cluster.' + 'All disaster recovery prerequisites met for both clusters.' )} variant={AlertVariant.success} isInline @@ -311,13 +311,13 @@ export const SelectedClusterValidation: React.FC data-test="odf-not-found-alert" className="odf-alert mco-create-data-policy__alert" title={t( - '1 or more cluster do not meet disaster recovery cluster prerequisites.' + '1 or more clusters do not meet disaster recovery cluster prerequisites.' )} variant={AlertVariant.danger} isInline > {t( - 'The selected managed cluster does not meet all necessary conditions ' + + 'The selected managed cluster(s) does not meet all necessary conditions ' + 'to be eligible for disaster recovery policy. Resolve the following ' + 'issues to proceed with policy creation.' )} diff --git a/packages/shared/src/table/selectable-table.tsx b/packages/shared/src/table/selectable-table.tsx index 039ee681f..bad812635 100644 --- a/packages/shared/src/table/selectable-table.tsx +++ b/packages/shared/src/table/selectable-table.tsx @@ -15,7 +15,7 @@ import { useSortList } from '../hooks/sort-list'; import { getUID } from '../selectors'; import { TableColumnProps, RowComponentType } from './composable-table'; -export enum TABLE_VARINAT { +export enum TABLE_VARIANT { DEFAULT = 'default', COMPACT = 'compact', } @@ -116,7 +116,7 @@ export const SelectableTable: SelectableTableProps = < aria-label="Selectable table" borders={borders} variant={ - variant !== TABLE_VARINAT.DEFAULT ? TABLE_VARINAT.COMPACT : undefined + variant !== TABLE_VARIANT.DEFAULT ? TABLE_VARIANT.COMPACT : undefined } > @@ -157,8 +157,8 @@ export const SelectableTable: SelectableTableProps = < onSelect: onSelect, isSelected: isRowSelected(getUID(row), selectedRows), isDisabled: - (!!isRowSelectable && !isRowSelectable(row)) || - !hasNoDeletionTimestamp(row), + (!!isRowSelectable && !isRowSelectable(row)) || + !hasNoDeletionTimestamp(row), props: { id: getUID(row), }, @@ -192,7 +192,7 @@ type TableProps = { /** Additional classes added to the Table */ className?: string; isRowSelectable?: IsRowSelectable; - variant?: TABLE_VARINAT; + variant?: TABLE_VARIANT; }; type SelectableTableProps = (