Skip to content

fix: fix slashes everywhere #2244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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 || 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}
// ensure it has the leading slash
rootName={prepareSchemaRootName(pathData.Name, tenantName)}
rootType={pathData.PathType}
currentPath={path}
onActivePathUpdate={setCurrentPath}
Expand Down
Loading