Skip to content

Commit cda185b

Browse files
feat(Storage): add State column (#1859)
1 parent 95a48cb commit cda185b

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

src/containers/Storage/StorageGroups/columns/columns.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ const degradedColumn: StorageGroupsColumn = {
100100
align: DataTable.LEFT,
101101
defaultOrder: DataTable.DESCENDING,
102102
};
103+
const stateColumn: StorageGroupsColumn = {
104+
name: STORAGE_GROUPS_COLUMNS_IDS.State,
105+
header: STORAGE_GROUPS_COLUMNS_TITLES.State,
106+
width: 150,
107+
render: ({row}) => row.State ?? EMPTY_DATA_PLACEHOLDER,
108+
align: DataTable.LEFT,
109+
defaultOrder: DataTable.DESCENDING,
110+
};
103111

104112
const usageColumn: StorageGroupsColumn = {
105113
name: STORAGE_GROUPS_COLUMNS_IDS.Usage,
@@ -273,6 +281,7 @@ export const getStorageGroupsColumns: StorageColumnsGetter = (data) => {
273281
typeColumn,
274282
erasureColumn,
275283
degradedColumn,
284+
stateColumn,
276285
usageColumn,
277286
diskSpaceUsageColumn,
278287
usedColumn,

src/containers/Storage/StorageGroups/columns/constants.ts

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const STORAGE_GROUPS_COLUMNS_IDS = {
3030
VDisks: 'VDisks',
3131
VDisksPDisks: 'VDisksPDisks',
3232
Degraded: 'Degraded',
33+
State: 'State',
3334
} as const;
3435

3536
export type StorageGroupsColumnId = ValueOf<typeof STORAGE_GROUPS_COLUMNS_IDS>;
@@ -95,6 +96,9 @@ export const STORAGE_GROUPS_COLUMNS_TITLES = {
9596
get Degraded() {
9697
return i18n('missing-disks');
9798
},
99+
get State() {
100+
return i18n('state');
101+
},
98102
} as const satisfies Record<StorageGroupsColumnId, string>;
99103

100104
const STORAGE_GROUPS_COLUMNS_GROUP_BY_TITLES = {
@@ -181,6 +185,7 @@ export const GROUPS_COLUMNS_TO_DATA_FIELDS: Record<StorageGroupsColumnId, Groups
181185
VDisks: ['VDisk', 'PDisk', 'Read', 'Write'],
182186
VDisksPDisks: ['VDisk', 'PDisk', 'Read', 'Write'],
183187
Degraded: ['MissingDisks'],
188+
State: ['State'],
184189
};
185190

186191
const STORAGE_GROUPS_COLUMNS_TO_SORT_FIELDS: Record<
@@ -203,6 +208,7 @@ const STORAGE_GROUPS_COLUMNS_TO_SORT_FIELDS: Record<
203208
VDisks: undefined,
204209
VDisksPDisks: undefined,
205210
Degraded: 'Degraded',
211+
State: 'State',
206212
};
207213

208214
export function getStorageGroupsColumnSortField(columnId?: string) {

src/types/api/storage.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ export interface TGroupsStorageGroupInfo {
140140
ErasureSpecies?: string;
141141
/** uint64 */
142142
AllocationUnits?: string;
143+
/**
144+
* Could be one of:
145+
* ok - group is okay
146+
* starting:n - group is okay, but n disks are starting
147+
* replicating:n - group is okay, all disks are available, but n disks are replicating
148+
* degraded:n(m, m...) - group is okay, but n fail realms are not available (with m fail domains)
149+
* dead:n - group is not okay, n fail realms are not available
150+
*/
143151
State?: string;
144152
/** uint64 */
145153
MissingDisks?: string;
@@ -245,17 +253,13 @@ export type StorageV2SortValue =
245253
// Added them here for types compatibility
246254
| 'AllocationUnits'
247255
| 'Latency'
248-
| 'DiskSpaceUsage';
256+
| 'DiskSpaceUsage'
257+
| 'State';
249258

250259
/**
251260
* Values to sort /storage/groups response
252261
*/
253-
export type GroupsSortField =
254-
| StorageV2SortValue
255-
| 'MissingDisks'
256-
| 'State'
257-
| 'Available'
258-
| 'Encryption';
262+
export type GroupsSortField = StorageV2SortValue | 'MissingDisks' | 'Available' | 'Encryption';
259263

260264
export type StorageV2Sort = BackendSortParam<StorageV2SortValue>;
261265
export type GroupsSort = BackendSortParam<GroupsSortField>;

0 commit comments

Comments
 (0)