mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 14:17:12 +02:00
mantine-ui: add query info warnings display to graph view
Followup of https://github.com/prometheus/prometheus/pull/16753 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This commit is contained in:
parent
76a97ca273
commit
7f2946ccdd
@ -85,17 +85,31 @@ const Graph: FC<GraphProps> = ({
|
||||
} | null>(null);
|
||||
|
||||
// Helper function to render warnings.
|
||||
const renderWarnings = (warnings?: string[]) => {
|
||||
return warnings?.map((w, idx) => (
|
||||
<Alert
|
||||
key={idx}
|
||||
color="red"
|
||||
title="Query warning"
|
||||
icon={<IconAlertTriangle />}
|
||||
>
|
||||
{w}
|
||||
</Alert>
|
||||
));
|
||||
const renderAlerts = (warnings?: string[], infos?: string[]) => {
|
||||
return (
|
||||
<>
|
||||
{warnings?.map((w, idx) => (
|
||||
<Alert
|
||||
key={idx}
|
||||
color="red"
|
||||
title="Query warning"
|
||||
icon={<IconAlertTriangle />}
|
||||
>
|
||||
{w}
|
||||
</Alert>
|
||||
))}
|
||||
{infos?.map((w, idx) => (
|
||||
<Alert
|
||||
key={idx}
|
||||
color="yellow"
|
||||
title="Query notice"
|
||||
icon={<IconInfoCircle />}
|
||||
>
|
||||
{w}
|
||||
</Alert>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@ -166,7 +180,7 @@ const Graph: FC<GraphProps> = ({
|
||||
<Alert title="Empty query result" icon={<IconInfoCircle />}>
|
||||
This query returned no data.
|
||||
</Alert>
|
||||
{renderWarnings(dataAndRange.data.warnings)}
|
||||
{renderAlerts(dataAndRange.data.warnings)}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@ -183,7 +197,7 @@ const Graph: FC<GraphProps> = ({
|
||||
graphing the equivalent instant vector selector instead.
|
||||
</Alert>
|
||||
)}
|
||||
{renderWarnings(dataAndRange.data.warnings)}
|
||||
{renderAlerts(dataAndRange.data.warnings, dataAndRange.data.infos)}
|
||||
<Box pos="relative" ref={ref} className={classes.chartWrapper}>
|
||||
<LoadingOverlay
|
||||
visible={isFetching}
|
||||
|
Loading…
Reference in New Issue
Block a user