ydb-embedded-ui 2.4.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.4.3](https://github.com/ydb-platform/ydb-embedded-ui/compare/v2.4.2...v2.4.3) (2022-11-14)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fix app crash on ColumnTable path type ([a1aefa8](https://github.com/ydb-platform/ydb-embedded-ui/commit/a1aefa876600b1b459bf3024f0704883431df5a2))
9
+ * **schema:** add types for ColumnTable and ColumnStore ([dc13307](https://github.com/ydb-platform/ydb-embedded-ui/commit/dc13307dcea801c05863b7dd5ee19f01aa074c85))
10
+
3
11
  ## [2.4.2](https://github.com/ydb-platform/ydb-embedded-ui/compare/v2.4.1...v2.4.2) (2022-11-09)
4
12
 
5
13
 
@@ -12,7 +12,7 @@ import {
12
12
  PersQueueGroupInfo,
13
13
  } from '../../../../components/InfoViewer/schemaInfo';
14
14
 
15
- import {EPathType} from '../../../../types/api/schema';
15
+ import {EPathType, TColumnTableDescription} from '../../../../types/api/schema';
16
16
  import {isColumnEntityType, isTableType} from '../../utils/schema';
17
17
  //@ts-ignore
18
18
  import {getSchema, resetLoadingState} from '../../../../store/reducers/schema';
@@ -25,7 +25,7 @@ import {useAutofetcher} from '../../../../utils/hooks';
25
25
 
26
26
  import './Overview.scss';
27
27
 
28
- function prepareOlapTableGeneral(tableData: any, olapStats?: any[]) {
28
+ function prepareOlapTableGeneral(tableData: TColumnTableDescription = {}, olapStats?: any[]) {
29
29
  const {ColumnShardCount} = tableData;
30
30
  const Bytes = olapStats?.reduce((acc, el) => {
31
31
  acc += parseInt(el.Bytes) || 0;
@@ -103,7 +103,8 @@ function Overview(props: OverviewProps) {
103
103
 
104
104
  const schemaData = useMemo(() => {
105
105
  return isTableType(type) && isColumnEntityType(type)
106
- ? prepareOlapTableGeneral(tableSchema, olapStats)
106
+ ? // process data for ColumnTable
107
+ prepareOlapTableGeneral(tableSchema, olapStats)
107
108
  : currentItem;
108
109
  }, [type, tableSchema, olapStats, currentItem]);
109
110
 
@@ -20,7 +20,12 @@ import {
20
20
  } from '../../../components/InfoViewer/schemaOverview';
21
21
  import Icon from '../../../components/Icon/Icon';
22
22
 
23
- import {EPathSubType, EPathType, TDirEntry} from '../../../types/api/schema';
23
+ import {
24
+ EPathSubType,
25
+ EPathType,
26
+ TColumnTableDescription,
27
+ TDirEntry,
28
+ } from '../../../types/api/schema';
24
29
  import {isColumnEntityType, isIndexTable, isTableType} from '../utils/schema';
25
30
 
26
31
  import {
@@ -57,19 +62,26 @@ const initialTenantCommonInfoState = {
57
62
  collapsed: getInitialIsSummaryCollapsed(),
58
63
  };
59
64
 
60
- function prepareOlapTableSchema(tableSchema: any) {
61
- const {Name, Schema = {}} = tableSchema;
62
- const {Columns, KeyColumnNames} = Schema;
63
- const KeyColumnIds = KeyColumnNames?.map((name: string) => {
64
- const column = Columns?.find((el: any) => el.Name === name);
65
- return column.Id;
66
- });
65
+ function prepareOlapTableSchema(tableSchema: TColumnTableDescription = {}) {
66
+ const {Name, Schema} = tableSchema;
67
+
68
+ if (Schema) {
69
+ const {Columns, KeyColumnNames} = Schema;
70
+ const KeyColumnIds = KeyColumnNames?.map((name: string) => {
71
+ const column = Columns?.find((el) => el.Name === name);
72
+ return column?.Id;
73
+ });
74
+
75
+ return {
76
+ Columns,
77
+ KeyColumnNames,
78
+ Name,
79
+ KeyColumnIds,
80
+ };
81
+ }
67
82
 
68
83
  return {
69
- Columns,
70
- KeyColumnNames,
71
84
  Name,
72
- KeyColumnIds,
73
85
  };
74
86
  }
75
87
 
@@ -104,15 +116,23 @@ function ObjectSummary(props: ObjectSummaryProps) {
104
116
  });
105
117
 
106
118
  const {name: tenantName, info: infoTab} = queryParams;
107
- const pathData: TDirEntry | undefined = _.get(data[tenantName as string], 'PathDescription.Self');
108
- const currentSchemaData: TDirEntry | undefined = _.get(data[currentSchemaPath], 'PathDescription.Self');
119
+ const pathData: TDirEntry | undefined = _.get(
120
+ data[tenantName as string],
121
+ 'PathDescription.Self',
122
+ );
123
+ const currentSchemaData: TDirEntry | undefined = _.get(
124
+ data[currentSchemaPath],
125
+ 'PathDescription.Self',
126
+ );
109
127
 
110
128
  const tableSchema =
111
129
  currentItem?.PathDescription?.Table || currentItem?.PathDescription?.ColumnTableDescription;
112
130
 
113
- const schema = isTableType(props.type) && isColumnEntityType(props.type)
114
- ? prepareOlapTableSchema(tableSchema)
115
- : tableSchema;
131
+ const schema =
132
+ isTableType(props.type) && isColumnEntityType(props.type)
133
+ ? // process data for ColumnTable
134
+ prepareOlapTableSchema(tableSchema)
135
+ : tableSchema;
116
136
 
117
137
  useEffect(() => {
118
138
  const {type} = props;
@@ -166,11 +186,16 @@ function ObjectSummary(props: ObjectSummaryProps) {
166
186
  [EPathType.EPathTypeExtSubDomain]: undefined,
167
187
  [EPathType.EPathTypeColumnStore]: undefined,
168
188
  [EPathType.EPathTypeColumnTable]: undefined,
169
- [EPathType.EPathTypeCdcStream]: () => <CDCStreamOverview data={data[currentSchemaPath]} />,
170
- [EPathType.EPathTypePersQueueGroup]: () => <PersQueueGroupOverview data={data[currentSchemaPath]} />,
189
+ [EPathType.EPathTypeCdcStream]: () => (
190
+ <CDCStreamOverview data={data[currentSchemaPath]} />
191
+ ),
192
+ [EPathType.EPathTypePersQueueGroup]: () => (
193
+ <PersQueueGroupOverview data={data[currentSchemaPath]} />
194
+ ),
171
195
  };
172
196
 
173
- let component = currentSchemaData?.PathType && pathTypeToComponent[currentSchemaData.PathType]?.();
197
+ let component =
198
+ currentSchemaData?.PathType && pathTypeToComponent[currentSchemaData.PathType]?.();
174
199
 
175
200
  if (!component) {
176
201
  const startTimeInMilliseconds = Number(currentSchemaData?.CreateStep);
@@ -182,11 +207,7 @@ function ObjectSummary(props: ObjectSummaryProps) {
182
207
  component = <InfoViewer info={[{label: 'Create time', value: createTime}]} />;
183
208
  }
184
209
 
185
- return (
186
- <div className={b('overview-wrapper')}>
187
- {component}
188
- </div>
189
- );
210
+ return <div className={b('overview-wrapper')}>{component}</div>;
190
211
  };
191
212
 
192
213
  const renderTabContent = () => {
@@ -35,7 +35,7 @@ const pathTypeToNodeType: Record<EPathType, NavigationTreeNodeType | undefined>
35
35
  export const mapPathTypeToNavigationTreeType = (
36
36
  type: EPathType = EPathType.EPathTypeDir,
37
37
  subType?: EPathSubType,
38
- defaultType: NavigationTreeNodeType = 'directory'
38
+ defaultType: NavigationTreeNodeType = 'directory',
39
39
  ): NavigationTreeNodeType =>
40
40
  (subType && pathSubTypeToNodeType[subType]) || pathTypeToNodeType[type] || defaultType;
41
41
 
@@ -87,5 +87,4 @@ const pathTypeToIsColumn: Record<EPathType, boolean> = {
87
87
  [EPathType.EPathTypePersQueueGroup]: false,
88
88
  };
89
89
 
90
- export const isColumnEntityType = (type?: EPathType) =>
91
- (type && pathTypeToIsColumn[type]) ?? false;
90
+ export const isColumnEntityType = (type?: EPathType) => (type && pathTypeToIsColumn[type]) ?? false;
@@ -52,8 +52,8 @@ interface TPathDescription {
52
52
  TabletMetrics?: unknown;
53
53
  TablePartitions?: unknown[];
54
54
 
55
- ColumnStoreDescription?: unknown;
56
- ColumnTableDescription?: unknown;
55
+ ColumnStoreDescription?: TColumnStoreDescription;
56
+ ColumnTableDescription?: TColumnTableDescription;
57
57
 
58
58
  TableIndex?: TIndexDescription;
59
59
 
@@ -85,12 +85,12 @@ export interface TDirEntry {
85
85
  Version?: TPathVersion;
86
86
  }
87
87
 
88
- // incomplete
88
+ // FIXME: incomplete
89
89
  export interface TTableDescription {
90
90
  PartitionConfig?: TPartitionConfig;
91
91
  }
92
92
 
93
- // incomplete
93
+ // FIXME: incomplete
94
94
  export interface TPartitionConfig {
95
95
  /** uint64 */
96
96
  FollowerCount?: string;
@@ -263,7 +263,6 @@ export enum EPathType {
263
263
  EPathTypeColumnStore = 'EPathTypeColumnStore',
264
264
  EPathTypeColumnTable = 'EPathTypeColumnTable',
265
265
  EPathTypeCdcStream = 'EPathTypeCdcStream',
266
-
267
266
  }
268
267
 
269
268
  export enum EPathSubType {
@@ -414,7 +413,7 @@ interface TPQPartitionConfig {
414
413
  ExplicitChannelProfiles?: TChannelProfile[];
415
414
 
416
415
  MirrorFrom?: TMirrorPartitionConfig;
417
- };
416
+ }
418
417
 
419
418
  interface TPQTabletConfig {
420
419
  /** uint64 */
@@ -437,7 +436,7 @@ interface TPQTabletConfig {
437
436
  ReadFromTimestampsMs?: number[];
438
437
  /** uint64[] */
439
438
  ConsumerFormatVersions?: number[];
440
-
439
+
441
440
  ConsumerCodecs?: TCodecs[];
442
441
  ReadRuleServiceTypes?: string;
443
442
 
@@ -461,7 +460,7 @@ interface TPQTabletConfig {
461
460
  PartitionKeySchema?: TKeyComponentSchema[];
462
461
 
463
462
  Partitions?: TPartition[];
464
-
463
+
465
464
  MeteringMode?: EMeteringMode;
466
465
  }
467
466
 
@@ -481,7 +480,7 @@ export interface TPersQueueGroupDescription {
481
480
  /** uint64 */
482
481
  PathId?: string;
483
482
  TotalGroupCount: number;
484
-
483
+
485
484
  PartitionsToAdd?: TPartitionToAdd[];
486
485
  PartitionsToDelete?: number[];
487
486
  NextPartitionId?: number;
@@ -497,3 +496,158 @@ export interface TPersQueueGroupDescription {
497
496
 
498
497
  BootstrapConfig?: TBootstrapConfig;
499
498
  }
499
+
500
+ export interface TColumnTableDescription {
501
+ Name?: string;
502
+
503
+ Schema?: TColumnTableSchema;
504
+ TtlSettings?: TColumnDataLifeCycle;
505
+
506
+ SchemaPresetId?: number;
507
+ SchemaPresetName?: string;
508
+
509
+ ColumnStorePathId?: TPathID;
510
+
511
+ ColumnShardCount?: number;
512
+ Sharding?: TColumnTableSharding;
513
+
514
+ /** uint64 */
515
+ SchemaPresetVersionAdj?: string;
516
+ /** uint64 */
517
+ TtlSettingsPresetVersionAdj?: string;
518
+
519
+ StorageConfig?: TColumnStorageConfig;
520
+ }
521
+
522
+ interface TColumnTableSchema {
523
+ Columns: TOlapColumnDescription[];
524
+ KeyColumnNames: string[];
525
+ Engine?: EColumnTableEngine;
526
+ NextColumnId?: number;
527
+
528
+ /** uint64 */
529
+ Version?: string;
530
+
531
+ DefaultCompression?: TCompressionOptions;
532
+ EnableTiering?: boolean;
533
+ }
534
+
535
+ interface TOlapColumnDescription {
536
+ Id?: number;
537
+ Name?: string;
538
+ Type?: string;
539
+ TypeId?: number;
540
+ TypeInfo?: TTypeInfo;
541
+ }
542
+
543
+ interface TTypeInfo {
544
+ PgTypeId?: number;
545
+ }
546
+
547
+ enum EColumnTableEngine {
548
+ COLUMN_ENGINE_NONE = 'COLUMN_ENGINE_NONE',
549
+ COLUMN_ENGINE_REPLACING_TIMESERIES = 'COLUMN_ENGINE_REPLACING_TIMESERIES',
550
+ }
551
+
552
+ interface TCompressionOptions {
553
+ CompressionCodec?: EColumnCodec;
554
+ CompressionLevel?: number;
555
+ }
556
+
557
+ enum EColumnCodec {
558
+ ColumnCodecPlain = 'ColumnCodecPlain',
559
+ ColumnCodecLZ4 = 'ColumnCodecLZ4',
560
+ ColumnCodecZSTD = 'ColumnCodecZSTD',
561
+ }
562
+
563
+ interface TColumnDataLifeCycle {
564
+ Enabled?: TTtl;
565
+ Disabled?: {};
566
+ Tiering?: TStorageTiering;
567
+
568
+ /** uint64 */
569
+ Version?: string;
570
+ }
571
+
572
+ interface TTtl {
573
+ ColumnName?: string;
574
+
575
+ ExpireAfterSeconds?: number;
576
+
577
+ /** uint64 */
578
+ ExpireAfterBytes?: string;
579
+
580
+ ColumnUnit?: EUnit;
581
+ }
582
+
583
+ interface TStorageTier {
584
+ Name?: string;
585
+ Eviction?: TTtl;
586
+ }
587
+ interface TStorageTiering {
588
+ Tiers: TStorageTier[];
589
+ }
590
+
591
+ enum EUnit {
592
+ UNIT_AUTO = 'UNIT_AUTO',
593
+ UNIT_SECONDS = 'UNIT_SECONDS',
594
+ UNIT_MILLISECONDS = 'UNIT_MILLISECONDS',
595
+ UNIT_MICROSECONDS = 'UNIT_MICROSECONDS',
596
+ UNIT_NANOSECONDS = 'UNIT_NANOSECONDS',
597
+ }
598
+
599
+ interface TColumnTableSharding {
600
+ /** uint64 */
601
+ Version?: string;
602
+
603
+ /** uint64 */
604
+ ColumnShards: string[];
605
+
606
+ /** uint64 */
607
+ AdditionalColumnShards: string[];
608
+
609
+ UniquePrimaryKey?: boolean;
610
+
611
+ RandomSharding?: {};
612
+ HashSharding?: THashSharding;
613
+ }
614
+
615
+ interface THashSharding {
616
+ Function?: EHashFunction;
617
+ Columns: string[];
618
+ UniqueShardKey?: boolean;
619
+ ActiveShardsCount?: number;
620
+ }
621
+ enum EHashFunction {
622
+ HASH_FUNCTION_MODULO_N = 'HASH_FUNCTION_MODULO_N',
623
+ HASH_FUNCTION_CLOUD_LOGS = 'HASH_FUNCTION_CLOUD_LOGS',
624
+ }
625
+ interface TColumnStorageConfig {
626
+ SysLog?: TStorageSettings;
627
+ Log?: TStorageSettings;
628
+ Data?: TStorageSettings;
629
+ DataChannelCount?: number;
630
+ }
631
+ interface TStorageSettings {
632
+ PreferredPoolKind?: string;
633
+ AllowOtherKinds?: boolean;
634
+ }
635
+ export interface TColumnStoreDescription {
636
+ Name?: string;
637
+ ColumnShardCount?: number;
638
+
639
+ /** uint64 */
640
+ ColumnShards: string[];
641
+
642
+ SchemaPresets: TColumnTableSchemaPreset[];
643
+ StorageConfig?: TColumnStorageConfig;
644
+
645
+ NextSchemaPresetId?: number;
646
+ NextTtlSettingsPresetId?: number;
647
+ }
648
+
649
+ interface TColumnTableSchemaPreset {
650
+ Id?: number;
651
+ Name?: string;
652
+ Schema?: TColumnTableSchema;
653
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@gravity-ui/i18n": "^1.0.0",
13
- "@yandex-cloud/paranoid": "^1.2.1",
13
+ "@yandex-cloud/paranoid": "^1.3.0",
14
14
  "@yandex-cloud/react-data-table": "0.2.1",
15
15
  "axios": "0.19.2",
16
16
  "bem-cn-lite": "4.0.0",