Skip to content

Commit cdff5e9

Browse files
committed
feat(Storage): display media type for groups
1 parent b61eeb8 commit cdff5e9

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/containers/Storage/StorageGroups/StorageGroups.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import './StorageGroups.scss';
2525

2626
enum TableColumnsIds {
2727
PoolName = 'PoolName',
28+
Type = 'Type',
2829
GroupID = 'GroupID',
2930
Used = 'Used',
3031
Limit = 'Limit',
@@ -49,6 +50,7 @@ interface StorageGroupsProps {
4950

5051
const tableColumnsNames: Record<TableColumnsIdsValues, string> = {
5152
PoolName: 'Pool Name',
53+
Type: 'Type',
5254
GroupID: 'Group ID',
5355
Used: 'Used',
5456
Limit: 'Limit',
@@ -114,6 +116,11 @@ function StorageGroups({data, tableSettings, visibleEntities, nodes, onShowAll}:
114116
},
115117
align: DataTable.LEFT,
116118
},
119+
{
120+
name: TableColumnsIds.Type,
121+
header: tableColumnsNames[TableColumnsIds.Type],
122+
render: ({value}) => <Label>{value as string || '—'}</Label>,
123+
},
117124
{
118125
name: TableColumnsIds.Missing,
119126
header: tableColumnsNames[TableColumnsIds.Missing],

src/store/reducers/storage.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import _ from 'lodash';
44
import {createSelector} from 'reselect';
55
import {calcUptime} from '../../utils';
66
import {getUsage} from '../../utils/storage';
7+
import {getPDiskType} from '../../utils/pdisk';
78

89
export const VisibleEntities = {
910
All: 'All',
@@ -229,6 +230,10 @@ export const getFlatListStorageGroups = createSelector([getStoragePools], (stora
229230
},
230231
0,
231232
);
233+
const mediaType = group.VDisks?.reduce((type, vdisk) => {
234+
const currentType = getPDiskType(vdisk.PDisk || {});
235+
return currentType && (currentType === type || type === '') ? currentType : 'Mixed';
236+
}, '');
232237
return [
233238
...acc,
234239
{
@@ -240,6 +245,7 @@ export const getFlatListStorageGroups = createSelector([getStoragePools], (stora
240245
Limit: limitSizeBytes,
241246
Missing: missing,
242247
UsedSpaceFlag,
248+
Type: mediaType || null,
243249
},
244250
];
245251
},

src/types/store/storage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export interface IStoragePoolGroup extends TBSGroupStateInfo {
88
Limit: number;
99
Missing: number;
1010
UsedSpaceFlag: number;
11+
Type: string | null;
1112
}

0 commit comments

Comments
 (0)