ydb-embedded-ui 22.1.0 → 22.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/components/DiskStateProgressBar/AllModeIndicators.js +4 -1
  2. package/dist/components/DiskStateProgressBar/AllModeIndicators.js.map +1 -1
  3. package/dist/components/DiskStateProgressBar/DiskIndicator.js +5 -1
  4. package/dist/components/DiskStateProgressBar/DiskIndicator.js.map +1 -1
  5. package/dist/components/DiskStateProgressBar/DiskStateProgressBar.scss +50 -8
  6. package/dist/components/PDiskInfo/PDiskInfo.js +2 -1
  7. package/dist/components/PDiskInfo/PDiskInfo.js.map +1 -1
  8. package/dist/components/PDiskPopup/PDiskPopup.js +5 -1
  9. package/dist/components/PDiskPopup/PDiskPopup.js.map +1 -1
  10. package/dist/components/PaginatedTable/PaginatedTable.js +27 -15
  11. package/dist/components/PaginatedTable/PaginatedTable.js.map +1 -1
  12. package/dist/components/PaginatedTable/PaginatedTableContext.d.ts +2 -3
  13. package/dist/components/PaginatedTable/PaginatedTableContext.js +10 -11
  14. package/dist/components/PaginatedTable/PaginatedTableContext.js.map +1 -1
  15. package/dist/components/PaginatedTable/TableChunk.d.ts +1 -1
  16. package/dist/components/PaginatedTable/TableChunk.js +2 -1
  17. package/dist/components/PaginatedTable/TableChunk.js.map +1 -1
  18. package/dist/components/PaginatedTable/TableChunksRenderer.d.ts +1 -1
  19. package/dist/components/PaginatedTable/tableCounts.d.ts +19 -0
  20. package/dist/components/PaginatedTable/tableCounts.js +30 -0
  21. package/dist/components/PaginatedTable/tableCounts.js.map +1 -0
  22. package/dist/components/VDisk/VDisk.d.ts +2 -1
  23. package/dist/components/VDisk/VDisk.js +17 -7
  24. package/dist/components/VDisk/VDisk.js.map +1 -1
  25. package/dist/components/VDisk/VDiskWithDonorsStack.d.ts +3 -2
  26. package/dist/components/VDisk/VDiskWithDonorsStack.js +2 -1
  27. package/dist/components/VDisk/VDiskWithDonorsStack.js.map +1 -1
  28. package/dist/components/VDisk/i18n/en.json +3 -1
  29. package/dist/components/VDisk/i18n/index.d.ts +1 -1
  30. package/dist/containers/Storage/Disks/Disks.js +1 -3
  31. package/dist/containers/Storage/Disks/Disks.js.map +1 -1
  32. package/dist/containers/Storage/PDisk/PDisk.js +9 -2
  33. package/dist/containers/Storage/PDisk/PDisk.js.map +1 -1
  34. package/dist/containers/Storage/PDisk/i18n/en.json +1 -0
  35. package/dist/containers/Storage/PDisk/i18n/index.d.ts +1 -1
  36. package/dist/containers/Storage/StorageExpertModePanel/StorageGroupsExpertModePanel.js +2 -0
  37. package/dist/containers/Storage/StorageExpertModePanel/StorageGroupsExpertModePanel.js.map +1 -1
  38. package/dist/containers/Storage/StorageExpertModePanel/components/DriveTypeLegend.d.ts +1 -0
  39. package/dist/containers/Storage/StorageExpertModePanel/components/DriveTypeLegend.js +7 -0
  40. package/dist/containers/Storage/StorageExpertModePanel/components/DriveTypeLegend.js.map +1 -0
  41. package/dist/containers/Storage/StorageExpertModePanel/components/renderExpertModeLegend.js +5 -0
  42. package/dist/containers/Storage/StorageExpertModePanel/components/renderExpertModeLegend.js.map +1 -1
  43. package/dist/containers/Storage/StorageExpertModePanel/constants.d.ts +3 -0
  44. package/dist/containers/Storage/StorageExpertModePanel/constants.js +1 -0
  45. package/dist/containers/Storage/StorageExpertModePanel/constants.js.map +1 -1
  46. package/dist/containers/Storage/StorageExpertModePanel/i18n/en.json +4 -0
  47. package/dist/containers/Storage/StorageExpertModePanel/i18n/index.d.ts +1 -1
  48. package/dist/containers/Storage/useStoragePDiskDisplayStateGetter.js +7 -0
  49. package/dist/containers/Storage/useStoragePDiskDisplayStateGetter.js.map +1 -1
  50. package/dist/containers/Storage/useStorageQueryParams.d.ts +4 -4
  51. package/dist/containers/Storage/useStorageVDiskDisplayStateGetter.js +10 -1
  52. package/dist/containers/Storage/useStorageVDiskDisplayStateGetter.js.map +1 -1
  53. package/dist/containers/VDiskPage/VDiskPage.js +9 -1
  54. package/dist/containers/VDiskPage/VDiskPage.js.map +1 -1
  55. package/dist/store/reducers/table/table.js +6 -0
  56. package/dist/store/reducers/table/table.js.map +1 -1
  57. package/dist/store/reducers/topic/topic.js +7 -1
  58. package/dist/store/reducers/topic/topic.js.map +1 -1
  59. package/dist/uiFactory/types.d.ts +6 -0
  60. package/dist/utils/disks/displayState.d.ts +3 -2
  61. package/dist/utils/disks/displayState.js.map +1 -1
  62. package/dist/utils/disks/driveType.d.ts +3 -0
  63. package/dist/utils/disks/driveType.js +27 -0
  64. package/dist/utils/disks/driveType.js.map +1 -0
  65. package/dist/utils/disks/getDiskBarTone.d.ts +3 -2
  66. package/dist/utils/disks/getDiskBarTone.js +4 -1
  67. package/dist/utils/disks/getDiskBarTone.js.map +1 -1
  68. package/dist/utils/disks/getPDiskType.d.ts +1 -0
  69. package/dist/utils/disks/getPDiskType.js +3 -0
  70. package/dist/utils/disks/getPDiskType.js.map +1 -1
  71. package/dist/utils/disks/groupBy.d.ts +1 -0
  72. package/dist/utils/disks/groupBy.js +1 -0
  73. package/dist/utils/disks/groupBy.js.map +1 -1
  74. package/dist/utils/disks/iconCalculators.d.ts +1 -1
  75. package/dist/utils/disks/iconCalculators.js +2 -2
  76. package/dist/utils/disks/iconCalculators.js.map +1 -1
  77. package/dist/utils/disks/types.d.ts +1 -1
  78. package/dist/utils/objectCreationMetrics.d.ts +5 -0
  79. package/dist/utils/objectCreationMetrics.js +38 -0
  80. package/dist/utils/objectCreationMetrics.js.map +1 -0
  81. package/package.json +1 -1
  82. package/src/components/DiskStateProgressBar/AllModeIndicators.tsx +12 -1
  83. package/src/components/DiskStateProgressBar/DiskIndicator.tsx +9 -1
  84. package/src/components/DiskStateProgressBar/DiskStateProgressBar.scss +50 -8
  85. package/src/components/PDiskInfo/PDiskInfo.tsx +2 -1
  86. package/src/components/PDiskPopup/PDiskPopup.tsx +5 -1
  87. package/src/components/PaginatedTable/PaginatedTable.tsx +34 -24
  88. package/src/components/PaginatedTable/PaginatedTableContext.tsx +14 -19
  89. package/src/components/PaginatedTable/TableChunk.tsx +3 -2
  90. package/src/components/PaginatedTable/TableChunksRenderer.tsx +1 -1
  91. package/src/components/PaginatedTable/tableCounts.ts +50 -0
  92. package/src/components/VDisk/VDisk.tsx +28 -5
  93. package/src/components/VDisk/VDiskWithDonorsStack.tsx +5 -1
  94. package/src/components/VDisk/i18n/en.json +3 -1
  95. package/src/containers/Storage/Disks/Disks.tsx +2 -4
  96. package/src/containers/Storage/PDisk/PDisk.tsx +11 -2
  97. package/src/containers/Storage/PDisk/i18n/en.json +1 -0
  98. package/src/containers/Storage/StorageExpertModePanel/StorageGroupsExpertModePanel.tsx +2 -0
  99. package/src/containers/Storage/StorageExpertModePanel/components/DriveTypeLegend.tsx +22 -0
  100. package/src/containers/Storage/StorageExpertModePanel/components/renderExpertModeLegend.tsx +5 -0
  101. package/src/containers/Storage/StorageExpertModePanel/constants.ts +1 -0
  102. package/src/containers/Storage/StorageExpertModePanel/i18n/en.json +4 -0
  103. package/src/containers/Storage/useStoragePDiskDisplayStateGetter.ts +8 -0
  104. package/src/containers/Storage/useStorageVDiskDisplayStateGetter.ts +11 -1
  105. package/src/containers/VDiskPage/VDiskPage.tsx +9 -1
  106. package/src/store/reducers/table/table.ts +6 -0
  107. package/src/store/reducers/topic/topic.ts +7 -1
  108. package/src/uiFactory/types.ts +6 -0
  109. package/src/utils/disks/displayState.ts +3 -1
  110. package/src/utils/disks/driveType.ts +30 -0
  111. package/src/utils/disks/getDiskBarTone.ts +7 -1
  112. package/src/utils/disks/getPDiskType.ts +4 -0
  113. package/src/utils/disks/groupBy.ts +1 -0
  114. package/src/utils/disks/iconCalculators.ts +2 -2
  115. package/src/utils/disks/types.ts +1 -1
  116. package/src/utils/objectCreationMetrics.ts +47 -0
