Hide empty target pools and alert groups by default (#16341)

Also change the SD page setting for this to be in localStorage, as on the
other pages.

Should help a tiny bit with https://github.com/prometheus/prometheus/issues/16308

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2025-03-28 17:55:37 +01:00 committed by GitHub
parent e7b1584b6a
commit a4728fd030
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 8 deletions

View File

@ -164,7 +164,7 @@ export default function AlertsPage() {
const [debouncedSearch] = useDebouncedValue<string>(searchFilter.trim(), 250); const [debouncedSearch] = useDebouncedValue<string>(searchFilter.trim(), 250);
const [showEmptyGroups, setShowEmptyGroups] = useLocalStorage<boolean>({ const [showEmptyGroups, setShowEmptyGroups] = useLocalStorage<boolean>({
key: "alertsPage.showEmptyGroups", key: "alertsPage.showEmptyGroups",
defaultValue: true, defaultValue: false,
}); });
const { alertGroupsPerPage } = useSettings(); const { alertGroupsPerPage } = useSettings();

View File

@ -25,9 +25,8 @@ import {
} from "../../state/serviceDiscoveryPageSlice"; } from "../../state/serviceDiscoveryPageSlice";
import CustomInfiniteScroll from "../../components/CustomInfiniteScroll"; import CustomInfiniteScroll from "../../components/CustomInfiniteScroll";
import { useDebouncedValue } from "@mantine/hooks"; import { useDebouncedValue, useLocalStorage } from "@mantine/hooks";
import { targetPoolDisplayLimit } from "./ServiceDiscoveryPage"; import { targetPoolDisplayLimit } from "./ServiceDiscoveryPage";
import { BooleanParam, useQueryParam, withDefault } from "use-query-params";
import { LabelBadges } from "../../components/LabelBadges"; import { LabelBadges } from "../../components/LabelBadges";
type TargetLabels = { type TargetLabels = {
@ -154,10 +153,10 @@ const ScrapePoolList: FC<ScrapePoolListProp> = ({
searchFilter, searchFilter,
}) => { }) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [showEmptyPools, setShowEmptyPools] = useQueryParam( const [showEmptyPools, setShowEmptyPools] = useLocalStorage<boolean>({
"showEmptyPools", key: "serviceDiscoveryPage.showEmptyPools",
withDefault(BooleanParam, true) defaultValue: false,
); });
// Based on the selected pool (if any), load the list of targets. // Based on the selected pool (if any), load the list of targets.
const { const {

View File

@ -167,7 +167,7 @@ const ScrapePoolList: FC<ScrapePoolListProp> = ({
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [showEmptyPools, setShowEmptyPools] = useLocalStorage<boolean>({ const [showEmptyPools, setShowEmptyPools] = useLocalStorage<boolean>({
key: "targetsPage.showEmptyPools", key: "targetsPage.showEmptyPools",
defaultValue: true, defaultValue: false,
}); });
const { collapsedPools, showLimitAlert } = useAppSelector( const { collapsedPools, showLimitAlert } = useAppSelector(