Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/containers/Header/breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ import {TenantTabsGroups, getTenantPath} from '../Tenant/TenantPages';

import {headerKeyset} from './i18n';

const prepareTenantName = (tenantName: string) => {
return tenantName.startsWith('/') ? tenantName.slice(1) : tenantName;
};

export interface RawBreadcrumbItem {
text: string;
link?: string;
Expand Down Expand Up @@ -66,7 +62,7 @@ const getTenantBreadcrumbs: GetBreadcrumbs<TenantBreadcrumbsOptions> = (options,

const breadcrumbs = getClusterBreadcrumbs(options, query);

const text = tenantName ? prepareTenantName(tenantName) : headerKeyset('breadcrumbs.tenant');
const text = tenantName ? tenantName : headerKeyset('breadcrumbs.tenant');
const link = tenantName ? getTenantPath({...query, database: tenantName}) : undefined;

const lastItem = {text, link, icon: <DatabaseIcon />};
Expand Down
12 changes: 10 additions & 2 deletions src/containers/Tenant/ObjectSummary/ObjectTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ interface ObjectTreeProps {
path?: string;
}

function prepareSchemaRootName(name: string | undefined, fallback: string): string {
if (name) {
return name.startsWith('/') ? name : `/${name}`;
}

return fallback.startsWith('/') ? fallback : `/${fallback}`;
}

export function ObjectTree({tenantName, path}: ObjectTreeProps) {
const {data: tenantData = {}, isLoading} = useGetSchemaQuery({
path: tenantName,
Expand All @@ -38,8 +46,8 @@ export function ObjectTree({tenantName, path}: ObjectTreeProps) {
<SchemaTree
rootPath={tenantName}
// for the root pathData.Name contains the same string as tenantName,
// but without the leading slash
rootName={pathData.Name || tenantName}
// but without the leading slash - ensure it has one
rootName={prepareSchemaRootName(pathData.Name, tenantName)}
rootType={pathData.PathType}
currentPath={path}
onActivePathUpdate={setCurrentPath}
Expand Down
Loading