@@ -3,6 +3,7 @@ import {PDisksGroupBy, VDisksGroupBy} from '../constants';
3
3
 
4
4
  import {AllLegend} from './AllLegend';
5
5
  import {CompactionLegend} from './CompactionLegend';
6
+ import {DriveTypeLegend} from './DriveTypeLegend';
6
7
  import {FrontQueuesLegend} from './FrontQueuesLegend';
7
8
  import {PDiskDecommitLegend} from './PDiskDecommitLegend';
8
9
  import {PDiskDeviceLegend} from './PDiskDeviceLegend';
@@ -18,6 +19,8 @@ export function renderVDiskLegend(
18
19
  selectionScope: SpaceLegendSelectionScope,
19
20
  ) {
20
21
  switch (vdisksGroupBy) {
22
+ case VDisksGroupBy.DriveType:
23
+ return <DriveTypeLegend />;
21
24
  case VDisksGroupBy.State:
22
25
  return <StateLegend />;
23
26
  case VDisksGroupBy.Space:
@@ -38,6 +41,8 @@ export function renderPDiskLegend(
38
41
  selectionScope: SpaceLegendSelectionScope,
39
42
  ) {
40
43
  switch (pdisksGroupBy) {
44
+ case PDisksGroupBy.DriveType:
45
+ return <DriveTypeLegend />;
41
46
  case PDisksGroupBy.State:
42
47
  return <PDiskStateLegend />;
43
48
  case PDisksGroupBy.Space:
@@ -14,6 +14,7 @@ export const PDisksGroupBy = {
14
14
  Decommit: 'Decommit',
15
15
  Maintenance: 'Maintenance',
16
16
  Device: 'Device',
17
+ DriveType: 'DriveType',
17
18
  All: 'All',
18
19
  } as const;
19
20
 
@@ -1,4 +1,8 @@
1
1
  {
2
+ "value_drive-type": "Drive type",
3
+ "value_ssd": "SSD",
4
+ "value_hdd": "HDD",
5
+ "value_nvme": "NVMe",
2
6
  "label_vdisks": "VDisks:",
3
7
  "label_pdisks": "PDisks:",
4
8
  "value_state": "State",
@@ -12,6 +12,7 @@ import type {
12
12
  PDiskDisplayStateGetter,
13
13
  } from '../../utils/disks/displayState';
14
14
  import {getDefaultPDiskDisplayState} from '../../utils/disks/displayState';
15
+ import {getDriveTypeDisplayState} from '../../utils/disks/driveType';
15
16
  import {calculateFlagPairIcon, calculateSpaceIcon} from '../../utils/disks/iconCalculators';
16
17
  import {
17
18
  getPDiskDecommitDisplayState,
@@ -205,6 +206,13 @@ function usePDiskDisplayStateGetter(
205
206
  return getDefaultPDiskDisplayState(pDisk);
206
207
  }
207
208
 
209
+ if (pdisksGroupBy === PDisksGroupBy.DriveType) {
210
+ return {
211
+ ...getDriveTypeDisplayState(pDisk),
212
+ width: EXPERT_MODE_PDISK_WIDTH,
213
+ };
214
+ }
215
+
208
216
  const mode = getMode(pdisksGroupBy);
209
217
  const hasWhiteboardData = pDisk.HasWhiteboardData ?? pDisk.WhiteboardSize !== undefined;
210
218
 
@@ -16,6 +16,7 @@ import type {
16
16
  VDiskDisplayStateGetter,
17
17
  } from '../../utils/disks/displayState';
18
18
  import {getDefaultDiskDisplayState} from '../../utils/disks/displayState';
19
+ import {getDriveTypeDisplayState} from '../../utils/disks/driveType';
19
20
  import {getIconCalculator} from '../../utils/disks/getIconStrategy';
20
21
  import {getSeverityCalculator} from '../../utils/disks/getSeverityStrategy';
21
22
  import type {VDisksGroupByValue} from '../../utils/disks/groupBy';
@@ -170,8 +171,17 @@ function getExpertVDiskDisplayState({
170
171
  vDisk,
171
172
  vdisksGroupBy,
172
173
  }: GetExpertVDiskDisplayStateParams): VDiskDisplayState {
174
+ const hasWhiteboardData = vDisk.HasWhiteboardData ?? Boolean(vDisk.VDiskId);
175
+ if (vdisksGroupBy === VDisksGroupBy.DriveType) {
176
+ return {
177
+ ...getDriveTypeDisplayState(hasWhiteboardData ? vDisk.PDisk : undefined),
178
+ striped: false,
179
+ iconPlacement: 'inline',
180
+ };
181
+ }
182
+
173
183
  const mode = getMode(vdisksGroupBy);
174
- if (!(vDisk.HasWhiteboardData ?? Boolean(vDisk.VDiskId))) {
184
+ if (!hasWhiteboardData) {
175
185
  return getMissingVDiskDisplayState(vDisk, isDonor, mode, selectionScope !== 'nodes-vdisks');
176
186
  }
177
187
 
@@ -23,6 +23,7 @@ import {vDiskApi} from '../../store/reducers/vdisk/vdisk';
23
23
  import {cn} from '../../utils/cn';
24
24
  import {parseVdiskId} from '../../utils/dataFormatters/dataFormatters';
25
25
  import {VDISK_LABEL_CONFIG} from '../../utils/disks/constants';
26
+ import {formatPDiskType} from '../../utils/disks/getPDiskType';
26
27
  import {getDataSeverityColor} from '../../utils/disks/helpers';
27
28
  import {useAutoRefreshInterval, useTypedDispatch} from '../../utils/hooks';
28
29
  import {useAppTitle} from '../App/AppTitleContext';
@@ -122,7 +123,14 @@ export function VDiskPage() {
122
123
  <PageMetaWithAutorefresh
123
124
  className={vDiskPageCn('meta')}
124
125
  loading={loading}
125
- items={[hostItem, nodeIdItem, NodeType, NodeDC, pDiskIdItem, PDiskType]}
126
+ items={[
127
+ hostItem,
128
+ nodeIdItem,
129
+ NodeType,
130
+ NodeDC,
131
+ pDiskIdItem,
132
+ formatPDiskType(PDiskType),
133
+ ]}
126
134
  />
127
135
  );
128
136
  };
@@ -1,5 +1,6 @@
1
1
  import type {SchemaPathParam} from '../../../types/api/common';
2
2
  import type {TEvDescribeSchemeResult} from '../../../types/api/schema/schema';
3
+ import {reachObjectCreationGoal} from '../../../utils/objectCreationMetrics';
3
4
  import {isQueryErrorResponse, parseQueryAPIResponse} from '../../../utils/query';
4
5
  import {api} from '../api';
5
6
 
@@ -42,6 +43,8 @@ export const tableApi = api.injectEndpoints({
42
43
  database: string;
43
44
  formValues: TableFormValues;
44
45
  }) => {
46
+ const objectType = formValues.type === 'row' ? 'row_table' : 'column_table';
47
+ reachObjectCreationGoal('createObject', objectType);
45
48
  try {
46
49
  const {
47
50
  type,
@@ -79,12 +82,15 @@ export const tableApi = api.injectEndpoints({
79
82
  });
80
83
 
81
84
  if (isQueryErrorResponse(response)) {
85
+ reachObjectCreationGoal('createObjectError', objectType, response);
82
86
  return {error: response};
83
87
  }
84
88
 
85
89
  const data = parseQueryAPIResponse(response);
90
+ reachObjectCreationGoal('createObjectSuccess', objectType);
86
91
  return {data};
87
92
  } catch (error) {
93
+ reachObjectCreationGoal('createObjectError', objectType, error);
88
94
  return {error};
89
95
  }
90
96
  },
@@ -4,6 +4,7 @@ import {createSelector} from '@reduxjs/toolkit';
4
4
  import type {IProtobufTimeObject} from '../../../types/api/common';
5
5
  import type {TopicDataRequest} from '../../../types/api/topic';
6
6
  import {convertBytesObjectToSpeed} from '../../../utils/bytesParsers';
7
+ import {reachObjectCreationGoal} from '../../../utils/objectCreationMetrics';
7
8
  import {isQueryErrorResponse, parseQueryAPIResponse} from '../../../utils/query';
8
9
  import {parseLag, parseTimestampToIdleTime} from '../../../utils/timeParsers';
9
10
  import type {RootState} from '../../defaultStore';
@@ -82,6 +83,7 @@ export const topicApi = api.injectEndpoints({
82
83
  database: string;
83
84
  formData: TopicFormValues;
84
85
  }) => {
86
+ reachObjectCreationGoal('createObject', 'topic');
85
87
  try {
86
88
  const query = buildCreateTopicQuery(formData);
87
89
 
@@ -92,11 +94,15 @@ export const topicApi = api.injectEndpoints({
92
94
  });
93
95
 
94
96
  if (isQueryErrorResponse(response)) {
97
+ reachObjectCreationGoal('createObjectError', 'topic', response);
95
98
  return {error: response};
96
99
  }
97
100
 
98
- return {data: parseQueryAPIResponse(response)};
101
+ const data = parseQueryAPIResponse(response);
102
+ reachObjectCreationGoal('createObjectSuccess', 'topic');
103
+ return {data};
99
104
  } catch (error) {
105
+ reachObjectCreationGoal('createObjectError', 'topic', error);
100
106
  return {error};
101
107
  }
102
108
  },
@@ -216,6 +216,12 @@ export type RenderHealthcheckAssistantAction = (
216
216
  ) => React.ReactNode;
217
217
 
218
218
  export interface UiMetricaGoals {
219
+ /** Creation attempt after form validation. Params: objectType (row_table, column_table, topic). */
220
+ createObject?: string;
221
+ /** Successful creation response. Params: objectType. */
222
+ createObjectSuccess?: string;
223
+ /** Failed creation. Params: objectType, errorType (ydb, http, network, timeout, cancelled, unknown), httpStatus (HTTP errors only). */
224
+ createObjectError?: string;
219
225
  runQuery?: string;
220
226
  explainAnalyzeQuery?: string;
221
227
  stopQuery?: string;
@@ -2,13 +2,14 @@ import type {IconData} from '@gravity-ui/uikit';
2
2
 
3
3
  import {DATA_SEVERITY, DISK_COLOR_STATE_TO_NUMERIC_SEVERITY} from './constants';
4
4
  import type {IconWithColor} from './iconCalculators';
5
- import type {DisplaySeverity, PreparedPDisk, PreparedVDisk} from './types';
5
+ import type {DisplaySeverity, PDiskType, PreparedPDisk, PreparedVDisk} from './types';
6
6
 
7
7
  export type DiskDisplayMode =
8
8
  | 'state'
9
9
  | 'space'
10
10
  | 'frontQueues'
11
11
  | 'compaction'
12
+ | 'driveType'
12
13
  | 'all'
13
14
  | 'drive'
14
15
  | 'decommit'
@@ -42,6 +43,7 @@ export interface PDiskAllModeDisplayState {
42
43
  }
43
44
 
44
45
  export interface BaseDiskDisplayState {
46
+ driveType?: PDiskType;
45
47
  severity: DisplaySeverity;
46
48
  icon: DiskIndicatorValue | undefined;
47
49
  mode: DiskDisplayMode | undefined;
@@ -0,0 +1,30 @@
1
+ import {CircleQuestionFill} from '@gravity-ui/icons';
2
+
3
+ import {NOT_AVAILABLE_SEVERITY} from './constants';
4
+ import type {BaseDiskDisplayState} from './displayState';
5
+ import {formatPDiskType} from './getPDiskType';
6
+ import type {PDiskType, PreparedPDisk} from './types';
7
+
8
+ export function getDriveTypeDisplayState(pDisk: PreparedPDisk = {}): BaseDiskDisplayState {
9
+ const hasWhiteboardData = pDisk.HasWhiteboardData ?? pDisk.WhiteboardSize !== undefined;
10
+ const isNoData = !hasWhiteboardData;
11
+ let driveType: PDiskType | undefined;
12
+ if (hasWhiteboardData) {
13
+ switch (pDisk.Type) {
14
+ case 'SSD':
15
+ case 'HDD':
16
+ case 'NVME':
17
+ driveType = pDisk.Type;
18
+ }
19
+ }
20
+
21
+ return {
22
+ mode: 'driveType',
23
+ driveType,
24
+ severity: NOT_AVAILABLE_SEVERITY,
25
+ icon: isNoData ? undefined : (formatPDiskType(driveType) ?? CircleQuestionFill),
26
+ isNoData,
27
+ borderless: true,
28
+ showNoDataPlaceholder: isNoData,
29
+ };
30
+ }
@@ -5,9 +5,10 @@ import {EFlag} from '../../types/api/enums';
5
5
  import {DONOR_COLOR, NOT_AVAILABLE_SEVERITY} from './constants';
6
6
  import type {DiskIndicatorValue} from './displayState';
7
7
  import {getDisplaySeverityColor} from './helpers';
8
- import type {DiskBarTone} from './types';
8
+ import type {DiskBarTone, PDiskType} from './types';
9
9
 
10
10
  interface GetDiskBarToneParams {
11
+ driveType?: PDiskType;
11
12
  severity?: number;
12
13
  isDonor?: boolean;
13
14
  showIndicator?: boolean;
@@ -24,12 +25,17 @@ function hasMissingDataIndicator(indicator: DiskIndicatorValue | undefined) {
24
25
  }
25
26
 
26
27
  export function getDiskBarTone({
28
+ driveType,
27
29
  severity,
28
30
  isDonor,
29
31
  showIndicator,
30
32
  indicator,
31
33
  isNoData,
32
34
  }: GetDiskBarToneParams): DiskBarTone {
35
+ if (driveType) {
36
+ return driveType;
37
+ }
38
+
33
39
  if (isDonor) {
34
40
  return DONOR_COLOR;
35
41
  }
@@ -32,6 +32,10 @@ export const PDISK_TYPES = {
32
32
  MVME: 'NVME',
33
33
  } as const;
34
34
 
35
+ export function formatPDiskType(type?: string) {
36
+ return type === 'NVME' ? 'NVMe' : type;
37
+ }
38
+
35
39
  // Bear with me.
36
40
  // Disk type is determined by the field Category.
37
41
  // Category is a bit field defined as follows:
@@ -3,6 +3,7 @@ export const VDisksGroupBy = {
3
3
  Space: 'Space',
4
4
  FrontQueues: 'FrontQueues',
5
5
  Compaction: 'Compaction',
6
+ DriveType: 'DriveType',
6
7
  All: 'All',
7
8
  } as const;
8
9
 
@@ -165,7 +165,7 @@ function getFlagIconWithColor(flag: EFlag | undefined): IconWithColor | undefine
165
165
  if (!flag || flag === EFlag.Grey) {
166
166
  return {
167
167
  icon: CircleQuestionFill,
168
- color: 'rgba(162, 162, 162, 1)',
168
+ color: 'var(--g-color-text-hint)',
169
169
  };
170
170
  }
171
171
 
@@ -230,7 +230,7 @@ export function calculateFlagPairIcon(
230
230
  * - Yellow: TriangleExclamationFill (text-warning)
231
231
  * - Orange: CircleExclamationFill (text-danger)
232
232
  * - Red: CircleXmarkFill (text-primary)
233
- * - Missing: CircleQuestionFill (rgba(162, 162, 162, 1))
233
+ * - Missing: CircleQuestionFill (text-hint)
234
234
  */
235
235
  export function calculateCompactionIcon(
236
236
  vDisk: PreparedVDisk,
@@ -25,7 +25,7 @@ export type ExtendedDiskColor =
25
25
  */
26
26
  export type DiskColor = EFlag | ExtendedDiskColor;
27
27
 
28
- export type DiskBarTone = DiskColor | 'DarkGrey' | 'LightGrey';
28
+ export type DiskBarTone = DiskColor | 'DarkGrey' | 'LightGrey' | PDiskType;
29
29
 
30
30
  /**
31
31
  * Basic severity levels for data storage (0-5).
@@ -0,0 +1,47 @@
1
+ import {isQueryCancelledError, isQueryErrorResponse} from './query';
2
+ import {isNetworkError, isResponseError} from './response';
3
+ import {reachMetricaGoal} from './yaMetrica';
4
+
5
+ type ObjectType = 'row_table' | 'column_table' | 'topic';
6
+ type CreationGoal = 'createObject' | 'createObjectSuccess' | 'createObjectError';
7
+
8
+ export function getObjectCreationErrorParams(error: unknown): Record<string, string | number> {
9
+ if (isQueryCancelledError(error)) {
10
+ return {errorType: 'cancelled'};
11
+ }
12
+ if (isResponseError(error)) {
13
+ if (typeof error.status === 'number' && error.status > 0) {
14
+ return {errorType: 'http', httpStatus: error.status};
15
+ }
16
+ }
17
+ if (isQueryErrorResponse(error)) {
18
+ return {errorType: 'ydb'};
19
+ }
20
+ if (isNetworkError(error)) {
21
+ return {errorType: 'network'};
22
+ }
23
+ if (
24
+ error &&
25
+ typeof error === 'object' &&
26
+ 'code' in error &&
27
+ (error.code === 'ECONNABORTED' || error.code === 'ETIMEDOUT')
28
+ ) {
29
+ return {errorType: 'timeout'};
30
+ }
31
+ return {errorType: 'unknown'};
32
+ }
33
+
34
+ export function reachObjectCreationGoal(
35
+ goal: CreationGoal,
36
+ objectType: ObjectType,
37
+ error?: unknown,
38
+ ) {
39
+ try {
40
+ reachMetricaGoal(goal, {
41
+ objectType,
42
+ ...(goal === 'createObjectError' ? getObjectCreationErrorParams(error) : {}),
43
+ });
44
+ } catch {
45
+ // Analytics failures must not affect the creation request or its result.
46
+ }
47
+ }