1
- import nodesRightIcon from '@gravity-ui/icons/svgs/nodes-right.svg' ;
2
- import databaseIcon from '@gravity-ui/icons/svgs/database.svg' ;
1
+ import {
2
+ NodesRight as ClusterIcon ,
3
+ Database as DatabaseIcon ,
4
+ Cpu as ComputeNodeIcon ,
5
+ HardDrive as StorageNodeIcon ,
6
+ } from '@gravity-ui/icons' ;
3
7
4
8
import type {
5
9
BreadcrumbsOptions ,
@@ -15,8 +19,9 @@ import {
15
19
TENANT_PAGE ,
16
20
TENANT_PAGES_IDS ,
17
21
} from '../../store/reducers/tenant/constants' ;
22
+ import { TabletIcon } from '../../components/TabletIcon/TabletIcon' ;
18
23
import routes , { createHref } from '../../routes' ;
19
- import { CLUSTER_DEFAULT_TITLE } from '../../utils/constants' ;
24
+ import { CLUSTER_DEFAULT_TITLE , getTabletLabel } from '../../utils/constants' ;
20
25
21
26
import { getClusterPath } from '../Cluster/utils' ;
22
27
import { TenantTabsGroups , getTenantPath } from '../Tenant/TenantPages' ;
@@ -29,7 +34,7 @@ const prepareTenantName = (tenantName: string) => {
29
34
export interface RawBreadcrumbItem {
30
35
text : string ;
31
36
link ?: string ;
32
- icon ?: SVGIconData ;
37
+ icon ?: JSX . Element ;
33
38
}
34
39
35
40
const getClusterBreadcrumbs = (
@@ -42,7 +47,7 @@ const getClusterBreadcrumbs = (
42
47
{
43
48
text : clusterName || CLUSTER_DEFAULT_TITLE ,
44
49
link : getClusterPath ( clusterTab , query ) ,
45
- icon : nodesRightIcon ,
50
+ icon : < ClusterIcon /> ,
46
51
} ,
47
52
] ;
48
53
} ;
@@ -56,7 +61,7 @@ const getTenantBreadcrumbs = (
56
61
const text = tenantName ? prepareTenantName ( tenantName ) : 'Tenant' ;
57
62
const link = tenantName ? getTenantPath ( { ...query , name : tenantName } ) : undefined ;
58
63
59
- return [ ...getClusterBreadcrumbs ( options , query ) , { text, link, icon : databaseIcon } ] ;
64
+ return [ ...getClusterBreadcrumbs ( options , query ) , { text, link, icon : < DatabaseIcon /> } ] ;
60
65
} ;
61
66
62
67
const getNodeBreadcrumbs = ( options : NodeBreadcrumbsOptions , query = { } ) : RawBreadcrumbItem [ ] => {
@@ -81,8 +86,13 @@ const getNodeBreadcrumbs = (options: NodeBreadcrumbsOptions, query = {}): RawBre
81
86
82
87
const text = nodeId ? `Node ${ nodeId } ` : 'Node' ;
83
88
const link = nodeId ? getDefaultNodePath ( nodeId , query ) : undefined ;
89
+ const icon = isStorageNode ? < StorageNodeIcon /> : < ComputeNodeIcon /> ;
84
90
85
- breadcrumbs . push ( { text, link} ) ;
91
+ breadcrumbs . push ( {
92
+ text,
93
+ link,
94
+ icon,
95
+ } ) ;
86
96
87
97
return breadcrumbs ;
88
98
} ;
@@ -123,12 +133,13 @@ const getTabletBreadcrubms = (
123
133
options : TabletBreadcrumbsOptions ,
124
134
query = { } ,
125
135
) : RawBreadcrumbItem [ ] => {
126
- const { tabletId} = options ;
136
+ const { tabletId, tabletType } = options ;
127
137
128
138
const breadcrumbs = getTabletsBreadcrubms ( options , query ) ;
129
139
130
140
breadcrumbs . push ( {
131
141
text : tabletId || 'Tablet' ,
142
+ icon : < TabletIcon text = { getTabletLabel ( tabletType ) } /> ,
132
143
} ) ;
133
144
134
145
return breadcrumbs ;
0 commit comments