File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,6 @@ import {TenantTabsGroups, getTenantPath} from '../Tenant/TenantPages';
3030
3131import { headerKeyset } from './i18n' ;
3232
33- const prepareTenantName = ( tenantName : string ) => {
34- return tenantName . startsWith ( '/' ) ? tenantName . slice ( 1 ) : tenantName ;
35- } ;
36-
3733export interface RawBreadcrumbItem {
3834 text : string ;
3935 link ?: string ;
@@ -66,7 +62,7 @@ const getTenantBreadcrumbs: GetBreadcrumbs<TenantBreadcrumbsOptions> = (options,
6662
6763 const breadcrumbs = getClusterBreadcrumbs ( options , query ) ;
6864
69- const text = tenantName ? prepareTenantName ( tenantName ) : headerKeyset ( 'breadcrumbs.tenant' ) ;
65+ const text = tenantName || headerKeyset ( 'breadcrumbs.tenant' ) ;
7066 const link = tenantName ? getTenantPath ( { ...query , database : tenantName } ) : undefined ;
7167
7268 const lastItem = { text, link, icon : < DatabaseIcon /> } ;
Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ interface ObjectTreeProps {
1212 path ?: string ;
1313}
1414
15+ function prepareSchemaRootName ( name : string | undefined , fallback : string ) : string {
16+ if ( name ) {
17+ return name . startsWith ( '/' ) ? name : `/${ name } ` ;
18+ }
19+
20+ return fallback . startsWith ( '/' ) ? fallback : `/${ fallback } ` ;
21+ }
22+
1523export function ObjectTree ( { tenantName, path} : ObjectTreeProps ) {
1624 const { data : tenantData = { } , isLoading} = useGetSchemaQuery ( {
1725 path : tenantName ,
@@ -38,8 +46,8 @@ export function ObjectTree({tenantName, path}: ObjectTreeProps) {
3846 < SchemaTree
3947 rootPath = { tenantName }
4048 // for the root pathData.Name contains the same string as tenantName,
41- // but without the leading slash
42- rootName = { pathData . Name || tenantName }
49+ // ensure it has the leading slash
50+ rootName = { prepareSchemaRootName ( pathData . Name , tenantName ) }
4351 rootType = { pathData . PathType }
4452 currentPath = { path }
4553 onActivePathUpdate = { setCurrentPath }
You can’t perform that action at this time.
0 commit comments