Merge pull request #15807 from leonnicolas/hide-empty-rules-persitence

Make "hide empty rules" persistent
pull/15540/head
Julius Volz 2025-01-20 15:26:13 +01:00 committed by GitHub
commit 32d306854b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -23,10 +23,10 @@ import { Fragment, useEffect, useMemo } from "react";
import { StateMultiSelect } from "../components/StateMultiSelect";
import { IconInfoCircle, IconSearch } from "@tabler/icons-react";
import { LabelBadges } from "../components/LabelBadges";
import { useLocalStorage } from "@mantine/hooks";
import { useSettings } from "../state/settingsSlice";
import {
ArrayParam,
BooleanParam,
NumberParam,
StringParam,
useQueryParam,
@ -162,10 +162,10 @@ export default function AlertsPage() {
withDefault(StringParam, "")
);
const [debouncedSearch] = useDebouncedValue<string>(searchFilter.trim(), 250);
const [showEmptyGroups, setShowEmptyGroups] = useQueryParam(
"showEmptyGroups",
withDefault(BooleanParam, true)
);
const [showEmptyGroups, setShowEmptyGroups] = useLocalStorage<boolean>({
key: "alertsPage.showEmptyGroups",
defaultValue: true,
});
const { alertGroupsPerPage } = useSettings();
const [activePage, setActivePage] = useQueryParam(

View File

@ -25,6 +25,7 @@ import {
humanizeDuration,
now,
} from "../../lib/formatTime";
import { useLocalStorage } from "@mantine/hooks";
import { useAppDispatch, useAppSelector } from "../../state/hooks";
import {
setCollapsedPools,
@ -38,7 +39,6 @@ import panelClasses from "../../Panel.module.css";
import TargetLabels from "./TargetLabels";
import { useDebouncedValue } from "@mantine/hooks";
import { targetPoolDisplayLimit } from "./TargetsPage";
import { BooleanParam, useQueryParam, withDefault } from "use-query-params";
import { badgeIconStyle } from "../../styles";
type ScrapePool = {
@ -165,10 +165,10 @@ const ScrapePoolList: FC<ScrapePoolListProp> = ({
});
const dispatch = useAppDispatch();
const [showEmptyPools, setShowEmptyPools] = useQueryParam(
"showEmptyPools",
withDefault(BooleanParam, true)
);
const [showEmptyPools, setShowEmptyPools] = useLocalStorage<boolean>({
key: "targetsPage.showEmptyPools",
defaultValue: true,
});
const { collapsedPools, showLimitAlert } = useAppSelector(
(state) => state.targetsPage