|
1 | 1 | import type {SelectOption} from '@gravity-ui/uikit'; |
2 | 2 | import {z} from 'zod'; |
3 | 3 |
|
4 | | -import type {GroupsGroupByField} from '../../../../types/api/storage'; |
| 4 | +import type {GroupsGroupByField, GroupsRequiredField} from '../../../../types/api/storage'; |
5 | 5 | import type {ValueOf} from '../../../../types/common'; |
6 | 6 |
|
7 | 7 | import i18n from './i18n'; |
@@ -31,7 +31,7 @@ export const STORAGE_GROUPS_COLUMNS_IDS = { |
31 | 31 | State: 'State', |
32 | 32 | } as const; |
33 | 33 |
|
34 | | -type StorageGroupsColumnId = ValueOf<typeof STORAGE_GROUPS_COLUMNS_IDS>; |
| 34 | +export type StorageGroupsColumnId = ValueOf<typeof STORAGE_GROUPS_COLUMNS_IDS>; |
35 | 35 |
|
36 | 36 | export const DEFAULT_STORAGE_GROUPS_COLUMNS: StorageGroupsColumnId[] = [ |
37 | 37 | 'GroupId', |
@@ -136,3 +136,29 @@ export const storageGroupsGroupByParamSchema = z |
136 | 136 | GroupsGroupByField | undefined |
137 | 137 | >((value) => STORAGE_GROUPS_GROUP_BY_PARAMS.includes(value)) |
138 | 138 | .catch(undefined); |
| 139 | + |
| 140 | +// Although columns ids mostly similar to backend fields, there might be some difference |
| 141 | +// Also for some columns we may use more than one field |
| 142 | +export const GROUPS_COLUMNS_TO_DATA_FIELDS: Record<StorageGroupsColumnId, GroupsRequiredField[]> = { |
| 143 | + GroupId: ['GroupId'], |
| 144 | + PoolName: ['PoolName'], |
| 145 | + // We display MediaType and Encryption in one Type column |
| 146 | + MediaType: ['MediaType', 'Encryption'], |
| 147 | + Encryption: ['Encryption'], |
| 148 | + Erasure: ['Erasure'], |
| 149 | + Used: ['Used'], |
| 150 | + Limit: ['Limit'], |
| 151 | + Usage: ['Usage'], |
| 152 | + DiskSpaceUsage: ['DiskSpaceUsage'], |
| 153 | + DiskSpace: ['State'], |
| 154 | + Read: ['Read'], |
| 155 | + Write: ['Write'], |
| 156 | + Latency: ['Latency'], |
| 157 | + AllocationUnits: ['AllocationUnits'], |
| 158 | + // Read and Write fields make backend to return Whiteboard data |
| 159 | + VDisks: ['VDisk', 'PDisk', 'Read', 'Write'], |
| 160 | + VDisksPDisks: ['VDisk', 'PDisk', 'Read', 'Write'], |
| 161 | + MissingDisks: ['MissingDisks'], |
| 162 | + Degraded: ['MissingDisks'], |
| 163 | + State: ['State'], |
| 164 | +}; |
0 commit comments