Skip to content

Commit 5830b30

Browse files
authored
feat: add async_replication navigation tree node type (#72)
1 parent c7c0b2f commit 5830b30

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

src/components/NavigationTree/NavigationTreeNode.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22

33
import {TreeView} from '../TreeView/TreeView';
4+
import {AsyncReplicationIcon} from '../icons/AsyncReplication';
45
import {ColumnTableIcon} from '../icons/ColumnTable';
56
import {DatabaseIcon} from '../icons/Database';
67
import {ExternalDataSourceIcon} from '../icons/ExternalDataSource';
@@ -32,6 +33,8 @@ export interface NavigationTreeNodeProps {
3233

3334
function renderIcon(type: NavigationTreeNodeType | string, collapsed: boolean) {
3435
switch (type) {
36+
case 'async_replication':
37+
return <AsyncReplicationIcon height={16} />;
3538
case 'database':
3639
// this icon is larger than the others, therefore 14 for a better fit
3740
return <DatabaseIcon height={14} />;

src/components/NavigationTree/__stories__/NavigationTree.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ async function fetchPath(path: string) {
9191
name: 'table',
9292
type: 'table',
9393
},
94+
{
95+
name: 'replication',
96+
type: 'async_replication',
97+
},
9498
{
9599
name: 'external_table',
96100
type: 'external_table',
@@ -111,7 +115,7 @@ async function fetchPath(path: string) {
111115
}
112116

113117
if (path === '/folder_2') {
114-
throw new Error('Ошибка');
118+
throw new Error('Fetch error.');
115119
}
116120

117121
if (path === '/folder_3') {

src/components/NavigationTree/types.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import type {DropdownMenuItemMixed} from '@gravity-ui/uikit';
22

33
export type NavigationTreeNodeType =
4+
| 'async_replication'
5+
| 'column_table'
46
| 'database'
57
| 'directory'
6-
| 'table'
7-
| 'column_table'
8+
| 'external_data_source'
9+
| 'external_table'
810
| 'index_table'
911
| 'index'
10-
| 'topic'
1112
| 'stream'
12-
| 'external_table'
13-
| 'external_data_source'
13+
| 'table'
14+
| 'topic'
1415
| 'view';
1516

1617
export interface NavigationTreeDataItem {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
3+
export function AsyncReplicationIcon(props: React.SVGProps<SVGSVGElement>) {
4+
return (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" {...props}>
6+
<path
7+
fillRule="evenodd"
8+
clipRule="evenodd"
9+
d="M9.22 15.03s-.001 0 0 0a.75.75 0 0 0 1.06-1.06l-.47-.47H10a3.016 3.016 0 0 0 1.507-.405A2.999 2.999 0 0 0 13 10.5V7.896h.003a2.735 2.735 0 0 0 .785-.366 2.75 2.75 0 1 0-2.288.366V10.5A1.5 1.5 0 0 1 10 12h-.19l.47-.47s0 .001 0 0a.75.75 0 0 0-1.06-1.06l-.47.47-1.28 1.28a.75.75 0 0 0 0 1.06l1.75 1.75ZM5.72 2.97a.75.75 0 0 1 1.06 0l.47.47 1.28 1.28a.748.748 0 0 1 0 1.06L6.78 7.53c.001 0 0 0 0 0a.751.751 0 0 1-1.06-1.06L6.19 6H6a1.5 1.5 0 0 0-1.5 1.5v2.604a2.757 2.757 0 0 1 2 2.646 2.738 2.738 0 0 1-1.212 2.28 2.737 2.737 0 0 1-1.538.47A2.747 2.747 0 0 1 1 12.75a2.751 2.751 0 0 1 2-2.646V7.5a2.999 2.999 0 0 1 3-3h.19l-.47-.47a.75.75 0 0 1 0-1.06Zm-.908 9.121A1.246 1.246 0 0 1 5 12.75a1.25 1.25 0 1 1-.188-.659ZM11 5.25a1.25 1.25 0 1 1 2.5 0 1.25 1.25 0 0 1-2.5 0Z"
10+
/>
11+
</svg>
12+
);
13+
}

0 commit comments

Comments
 (0)