Skip to content

Commit

Permalink
Display the storage class metadata name in the end user UI (#3473)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanshug authored Nov 15, 2024
1 parent 142e63f commit 13449c5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
12 changes: 12 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/clusterStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ class ClusterStorageRow extends TableRow {
this.find().siblings().find('[data-label=Size]').contains(name).should('exist');
return this;
}

showStorageClassDetails() {
return this.findStorageClassColumn().findByTestId('resource-name-icon-button').click();
}

findStorageClassResourceNameText() {
return cy.findByTestId('resource-name-text');
}

findStorageClassResourceKindText() {
return cy.findByTestId('resource-kind-text');
}
}

class ClusterStorageModal extends Modal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ describe('ClusterStorage', () => {
clusterStorage.visit('test-project');
const clusterStorageRow = clusterStorage.getClusterStorageRow('Test Storage');
clusterStorageRow.findStorageClassColumn().should('exist');
clusterStorageRow.showStorageClassDetails();
clusterStorageRow
.findStorageClassResourceNameText()
.should('have.text', 'openshift-default-sc');
clusterStorageRow.findStorageClassResourceKindText().should('have.text', 'StorageClass');
});

it('Check whether the Storage class is deprecated', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
Text,
TextVariants,
Tooltip,
Truncate,
} from '@patternfly/react-core';
import { ExclamationTriangleIcon, HddIcon } from '@patternfly/react-icons';
import { PersistentVolumeClaimKind } from '~/k8sTypes';
Expand Down Expand Up @@ -108,13 +107,14 @@ const StorageTableRow: React.FC<StorageTableRowProps> = ({
alignItems={{ default: 'alignItemsCenter' }}
>
<FlexItem>
<Truncate
content={
<TableRowTitleDescription
title={
storageClassConfig?.displayName ??
obj.storageClass?.metadata.name ??
obj.pvc.spec.storageClassName ??
''
}
resource={obj.storageClass}
/>
</FlexItem>
{storageClassesLoaded && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ const StorageClassSelect: React.FC<StorageClassSelectProps> = ({
return {
key: sc.metadata.name,
label: config?.displayName || sc.metadata.name,
description: config?.description,
description: (
<>
Resource name: {sc.metadata.name}
<br />
{config?.description && `Description: ${config.description}`}
</>
),
isDisabled: !config?.isEnabled,
dropdownLabel: (
<Split>
Expand Down Expand Up @@ -96,6 +102,7 @@ const StorageClassSelect: React.FC<StorageClassSelectProps> = ({
isDisabled={disableStorageClassSelect || !storageClassesLoaded}
placeholder="Select storage class"
popperProps={{ appendTo: menuAppendTo }}
previewDescription={false}
/>
<FormHelperText>
{selectedStorageClassConfig && !selectedStorageClassConfig.isEnabled ? (
Expand Down

0 comments on commit 13449c5

Please sign in to comment.