Skip to content

Commit ddb4cef

Browse files
committed
fix: fix missing breadcrumbs for catalog changes tab
Fixes #2350
1 parent 85092ae commit ddb4cef

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

src/components/Configs/Changes/ConfigChangesFilters/ConfigChangesFilters.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function ConfigChangeFilters({
7777

7878
const arbitraryFilters = useConfigChangesArbitraryFilters();
7979

80-
const configType = params.get("configTypes") ?? undefined;
80+
const configType = params.get("configType") ?? undefined;
8181

8282
const defaultConfigType = useMemo(() => {
8383
return configType ? `${configType?.replaceAll("::", "__")}:1` : undefined;
@@ -86,7 +86,7 @@ export function ConfigChangeFilters({
8686
return (
8787
<div className="flex w-full flex-col gap-2">
8888
<FormikFilterForm
89-
paramsToReset={paramsToReset}
89+
paramsToReset={[...paramsToReset, "configType"]}
9090
filterFields={["configTypes", "changeType", "severity", "tags"]}
9191
defaultFieldValues={{
9292
...(configType && { configTypes: defaultConfigType })

src/components/Configs/ConfigPageTabs.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1+
import TabbedLinks from "@flanksource-ui/ui/Tabs/TabbedLinks";
12
import { useMemo } from "react";
23
import { useSearchParams } from "react-router-dom";
3-
import TabbedLinks from "../../ui/Tabs/TabbedLinks";
44

55
type ConfigPageTabsProps = {
66
activeTab: string;
77
children: React.ReactNode;
8+
configType?: string;
89
};
910

1011
export default function ConfigPageTabs({
1112
activeTab,
12-
children
13+
children,
14+
configType
1315
}: ConfigPageTabsProps) {
1416
const [searchParams] = useSearchParams();
15-
16-
const type = searchParams.get("configType") ?? undefined;
17-
17+
const type = searchParams.get("configType") ?? configType;
1818
const configTabsLists = useMemo(() => {
1919
const query = type ? `?configType=${type}` : "";
2020
return [

src/pages/config/ConfigChangesPage.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useGetAllConfigsChangesQuery } from "@flanksource-ui/api/query-hooks/us
22
import { ConfigChangeTable } from "@flanksource-ui/components/Configs/Changes/ConfigChangeTable";
33
import { ConfigChangeFilters } from "@flanksource-ui/components/Configs/Changes/ConfigChangesFilters/ConfigChangesFilters";
44
import ConfigPageTabs from "@flanksource-ui/components/Configs/ConfigPageTabs";
5+
import ConfigsTypeIcon from "@flanksource-ui/components/Configs/ConfigsTypeIcon";
56
import { InfoMessage } from "@flanksource-ui/components/InfoMessage";
67
import {
78
BreadcrumbChild,
@@ -20,6 +21,14 @@ export function ConfigChangesPage() {
2021
);
2122
const [params] = useSearchParams({});
2223

24+
const configTypes = params.get("configTypes") ?? undefined;
25+
const configType =
26+
// we want to show breadcrumb only if there is only one config type selected
27+
// in the filter dropdown and not multiple
28+
configTypes?.split(",").length === 1
29+
? configTypes.split(",")[0]?.split(":")?.[0].split("__").join("::")
30+
: undefined;
31+
2332
const pageSize = params.get("pageSize") ?? "200";
2433

2534
const { data, isLoading, error, isRefetching, refetch } =
@@ -59,7 +68,21 @@ export function ConfigChangesPage() {
5968
key="config-catalog-changes"
6069
>
6170
Changes
62-
</BreadcrumbChild>
71+
</BreadcrumbChild>,
72+
...(configType
73+
? [
74+
<BreadcrumbChild
75+
link={`/catalog?configType=${configType}`}
76+
key={configType}
77+
>
78+
<ConfigsTypeIcon
79+
config={{ type: configType }}
80+
showSecondaryIcon
81+
showLabel
82+
/>
83+
</BreadcrumbChild>
84+
]
85+
: [])
6386
]}
6487
/>
6588
}
@@ -70,7 +93,7 @@ export function ConfigChangesPage() {
7093
loading={isLoading || isRefetching}
7194
contentClass="p-0 h-full flex flex-col flex-1"
7295
>
73-
<ConfigPageTabs activeTab="Changes">
96+
<ConfigPageTabs activeTab="Changes" configType={configType}>
7497
{error ? (
7598
<InfoMessage message={errorMessage} />
7699
) : (

0 commit comments

Comments
 (0)