Skip to content

Commit d909ed2

Browse files
moshloopadityathebe
authored andcommitted
feat(ui): add swimlane view for config changes
Replace scatter-plot timeline with a hand-rolled swimlane that scales to many configs and bursty change patterns: - Hierarchical grouping by config name prefix with collapse/expand - Sticky header row and resizable resource column (150-500px) - Bucket-based anti-overlap rendering using flex-wrap - Severity badges with multi-change counts and filtered tooltips - Pre-range indicator (gray dot in-range, ↩ badge for pre-range) - Infinite scroll via useGetAllConfigsChangesInfiniteQuery (200/page) - URL-param backed Table/Graph toggle (?view=) - Live tail remains, scoped to Table view Adds ConfigChangesSwimlane plus Legend, Tooltip, and Utils components with unit and integration test coverage backed by a real HAR fixture.
1 parent a996a6b commit d909ed2

13 files changed

Lines changed: 7187 additions & 71 deletions

src/api/query-hooks/useConfigChangesHooks.ts

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { useConfigChangesArbitraryFilters } from "@flanksource-ui/hooks/useConfi
44
import useReactTablePaginationState from "@flanksource-ui/ui/DataTable/Hooks/useReactTablePaginationState";
55
import useReactTableSortState from "@flanksource-ui/ui/DataTable/Hooks/useReactTableSortState";
66
import useTimeRangeParams from "@flanksource-ui/ui/Dates/TimeRangePicker/useTimeRangeParams";
7-
import { UseQueryOptions, useQuery } from "@tanstack/react-query";
7+
import {
8+
UseQueryOptions,
9+
useInfiniteQuery,
10+
useQuery
11+
} from "@tanstack/react-query";
812
import { useMemo } from "react";
913
import { useParams } from "react-router-dom";
1014
import { usePrefixedSearchParams } from "@flanksource-ui/hooks/usePrefixedSearchParams";
@@ -167,3 +171,56 @@ export function useGetConfigChangesByIDQuery(
167171
...queryOptions
168172
});
169173
}
174+
175+
export function useGetAllConfigsChangesInfiniteQuery({
176+
pageSize = 200,
177+
paramPrefix
178+
}: {
179+
pageSize?: number;
180+
paramPrefix?: string;
181+
} = {}) {
182+
const showChangesFromDeletedConfigs = useShowDeletedConfigs();
183+
const { timeRangeValue } = useTimeRangeParams(
184+
configChangesDefaultDateFilter,
185+
paramPrefix
186+
);
187+
const [params] = usePrefixedSearchParams(paramPrefix, false, {
188+
sortBy: "created_at",
189+
sortDirection: "desc"
190+
});
191+
const changeType = params.get("changeType") ?? undefined;
192+
const severity = params.get("severity") ?? undefined;
193+
const configType = params.get("configType") ?? undefined;
194+
const from = timeRangeValue?.from ?? undefined;
195+
const to = timeRangeValue?.to ?? undefined;
196+
const [sortBy] = useReactTableSortState({ paramPrefix });
197+
const configTypes = params.get("configTypes") ?? "all";
198+
const tags = useConfigChangesTagsFilter(paramPrefix);
199+
const arbitraryFilter = useConfigChangesArbitraryFilters(paramPrefix);
200+
201+
const filterProps = {
202+
include_deleted_configs: showChangesFromDeletedConfigs,
203+
changeType,
204+
severity,
205+
from,
206+
to,
207+
configTypes,
208+
configType,
209+
sortBy: sortBy[0]?.id,
210+
sortOrder: (sortBy[0]?.desc ? "desc" : "asc") as "asc" | "desc",
211+
pageSize,
212+
arbitraryFilter,
213+
tags
214+
};
215+
216+
return useInfiniteQuery({
217+
queryKey: ["configs", "changes", "infinite", filterProps],
218+
queryFn: ({ pageParam = 0 }) =>
219+
getConfigsChanges({ ...filterProps, pageIndex: pageParam }),
220+
getNextPageParam: (lastPage, allPages) =>
221+
lastPage.changes && lastPage.changes.length < pageSize
222+
? undefined
223+
: allPages.length,
224+
keepPreviousData: true
225+
});
226+
}

0 commit comments

Comments
 (0)