diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts index 605c917649..e1787e9575 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/clusterStorage.cy.ts @@ -386,7 +386,7 @@ describe('ClusterStorage', () => { clusterStorageRow.findKebabAction('Edit storage').click(); updateClusterStorageModal.findNameInput().should('have.value', 'Test Storage'); updateClusterStorageModal.findPVSizeInput().should('have.value', '5'); - updateClusterStorageModal.shouldHavePVSizeSelectValue('Gi'); + updateClusterStorageModal.shouldHavePVSizeSelectValue('GiB'); updateClusterStorageModal.findPersistentStorageWarning().should('exist'); updateClusterStorageModal.findSubmitButton().should('be.enabled'); updateClusterStorageModal.findNameInput().fill('test-updated'); diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/workbench.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/workbench.cy.ts index fef7f93dff..6ce5b34aa0 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/workbench.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/projects/workbench.cy.ts @@ -284,7 +284,7 @@ describe('Workbench page', () => { createSpawnerPage.findPVSizeInput().should('have.value', '19'); createSpawnerPage.findPVSizePlusButton().click(); createSpawnerPage.findPVSizeInput().should('have.value', '20'); - createSpawnerPage.selectPVSize('Mi'); + createSpawnerPage.selectPVSize('MiB'); //add existing cluster storage createSpawnerPage.findExistingStorageRadio().click(); diff --git a/frontend/src/pages/projects/components/StorageSizeBars.tsx b/frontend/src/pages/projects/components/StorageSizeBars.tsx index 3402111567..4a4e6dd199 100644 --- a/frontend/src/pages/projects/components/StorageSizeBars.tsx +++ b/frontend/src/pages/projects/components/StorageSizeBars.tsx @@ -33,7 +33,7 @@ const StorageSizeBar: React.FC = ({ pvc }) => { ); } - const inUseValue = `${bytesAsRoundedGiB(inUseInBytes)}Gi`; + const inUseValue = `${bytesAsRoundedGiB(inUseInBytes)}GiB`; const percentage = ((parseFloat(inUseValue) / parseFloat(maxValue)) * 100).toFixed(2); const percentageLabel = error ? '' : `Storage is ${percentage}% full`; diff --git a/frontend/src/pages/projects/screens/detail/notebooks/NotebookSizeDetails.tsx b/frontend/src/pages/projects/screens/detail/notebooks/NotebookSizeDetails.tsx index 8321cf87bc..64428ae104 100644 --- a/frontend/src/pages/projects/screens/detail/notebooks/NotebookSizeDetails.tsx +++ b/frontend/src/pages/projects/screens/detail/notebooks/NotebookSizeDetails.tsx @@ -16,18 +16,28 @@ const NotebookSizeDetails: React.FC = ({ notebookSize resources: { requests, limits }, } = notebookSize; + const formatMemory = (memory: string | undefined): string => { + if (!memory) { + return 'Unknown'; + } + if (/(Gi|Mi)$/.test(memory)) { + return `${memory}B`; + } + return memory; + }; + return ( Limits - {limits?.cpu ?? 'Unknown'} CPU, {limits?.memory ?? 'Unknown'} Memory + {limits?.cpu ?? 'Unknown'} CPU, {formatMemory(limits?.memory)} Memory Requests - {requests?.cpu ?? 'Unknown'} CPU, {requests?.memory ?? 'Unknown'} Memory + {requests?.cpu ?? 'Unknown'} CPU, {formatMemory(requests?.memory)} Memory diff --git a/frontend/src/pages/projects/utils.ts b/frontend/src/pages/projects/utils.ts index a045afdd67..d674cab1dd 100644 --- a/frontend/src/pages/projects/utils.ts +++ b/frontend/src/pages/projects/utils.ts @@ -5,8 +5,10 @@ import { NotebookState } from './notebook/types'; export const getNotebookStatusPriority = (notebookState: NotebookState): number => notebookState.isRunning ? 1 : notebookState.isStarting ? 2 : 3; -export const getPvcTotalSize = (pvc: PersistentVolumeClaimKind): string => - pvc.status?.capacity?.storage || pvc.spec.resources.requests.storage; +export const getPvcTotalSize = (pvc: PersistentVolumeClaimKind): string => { + const storage = pvc.status?.capacity?.storage || pvc.spec.resources.requests.storage; + return /(Gi|Mi)$/.test(storage) ? `${storage}B` : storage; +}; export const getCustomNotebookSize = ( existingNotebook: NotebookKind | undefined, diff --git a/frontend/src/utilities/valueUnits.ts b/frontend/src/utilities/valueUnits.ts index 32c88ebbf1..c9620fed2b 100644 --- a/frontend/src/utilities/valueUnits.ts +++ b/frontend/src/utilities/valueUnits.ts @@ -22,8 +22,8 @@ export const CPU_UNITS: UnitOption[] = [ { name: 'Milicores', unit: 'm', weight: 1 }, ]; export const MEMORY_UNITS_FOR_SELECTION: UnitOption[] = [ - { name: 'Gi', unit: 'Gi', weight: 1024 }, - { name: 'Mi', unit: 'Mi', weight: 1 }, + { name: 'GiB', unit: 'Gi', weight: 1024 }, + { name: 'MiB', unit: 'Mi', weight: 1 }, ]; export const MEMORY_UNITS_FOR_PARSING: UnitOption[] = [ { name: 'EB', unit: 'E', weight: 1000 ** 6 },