File tree 2 files changed +11
-7
lines changed
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';
30
30
31
31
import { headerKeyset } from './i18n' ;
32
32
33
- const prepareTenantName = ( tenantName : string ) => {
34
- return tenantName . startsWith ( '/' ) ? tenantName . slice ( 1 ) : tenantName ;
35
- } ;
36
-
37
33
export interface RawBreadcrumbItem {
38
34
text : string ;
39
35
link ?: string ;
@@ -66,7 +62,7 @@ const getTenantBreadcrumbs: GetBreadcrumbs<TenantBreadcrumbsOptions> = (options,
66
62
67
63
const breadcrumbs = getClusterBreadcrumbs ( options , query ) ;
68
64
69
- const text = tenantName ? prepareTenantName ( tenantName ) : headerKeyset ( 'breadcrumbs.tenant' ) ;
65
+ const text = tenantName || headerKeyset ( 'breadcrumbs.tenant' ) ;
70
66
const link = tenantName ? getTenantPath ( { ...query , database : tenantName } ) : undefined ;
71
67
72
68
const lastItem = { text, link, icon : < DatabaseIcon /> } ;
Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ interface ObjectTreeProps {
12
12
path ?: string ;
13
13
}
14
14
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
+
15
23
export function ObjectTree ( { tenantName, path} : ObjectTreeProps ) {
16
24
const { data : tenantData = { } , isLoading} = useGetSchemaQuery ( {
17
25
path : tenantName ,
@@ -38,8 +46,8 @@ export function ObjectTree({tenantName, path}: ObjectTreeProps) {
38
46
< SchemaTree
39
47
rootPath = { tenantName }
40
48
// 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 ) }
43
51
rootType = { pathData . PathType }
44
52
currentPath = { path }
45
53
onActivePathUpdate = { setCurrentPath }
You can’t perform that action at this time.
0 commit comments