Skip to content

Commit

Permalink
WIP - better page display names
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed Nov 6, 2023
1 parent c1c0d84 commit 177cdff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions pkg/storaged/pages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,14 @@ export const Container = ({ container }) => {
return <container.component container={container} {...container.props} />;
};

function page_display_name(page) {
export function page_display_name(page) {
let name = page.name;
if (page.container && page.container.id_extra)
name = name + " - " + page.container.id_extra;
let cont = page.container;
while (cont) {
if (cont.id_extra)
name = name + " - " + cont.id_extra;
cont = cont.parent;
}
return name;
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/storaged/storage-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import cockpit from "cockpit";
import React from "react";
import client from "./client";

import { get_page_from_location } from "./pages.jsx";
import { get_page_from_location, page_display_name } from "./pages.jsx";

import { Stack, StackItem } from "@patternfly/react-core/dist/esm/layouts/Stack/index.js";
import { Page, PageBreadcrumb, PageSection } from "@patternfly/react-core/dist/esm/components/Page/index.js";
Expand All @@ -39,7 +39,7 @@ export const StoragePage = ({ location, plot_state }) => {
while (pp) {
parent_crumbs.unshift(
<BreadcrumbItem key={pp.name} to={"#" + cockpit.location.encode(pp.location)}>
{pp.name}
{page_display_name(pp)}
</BreadcrumbItem>
);
pp = pp.parent;
Expand All @@ -50,7 +50,7 @@ export const StoragePage = ({ location, plot_state }) => {
<PageBreadcrumb stickyOnBreakpoint={{ default: "top" }}>
<Breadcrumb>
{ parent_crumbs }
<BreadcrumbItem isActive>{page.name}</BreadcrumbItem>
<BreadcrumbItem isActive>{page_display_name(page)}</BreadcrumbItem>
</Breadcrumb>
</PageBreadcrumb>
<PageSection>
Expand Down

0 comments on commit 177cdff

Please sign in to comment.