Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@
"When the nodes in the selected StorageClass are spread across fewer than 3 availability zones, the StorageCluster will be deployed with the host based failure domain.": "When the nodes in the selected StorageClass are spread across fewer than 3 availability zones, the StorageCluster will be deployed with the host based failure domain.",
"Cluster-Wide and StorageClass": "Cluster-Wide and StorageClass",
"Cluster-Wide": "Cluster-Wide",
"and": "and",
"Select at least 2 Backing Store resources": "Select at least 2 Backing Store resources",
"Select at least 1 Backing Store resource": "Select at least 1 Backing Store resource",
"x {{replica}} replicas = {{osdSize, number}} TiB": "x {{replica}} replicas = {{osdSize, number}} TiB",
Expand Down
20 changes: 13 additions & 7 deletions frontend/packages/ceph-storage-plugin/src/utils/common.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TFunction } from 'i18next';
import * as React from 'react';

import { getLastLanguage } from '@console/app/src/components/user-preferences/language/getLastLanguage';
Expand All @@ -12,12 +11,19 @@ export const checkArbiterCluster = (storageCluster: StorageClusterKind): boolean
export const checkFlexibleScaling = (storageCluster: StorageClusterKind): boolean =>
storageCluster?.spec?.flexibleScaling;

export const commaSeparatedString = (text: string[], t: TFunction): string =>
[text.slice(0, -1).join(', '), text.slice(-1)[0]].join(
text.length < 2 ? '' : ` ${t('ceph-storage-plugin~and')} `,
);

export const toList = (text: string[]): React.ReactNode => text.map((s) => <li key={s}>{s}</li>);
export const toList = (text: string[]): React.ReactNode => (
<div
style={{
overflowY: text.length > 3 ? 'scroll' : 'visible',
maxHeight: '5rem',
overflowX: 'hidden',
}}
>
{text.map((s) => (
<li key={s}>{s}</li>
))}
</div>
);

export const calcPercentage = (value: number, total: number) =>
humanizePercentage((value * 100) / total).string;
Expand Down