Skip to content

feat(Storage): add State column #1859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2025
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
9 changes: 9 additions & 0 deletions src/containers/Storage/StorageGroups/columns/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ const degradedColumn: StorageGroupsColumn = {
align: DataTable.LEFT,
defaultOrder: DataTable.DESCENDING,
};
const stateColumn: StorageGroupsColumn = {
name: STORAGE_GROUPS_COLUMNS_IDS.State,
header: STORAGE_GROUPS_COLUMNS_TITLES.State,
width: 150,
render: ({row}) => row.State ?? EMPTY_DATA_PLACEHOLDER,
align: DataTable.LEFT,
defaultOrder: DataTable.DESCENDING,
};

const usageColumn: StorageGroupsColumn = {
name: STORAGE_GROUPS_COLUMNS_IDS.Usage,
Expand Down Expand Up @@ -273,6 +281,7 @@ export const getStorageGroupsColumns: StorageColumnsGetter = (data) => {
typeColumn,
erasureColumn,
degradedColumn,
stateColumn,
usageColumn,
diskSpaceUsageColumn,
usedColumn,
Expand Down
6 changes: 6 additions & 0 deletions src/containers/Storage/StorageGroups/columns/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const STORAGE_GROUPS_COLUMNS_IDS = {
VDisks: 'VDisks',
VDisksPDisks: 'VDisksPDisks',
Degraded: 'Degraded',
State: 'State',
} as const;

export type StorageGroupsColumnId = ValueOf<typeof STORAGE_GROUPS_COLUMNS_IDS>;
Expand Down Expand Up @@ -95,6 +96,9 @@ export const STORAGE_GROUPS_COLUMNS_TITLES = {
get Degraded() {
return i18n('missing-disks');
},
get State() {
return i18n('state');
},
} as const satisfies Record<StorageGroupsColumnId, string>;

const STORAGE_GROUPS_COLUMNS_GROUP_BY_TITLES = {
Expand Down Expand Up @@ -181,6 +185,7 @@ export const GROUPS_COLUMNS_TO_DATA_FIELDS: Record<StorageGroupsColumnId, Groups
VDisks: ['VDisk', 'PDisk', 'Read', 'Write'],
VDisksPDisks: ['VDisk', 'PDisk', 'Read', 'Write'],
Degraded: ['MissingDisks'],
State: ['State'],
};

const STORAGE_GROUPS_COLUMNS_TO_SORT_FIELDS: Record<
Expand All @@ -203,6 +208,7 @@ const STORAGE_GROUPS_COLUMNS_TO_SORT_FIELDS: Record<
VDisks: undefined,
VDisksPDisks: undefined,
Degraded: 'Degraded',
State: 'State',
};

export function getStorageGroupsColumnSortField(columnId?: string) {
Expand Down
18 changes: 11 additions & 7 deletions src/types/api/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ export interface TGroupsStorageGroupInfo {
ErasureSpecies?: string;
/** uint64 */
AllocationUnits?: string;
/**
* Could be one of:
* ok - group is okay
* starting:n - group is okay, but n disks are starting
* replicating:n - group is okay, all disks are available, but n disks are replicating
* degraded:n(m, m...) - group is okay, but n fail realms are not available (with m fail domains)
* dead:n - group is not okay, n fail realms are not available
*/
State?: string;
/** uint64 */
MissingDisks?: string;
Expand Down Expand Up @@ -245,17 +253,13 @@ export type StorageV2SortValue =
// Added them here for types compatibility
| 'AllocationUnits'
| 'Latency'
| 'DiskSpaceUsage';
| 'DiskSpaceUsage'
| 'State';

/**
* Values to sort /storage/groups response
*/
export type GroupsSortField =
| StorageV2SortValue
| 'MissingDisks'
| 'State'
| 'Available'
| 'Encryption';
export type GroupsSortField = StorageV2SortValue | 'MissingDisks' | 'Available' | 'Encryption';

export type StorageV2Sort = BackendSortParam<StorageV2SortValue>;
export type GroupsSort = BackendSortParam<GroupsSortField>;
Expand Down
Loading