Skip to content

Commit

Permalink
Add version mismatch alert to the UI (#22214)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikatrix committed May 14, 2024
1 parent c926865 commit 0dc50d0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ export const AlertConfigurations: FC = () => {

const configurationData = useMemo(
() =>
alertList.map((alert) => ({
...alert,
enabled: config?.find((item) => item.key === alert.key)?.enabled ?? true,
})),
alertList
.filter((alert) => !alert.hideConfiguration)
.map((alert) => ({
...alert,
enabled: config?.find((item) => item.key === alert.key)?.enabled ?? true,
})),
[config]
);

Expand Down
21 changes: 17 additions & 4 deletions yugabyted-ui/ui/src/features/clusters/details/alerts/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import { subMinutes } from "date-fns";
import { useEffect, useMemo, useState } from "react";
import { useLocalStorage } from "react-use";

type AlertListItem = {
readonly name: string;
readonly key: string;
readonly status: BadgeVariant;
readonly hideConfiguration?: boolean;
};

export const alertConfigurationsKey = "alert-configurations";

export const alertList = [
export const alertList: AlertListItem[] = [
{
name: "Cluster CPU utilization exceeded 90% for 5 min",
key: "cpu_90",
Expand Down Expand Up @@ -43,7 +50,13 @@ export const alertList = [
key: "insecure",
status: BadgeVariant.Warning,
},
] as const;
{
name: "Version mismatch",
key: "version mismatch",
status: BadgeVariant.Warning,
hideConfiguration: true
}
];

export type AlertConfiguration = {
key: string;
Expand All @@ -56,7 +69,7 @@ type CPUAlert = {
};

export const useFetchAlerts = (nodeHost: string) => {
const { data: upstreamAlerts, refetch: refetchUpstreamAlerts } =
const { data: upstreamAlerts, refetch: refetchUpstreamAlerts } =
useGetClusterAlertsQuery({ node_address: nodeHost });

return {
Expand Down Expand Up @@ -151,7 +164,7 @@ export const useAlerts = (nodeHost: string) => {
],
}; */

const { data: cpuAlerts, refetch: refetchCPUAlerts } =
const { data: cpuAlerts, refetch: refetchCPUAlerts } =
useCPUAlert(nodeHost === "" ? undefined : nodeHost);

const refetch = () => {
Expand Down

0 comments on commit 0dc50d0

Please sign in to comment.