Skip to content

Commit 06bfe55

Browse files
Copilotsteverydz
andauthored
revert: restore useSerialLogs in ModelNav to conditionally show serial log tab
Agent-Logs-Url: https://github.com/canonical/snapcraft.io/sessions/c7fb731a-5e18-4b26-86ce-7f9da93cf579 Co-authored-by: steverydz <501889+steverydz@users.noreply.github.com>
1 parent 849dc4e commit 06bfe55

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

  • static/js/publisher/layouts/ModelDetailsPageLayout

static/js/publisher/layouts/ModelDetailsPageLayout/ModelNav.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Link, useParams } from "react-router-dom";
22
import { useAtomValue } from "jotai";
33

4-
import { useRemodels } from "../../hooks";
4+
import { useRemodels, useSerialLogs } from "../../hooks";
55
import { brandIdState } from "../../state/brandStoreState";
66

77
function ModelNav({ sectionName }: { sectionName: string }): React.JSX.Element {
88
const { id, modelId } = useParams();
99
const brandId = useAtomValue(brandIdState);
1010
const { data: remodelsData } = useRemodels(brandId);
11+
const { data: serialLogsData } = useSerialLogs(brandId, modelId);
1112

1213
return (
1314
<nav className="p-tabs">
@@ -44,16 +45,18 @@ function ModelNav({ sectionName }: { sectionName: string }): React.JSX.Element {
4445
</Link>
4546
</li>
4647
)}
47-
<li className="p-tabs__item">
48-
<Link
49-
to={`/admin/${id}/models/${modelId}/serial-log`}
50-
className="p-tabs__link"
51-
aria-selected={sectionName === "serial-log"}
52-
role="tab"
53-
>
54-
Serial log
55-
</Link>
56-
</li>
48+
{serialLogsData?.success && (
49+
<li className="p-tabs__item">
50+
<Link
51+
to={`/admin/${id}/models/${modelId}/serial-log`}
52+
className="p-tabs__link"
53+
aria-selected={sectionName === "serial-log"}
54+
role="tab"
55+
>
56+
Serial log
57+
</Link>
58+
</li>
59+
)}
5760
</ul>
5861
</nav>
5962
);

0 commit comments

Comments
 (0)