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' ;
37
48import type {
59 BreadcrumbsOptions ,
@@ -15,8 +19,9 @@ import {
1519 TENANT_PAGE ,
1620 TENANT_PAGES_IDS ,
1721} from '../../store/reducers/tenant/constants' ;
22+ import { TabletIcon } from '../../components/TabletIcon/TabletIcon' ;
1823import routes , { createHref } from '../../routes' ;
19- import { CLUSTER_DEFAULT_TITLE } from '../../utils/constants' ;
24+ import { CLUSTER_DEFAULT_TITLE , getTabletLabel } from '../../utils/constants' ;
2025
2126import { getClusterPath } from '../Cluster/utils' ;
2227import { TenantTabsGroups , getTenantPath } from '../Tenant/TenantPages' ;
@@ -29,7 +34,7 @@ const prepareTenantName = (tenantName: string) => {
2934export interface RawBreadcrumbItem {
3035 text : string ;
3136 link ?: string ;
32- icon ?: SVGIconData ;
37+ icon ?: JSX . Element ;
3338}
3439
3540const getClusterBreadcrumbs = (
@@ -42,7 +47,7 @@ const getClusterBreadcrumbs = (
4247 {
4348 text : clusterName || CLUSTER_DEFAULT_TITLE ,
4449 link : getClusterPath ( clusterTab , query ) ,
45- icon : nodesRightIcon ,
50+ icon : < ClusterIcon /> ,
4651 } ,
4752 ] ;
4853} ;
@@ -56,7 +61,7 @@ const getTenantBreadcrumbs = (
5661 const text = tenantName ? prepareTenantName ( tenantName ) : 'Tenant' ;
5762 const link = tenantName ? getTenantPath ( { ...query , name : tenantName } ) : undefined ;
5863
59- return [ ...getClusterBreadcrumbs ( options , query ) , { text, link, icon : databaseIcon } ] ;
64+ return [ ...getClusterBreadcrumbs ( options , query ) , { text, link, icon : < DatabaseIcon /> } ] ;
6065} ;
6166
6267const getNodeBreadcrumbs = ( options : NodeBreadcrumbsOptions , query = { } ) : RawBreadcrumbItem [ ] => {
@@ -81,8 +86,13 @@ const getNodeBreadcrumbs = (options: NodeBreadcrumbsOptions, query = {}): RawBre
8186
8287 const text = nodeId ? `Node ${ nodeId } ` : 'Node' ;
8388 const link = nodeId ? getDefaultNodePath ( nodeId , query ) : undefined ;
89+ const icon = isStorageNode ? < StorageNodeIcon /> : < ComputeNodeIcon /> ;
8490
85- breadcrumbs . push ( { text, link} ) ;
91+ breadcrumbs . push ( {
92+ text,
93+ link,
94+ icon,
95+ } ) ;
8696
8797 return breadcrumbs ;
8898} ;
@@ -123,12 +133,13 @@ const getTabletBreadcrubms = (
123133 options : TabletBreadcrumbsOptions ,
124134 query = { } ,
125135) : RawBreadcrumbItem [ ] => {
126- const { tabletId} = options ;
136+ const { tabletId, tabletType } = options ;
127137
128138 const breadcrumbs = getTabletsBreadcrubms ( options , query ) ;
129139
130140 breadcrumbs . push ( {
131141 text : tabletId || 'Tablet' ,
142+ icon : < TabletIcon text = { getTabletLabel ( tabletType ) } /> ,
132143 } ) ;
133144
134145 return breadcrumbs ;
0 commit comments