mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-05 13:47:10 +02:00
Merge pull request #16567 from ryanwuer/optimize-target-pool-search-experience
UI: optimize pool searching in /targets page
This commit is contained in:
commit
ef430074f3
@ -12,7 +12,7 @@ import {
|
||||
IconSearch,
|
||||
} from "@tabler/icons-react";
|
||||
import { StateMultiSelect } from "../../components/StateMultiSelect";
|
||||
import { Suspense } from "react";
|
||||
import { Suspense, useState } from "react";
|
||||
import badgeClasses from "../../Badge.module.css";
|
||||
import { useAppDispatch, useAppSelector } from "../../state/hooks";
|
||||
import {
|
||||
@ -52,7 +52,11 @@ export default function TargetsPage() {
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const poolDefaultPlaceholder = "Select scrape pool";
|
||||
|
||||
const [scrapePool, setScrapePool] = useQueryParam("pool", StringParam);
|
||||
const [poolPlaceholder, setPoolPlaceholder] = useState<string>(poolDefaultPlaceholder);
|
||||
const [poolSelecting, setPoolSelecting] = useState<boolean>(false);
|
||||
const [healthFilter, setHealthFilter] = useQueryParam(
|
||||
"health",
|
||||
withDefault(ArrayParam, emptyHealthFilter)
|
||||
@ -86,15 +90,23 @@ export default function TargetsPage() {
|
||||
<>
|
||||
<Group mb="md" mt="xs">
|
||||
<Select
|
||||
placeholder="Select scrape pool"
|
||||
placeholder={poolPlaceholder}
|
||||
data={[{ label: "All pools", value: "" }, ...scrapePools]}
|
||||
value={(limited && scrapePools[0]) || scrapePool || null}
|
||||
value={poolSelecting ? null : (limited && scrapePools[0]) || scrapePool || null}
|
||||
onChange={(value) => {
|
||||
setScrapePool(value);
|
||||
if (showLimitAlert) {
|
||||
dispatch(setShowLimitAlert(false));
|
||||
}
|
||||
}}
|
||||
onDropdownOpen={() => {
|
||||
setPoolPlaceholder(scrapePool || poolDefaultPlaceholder)
|
||||
setPoolSelecting(true)
|
||||
}}
|
||||
onDropdownClose={() => {
|
||||
setPoolPlaceholder(poolDefaultPlaceholder)
|
||||
setPoolSelecting(false)
|
||||
}}
|
||||
searchable
|
||||
/>
|
||||
<StateMultiSelect
|
||||
|
Loading…
Reference in New Issue
Block a user