@grafana/alerting
Version:
Grafana Alerting Library – Build vertical integrations on top of the industry-leading alerting solution
1,609 lines • 55 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var react = require('@reduxjs/toolkit/query/react');
var runtime = require('@grafana/runtime');
var jsxRuntime = require('react/jsx-runtime');
var lodash = require('lodash');
var ui = require('@grafana/ui');
var i18n = require('@grafana/i18n');
var css = require('@emotion/css');
var react$1 = require('react');
var tinycolor2 = require('tinycolor2');
var data = require('@grafana/data');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
var tinycolor2__default = /*#__PURE__*/_interopDefaultCompat(tinycolor2);
"use strict";
"use strict";
const getAPINamespace = () => runtime.config.namespace;
const getAPIBaseURL = (group, version) => {
const subPath = runtime.config.appSubUrl || "";
return `${subPath}/apis/${group}/${version}/namespaces/${getAPINamespace()}`;
};
const getAPIReducerPath = (group, version) => `${group}/${version}`;
const isWellFormed = (str) => {
try {
encodeURIComponent(str);
return true;
} catch (error) {
return false;
}
};
const base64UrlEncode = (value) => {
if (!isWellFormed(value)) {
throw new Error(`Cannot encode malformed UTF-16 string with lone surrogates: ${value}`);
}
const bytes = new TextEncoder().encode(value);
const binString = String.fromCodePoint(...bytes);
const base64 = btoa(binString);
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
};
"use strict";
const VERSION$1 = "v0alpha1";
const GROUP$1 = "notifications.alerting.grafana.app";
"use strict";
const baseUrl$1 = getAPIBaseURL(GROUP$1, VERSION$1);
const reducerPath$1 = getAPIReducerPath(GROUP$1, VERSION$1);
const api$1 = react.createApi({
reducerPath: reducerPath$1,
baseQuery: react.fetchBaseQuery({
// Set URL correctly so MSW can intercept requests
// https://mswjs.io/docs/runbook#rtk-query-requests-are-not-intercepted
baseUrl: new URL(baseUrl$1, globalThis.location.origin).href
}),
endpoints: () => ({})
});
"use strict";
const addTagTypes$1 = ["API Discovery", "Receiver", "RoutingTree", "TemplateGroup", "TimeInterval"];
const injectedRtkApi$1 = api$1.enhanceEndpoints({
addTagTypes: addTagTypes$1
}).injectEndpoints({
endpoints: (build) => ({
getApiResources: build.query({
query: () => ({ url: `/apis/notifications.alerting.grafana.app/v0alpha1/` }),
providesTags: ["API Discovery"]
}),
listReceiver: build.query({
query: (queryArg) => ({
url: `/receivers`,
params: {
pretty: queryArg.pretty,
allowWatchBookmarks: queryArg.allowWatchBookmarks,
continue: queryArg["continue"],
fieldSelector: queryArg.fieldSelector,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds,
watch: queryArg.watch
}
}),
providesTags: ["Receiver"]
}),
createReceiver: build.mutation({
query: (queryArg) => ({
url: `/receivers`,
method: "POST",
body: queryArg.receiver,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["Receiver"]
}),
deletecollectionReceiver: build.mutation({
query: (queryArg) => ({
url: `/receivers`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
continue: queryArg["continue"],
dryRun: queryArg.dryRun,
fieldSelector: queryArg.fieldSelector,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds
}
}),
invalidatesTags: ["Receiver"]
}),
getReceiver: build.query({
query: (queryArg) => ({
url: `/receivers/${queryArg.name}`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["Receiver"]
}),
replaceReceiver: build.mutation({
query: (queryArg) => ({
url: `/receivers/${queryArg.name}`,
method: "PUT",
body: queryArg.receiver,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["Receiver"]
}),
deleteReceiver: build.mutation({
query: (queryArg) => ({
url: `/receivers/${queryArg.name}`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy
}
}),
invalidatesTags: ["Receiver"]
}),
updateReceiver: build.mutation({
query: (queryArg) => ({
url: `/receivers/${queryArg.name}`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["Receiver"]
}),
getReceiverStatus: build.query({
query: (queryArg) => ({
url: `/receivers/${queryArg.name}/status`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["Receiver"]
}),
replaceReceiverStatus: build.mutation({
query: (queryArg) => ({
url: `/receivers/${queryArg.name}/status`,
method: "PUT",
body: queryArg.receiver,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["Receiver"]
}),
updateReceiverStatus: build.mutation({
query: (queryArg) => ({
url: `/receivers/${queryArg.name}/status`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["Receiver"]
}),
listRoutingTree: build.query({
query: (queryArg) => ({
url: `/routingtrees`,
params: {
pretty: queryArg.pretty,
allowWatchBookmarks: queryArg.allowWatchBookmarks,
continue: queryArg["continue"],
fieldSelector: queryArg.fieldSelector,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds,
watch: queryArg.watch
}
}),
providesTags: ["RoutingTree"]
}),
createRoutingTree: build.mutation({
query: (queryArg) => ({
url: `/routingtrees`,
method: "POST",
body: queryArg.routingTree,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["RoutingTree"]
}),
deletecollectionRoutingTree: build.mutation({
query: (queryArg) => ({
url: `/routingtrees`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
continue: queryArg["continue"],
dryRun: queryArg.dryRun,
fieldSelector: queryArg.fieldSelector,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds
}
}),
invalidatesTags: ["RoutingTree"]
}),
getRoutingTree: build.query({
query: (queryArg) => ({
url: `/routingtrees/${queryArg.name}`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["RoutingTree"]
}),
replaceRoutingTree: build.mutation({
query: (queryArg) => ({
url: `/routingtrees/${queryArg.name}`,
method: "PUT",
body: queryArg.routingTree,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["RoutingTree"]
}),
deleteRoutingTree: build.mutation({
query: (queryArg) => ({
url: `/routingtrees/${queryArg.name}`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy
}
}),
invalidatesTags: ["RoutingTree"]
}),
updateRoutingTree: build.mutation({
query: (queryArg) => ({
url: `/routingtrees/${queryArg.name}`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["RoutingTree"]
}),
getRoutingTreeStatus: build.query({
query: (queryArg) => ({
url: `/routingtrees/${queryArg.name}/status`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["RoutingTree"]
}),
replaceRoutingTreeStatus: build.mutation({
query: (queryArg) => ({
url: `/routingtrees/${queryArg.name}/status`,
method: "PUT",
body: queryArg.routingTree,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["RoutingTree"]
}),
updateRoutingTreeStatus: build.mutation({
query: (queryArg) => ({
url: `/routingtrees/${queryArg.name}/status`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["RoutingTree"]
}),
listTemplateGroup: build.query({
query: (queryArg) => ({
url: `/templategroups`,
params: {
pretty: queryArg.pretty,
allowWatchBookmarks: queryArg.allowWatchBookmarks,
continue: queryArg["continue"],
fieldSelector: queryArg.fieldSelector,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds,
watch: queryArg.watch
}
}),
providesTags: ["TemplateGroup"]
}),
createTemplateGroup: build.mutation({
query: (queryArg) => ({
url: `/templategroups`,
method: "POST",
body: queryArg.templateGroup,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["TemplateGroup"]
}),
deletecollectionTemplateGroup: build.mutation({
query: (queryArg) => ({
url: `/templategroups`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
continue: queryArg["continue"],
dryRun: queryArg.dryRun,
fieldSelector: queryArg.fieldSelector,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds
}
}),
invalidatesTags: ["TemplateGroup"]
}),
getTemplateGroup: build.query({
query: (queryArg) => ({
url: `/templategroups/${queryArg.name}`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["TemplateGroup"]
}),
replaceTemplateGroup: build.mutation({
query: (queryArg) => ({
url: `/templategroups/${queryArg.name}`,
method: "PUT",
body: queryArg.templateGroup,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["TemplateGroup"]
}),
deleteTemplateGroup: build.mutation({
query: (queryArg) => ({
url: `/templategroups/${queryArg.name}`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy
}
}),
invalidatesTags: ["TemplateGroup"]
}),
updateTemplateGroup: build.mutation({
query: (queryArg) => ({
url: `/templategroups/${queryArg.name}`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["TemplateGroup"]
}),
getTemplateGroupStatus: build.query({
query: (queryArg) => ({
url: `/templategroups/${queryArg.name}/status`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["TemplateGroup"]
}),
replaceTemplateGroupStatus: build.mutation({
query: (queryArg) => ({
url: `/templategroups/${queryArg.name}/status`,
method: "PUT",
body: queryArg.templateGroup,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["TemplateGroup"]
}),
updateTemplateGroupStatus: build.mutation({
query: (queryArg) => ({
url: `/templategroups/${queryArg.name}/status`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["TemplateGroup"]
}),
listTimeInterval: build.query({
query: (queryArg) => ({
url: `/timeintervals`,
params: {
pretty: queryArg.pretty,
allowWatchBookmarks: queryArg.allowWatchBookmarks,
continue: queryArg["continue"],
fieldSelector: queryArg.fieldSelector,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds,
watch: queryArg.watch
}
}),
providesTags: ["TimeInterval"]
}),
createTimeInterval: build.mutation({
query: (queryArg) => ({
url: `/timeintervals`,
method: "POST",
body: queryArg.timeInterval,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["TimeInterval"]
}),
deletecollectionTimeInterval: build.mutation({
query: (queryArg) => ({
url: `/timeintervals`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
continue: queryArg["continue"],
dryRun: queryArg.dryRun,
fieldSelector: queryArg.fieldSelector,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds
}
}),
invalidatesTags: ["TimeInterval"]
}),
getTimeInterval: build.query({
query: (queryArg) => ({
url: `/timeintervals/${queryArg.name}`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["TimeInterval"]
}),
replaceTimeInterval: build.mutation({
query: (queryArg) => ({
url: `/timeintervals/${queryArg.name}`,
method: "PUT",
body: queryArg.timeInterval,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["TimeInterval"]
}),
deleteTimeInterval: build.mutation({
query: (queryArg) => ({
url: `/timeintervals/${queryArg.name}`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy
}
}),
invalidatesTags: ["TimeInterval"]
}),
updateTimeInterval: build.mutation({
query: (queryArg) => ({
url: `/timeintervals/${queryArg.name}`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["TimeInterval"]
}),
getTimeIntervalStatus: build.query({
query: (queryArg) => ({
url: `/timeintervals/${queryArg.name}/status`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["TimeInterval"]
}),
replaceTimeIntervalStatus: build.mutation({
query: (queryArg) => ({
url: `/timeintervals/${queryArg.name}/status`,
method: "PUT",
body: queryArg.timeInterval,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["TimeInterval"]
}),
updateTimeIntervalStatus: build.mutation({
query: (queryArg) => ({
url: `/timeintervals/${queryArg.name}/status`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["TimeInterval"]
})
}),
overrideExisting: false
});
"use strict";
function useListContactPoints(queryArgs = {}, queryOptions = {}) {
return injectedRtkApi$1.useListReceiverQuery(queryArgs, queryOptions);
}
function useCreateContactPoint(options) {
const [updateFn, result] = injectedRtkApi$1.endpoints.createReceiver.useMutation(options);
const typedUpdateFn = (args) => {
const response = updateFn(args);
return response;
};
return [typedUpdateFn, result];
}
"use strict";
function getContactPointDescription(contactPoint) {
if (lodash.isEmpty(contactPoint.spec.integrations)) {
return "<empty contact point>";
}
const integrationCounts = lodash.countBy(contactPoint.spec.integrations, (integration) => integration.type);
const description = Object.entries(integrationCounts).map(([type, count]) => {
return count > 1 ? `${type} (${count})` : type;
}).join(", ");
return description;
}
"use strict";
const collator = new Intl.Collator("en", { sensitivity: "accent" });
function ContactPointSelector(props) {
const { currentData: contactPoints, isLoading } = useListContactPoints(
{},
{ refetchOnFocus: true, refetchOnMountOrArgChange: true }
);
const contactPointOptions = lodash.chain(contactPoints == null ? void 0 : contactPoints.items).toArray().map((contactPoint) => {
var _a;
return {
option: {
label: contactPoint.spec.title,
value: (_a = contactPoint.metadata.uid) != null ? _a : contactPoint.spec.title,
description: getContactPointDescription(contactPoint)
},
contactPoint
};
}).value().sort((a, b) => collator.compare(a.option.label, b.option.label));
const options = contactPointOptions.map((item) => item.option);
const handleChange = (selectedOption) => {
if (selectedOption == null && props.isClearable) {
props.onChange(null);
return;
}
if (selectedOption) {
const matchedOption = contactPointOptions.find(({ option }) => option.value === selectedOption.value);
if (!matchedOption) {
return;
}
props.onChange(matchedOption.contactPoint);
}
};
return /* @__PURE__ */ jsxRuntime.jsx(ui.Combobox, { ...props, loading: isLoading, options, onChange: handleChange });
}
"use strict";
const StateDot = ({ color }) => {
const styles = ui.useStyles2(getDotStyles, { color });
return /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { direction: "row", gap: 0.5, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.dot }) });
};
const getDotStyles = (theme, { color }) => {
const size = theme.spacing(1.25);
const outlineSize = `calc(${size} / 2.5)`;
const errorStyle = color === "error";
const successStyle = color === "success";
const warningStyle = color === "warning";
return {
dot: css.css(
{
width: size,
height: size,
borderRadius: theme.shape.radius.circle,
backgroundColor: theme.colors.secondary.shade,
outline: `solid ${outlineSize} ${theme.colors.secondary.transparent}`,
margin: outlineSize
},
successStyle && css.css({
backgroundColor: theme.colors.success.main,
outlineColor: theme.colors.success.transparent
}),
warningStyle && css.css({
backgroundColor: theme.colors.warning.main,
outlineColor: theme.colors.warning.transparent
}),
errorStyle && css.css({
backgroundColor: theme.colors.error.main,
outlineColor: theme.colors.error.transparent
})
)
};
};
"use strict";
const StateText = ({ state, health, type = "alerting", isPaused = false }) => {
if (isPaused) {
return /* @__PURE__ */ jsxRuntime.jsx(PausedText, {});
}
let stateLabel;
let color;
switch (state) {
case "normal":
color = "success";
stateLabel = "Normal";
break;
case "firing":
color = "error";
stateLabel = "Firing";
break;
case "pending":
color = "warning";
stateLabel = "Pending";
break;
case "recovering":
color = "warning";
stateLabel = "Recovering";
break;
case "unknown":
default:
color = "unknown";
stateLabel = "Unknown";
break;
}
if (health === "error") {
color = "error";
stateLabel = "Error";
}
if (health === "nodata") {
color = "warning";
stateLabel = "No data";
}
if (type === "recording") {
const text = health === "error" ? "Recording error" : "Recording";
const color2 = health === "error" ? "error" : "success";
return /* @__PURE__ */ jsxRuntime.jsx(InnerText, { color: color2, text });
}
return /* @__PURE__ */ jsxRuntime.jsx(InnerText, { color, text: stateLabel });
};
function InnerText({ color, text }) {
const textColor = color === "unknown" ? "secondary" : color;
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { direction: "row", gap: 0.5, wrap: "nowrap", flex: "0 0 auto", alignItems: "center", children: [
/* @__PURE__ */ jsxRuntime.jsx(StateDot, { color }),
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { variant: "bodySmall", color: textColor, children: text })
] });
}
function PausedText() {
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { variant: "bodySmall", color: "warning", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { direction: "row", gap: 0.5, wrap: "nowrap", flex: "0 0 auto", alignItems: "center", children: [
/* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "pause", size: "xs" }),
/* @__PURE__ */ jsxRuntime.jsx(i18n.Trans, { i18nKey: "alerting.paused-badge.paused", children: "Paused" })
] }) });
}
"use strict";
const icons = {
normal: "check-circle",
pending: "circle",
recovering: "exclamation-circle",
firing: "exclamation-circle",
unknown: "question-circle"
};
const color = {
normal: "success",
pending: "warning",
recovering: "warning",
firing: "error",
unknown: "secondary"
};
const stateNames = {
normal: "Normal",
pending: "Pending",
firing: "Firing",
recovering: "Recovering",
unknown: "Unknown"
};
const operationIcons = {
creating: "plus-circle",
deleting: "minus-circle"
};
const ICON_SIZE = 15;
const StateIcon = react$1.memo(function StateIcon2({
state,
health,
type = "alerting",
isPaused = false,
operation
}) {
const styles = ui.useStyles2(getStyles$2);
const theme = ui.useTheme2();
let iconName = state ? icons[state] : "circle";
let iconColor = state ? color[state] : "secondary";
let stateName = state ? stateNames[state] : "unknown";
if (type === "recording") {
iconName = "record-audio";
iconColor = "success";
stateName = "Recording";
}
if (health === "nodata") {
iconName = "exclamation-triangle";
iconColor = "warning";
stateName = "Insufficient data";
}
if (health === "error") {
iconName = "times-circle";
iconColor = "error";
stateName = "Failed to evaluate rule";
}
if (isPaused) {
iconName = "pause-circle";
iconColor = "warning";
stateName = "Paused";
}
if (operation) {
iconName = operationIcons[operation];
iconColor = "secondary";
stateName = lodash.upperFirst(operation);
}
return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: stateName, placement: "right", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { color: iconColor, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.iconsContainer, children: [
/* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: iconName, width: ICON_SIZE, height: ICON_SIZE, "aria-label": stateName }),
operation && /* @__PURE__ */ jsxRuntime.jsx(
"svg",
{
width: ICON_SIZE,
height: ICON_SIZE,
viewBox: "0 0 20 20",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
className: styles.spinning,
children: /* @__PURE__ */ jsxRuntime.jsx(
"circle",
{
r: ICON_SIZE / 2,
cx: "10",
cy: "10",
stroke: theme.colors.background.primary,
strokeWidth: "2",
strokeLinecap: "round",
fill: "transparent",
strokeOpacity: 0.85,
strokeDasharray: "20px"
}
)
}
)
] }) }) }) });
});
const spin = css.keyframes({
"0%": {
transform: "rotate(0deg)"
},
"50%": {
transform: "rotate(180deg)"
},
"100%": {
transform: "rotate(360deg)"
}
});
const getStyles$2 = (theme) => ({
iconsContainer: css.css({
position: "relative",
width: ICON_SIZE,
height: ICON_SIZE,
"> *": {
position: "absolute"
}
}),
spinning: css.css({
[theme.transitions.handleMotion("no-preference")]: {
animationName: spin,
animationIterationCount: "infinite",
animationDuration: "1s",
animationTimingFunction: "linear"
}
})
});
"use strict";
const AlertLabel = (props) => {
const { labelKey, value, icon, color, colorBy, size = "md", onClick, ...rest } = props;
const theColor = getColorFromProps({ color, colorBy, labelKey, value });
const styles = ui.useStyles2(getStyles$1, theColor, size);
const ariaLabel = `${labelKey}: ${value}`;
const keyless = !Boolean(labelKey);
const innerLabel = react$1.useMemo(
() => /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { direction: "row", gap: 0, alignItems: "stretch", children: [
labelKey && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.label, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { direction: "row", gap: 0.5, alignItems: "center", children: [
icon && /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: icon }),
labelKey && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelText, title: labelKey.toString(), children: labelKey != null ? labelKey : "" })
] }) }),
/* @__PURE__ */ jsxRuntime.jsx("div", { className: css.cx(styles.value, keyless && styles.valueWithoutKey), title: value == null ? void 0 : value.toString(), children: value != null ? value : "-" })
] }),
[labelKey, styles.label, styles.labelText, styles.value, styles.valueWithoutKey, icon, keyless, value]
);
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.wrapper, "aria-label": ariaLabel, "data-testid": "label-value", ...rest, children: onClick && (labelKey || value) ? /* @__PURE__ */ jsxRuntime.jsx(
"button",
{
type: "button",
className: styles.clickable,
onClick: () => onClick == null ? void 0 : onClick([value != null ? value : "", labelKey != null ? labelKey : ""]),
children: innerLabel
},
`${labelKey != null ? labelKey : ""}${value != null ? value : ""}`
) : innerLabel });
};
function getAccessibleTagColor(name) {
if (!name) {
return;
}
const attempts = Array.from({ length: 6 }, (_, i) => name + "-".repeat(i));
const readableAttempt = attempts.find((attempt) => {
const candidate = ui.getTagColorsFromName(attempt).color;
return tinycolor2__default.default.isReadable(candidate, "#000", { level: "AA", size: "small" }) || tinycolor2__default.default.isReadable(candidate, "#fff", { level: "AA", size: "small" });
});
const chosen = readableAttempt != null ? readableAttempt : name;
return ui.getTagColorsFromName(chosen).color;
}
function getColorFromProps({
color,
colorBy,
labelKey,
value
}) {
if (color) {
return getAccessibleTagColor(color);
}
if (colorBy === "key") {
return getAccessibleTagColor(labelKey);
}
if (colorBy === "value") {
return getAccessibleTagColor(value);
}
if (colorBy === "both" && labelKey && value) {
return getAccessibleTagColor(labelKey + value);
}
return;
}
function getReadableFontColor(bg, fallback) {
if (tinycolor2__default.default.isReadable(bg, "#000", { level: "AA", size: "small" })) {
return "#000";
}
if (tinycolor2__default.default.isReadable(bg, "#fff", { level: "AA", size: "small" })) {
return "#fff";
}
if (tinycolor2__default.default.isReadable(bg, fallback, { level: "AA", size: "small" })) {
return tinycolor2__default.default(fallback).toHexString();
}
return tinycolor2__default.default.mostReadable(bg, ["#000", "#fff", fallback], {
includeFallbackColors: true
}).toHexString();
}
const getStyles$1 = (theme, color, size) => {
const backgroundColor = color != null ? color : theme.colors.secondary.main;
const borderColor = theme.isDark ? tinycolor2__default.default(backgroundColor).lighten(5).toString() : tinycolor2__default.default(backgroundColor).darken(5).toString();
const valueBackgroundColor = theme.isDark ? tinycolor2__default.default(backgroundColor).darken(5).toString() : tinycolor2__default.default(backgroundColor).lighten(5).toString();
const labelFontColor = color ? getReadableFontColor(backgroundColor, theme.colors.text.primary) : theme.colors.text.primary;
const valueFontColor = color ? getReadableFontColor(valueBackgroundColor, theme.colors.text.primary) : theme.colors.text.primary;
let padding = theme.spacing(0.33, 1);
switch (size) {
case "sm":
padding = theme.spacing(0.2, 0.6);
break;
case "xs":
padding = theme.spacing(0, 0.5);
break;
default:
break;
}
return {
wrapper: css.css({
fontSize: theme.typography.bodySmall.fontSize,
borderRadius: theme.shape.borderRadius(2)
}),
labelText: css.css({
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
maxWidth: "300px"
}),
label: css.css({
display: "flex",
alignItems: "center",
color: labelFontColor,
padding,
background: backgroundColor,
border: `solid 1px ${borderColor}`,
borderTopLeftRadius: theme.shape.borderRadius(2),
borderBottomLeftRadius: theme.shape.borderRadius(2)
}),
clickable: css.css({
border: "none",
background: "none",
outline: "none",
boxShadow: "none",
padding: 0,
margin: 0,
"&:hover": {
opacity: 0.8,
cursor: "pointer"
}
}),
value: css.css({
color: valueFontColor,
padding,
background: valueBackgroundColor,
border: `solid 1px ${borderColor}`,
borderLeft: "none",
borderTopRightRadius: theme.shape.borderRadius(2),
borderBottomRightRadius: theme.shape.borderRadius(2),
whiteSpace: "pre",
overflow: "hidden",
textOverflow: "ellipsis",
maxWidth: "300px"
}),
valueWithoutKey: css.css({
borderTopLeftRadius: theme.shape.borderRadius(2),
borderBottomLeftRadius: theme.shape.borderRadius(2),
borderLeft: `solid 1px ${borderColor}`
})
};
};
"use strict";
const GRAFANA_ORIGIN_LABEL = "__grafana_origin";
function isPrivateLabelKey(labelKey) {
return labelKey.startsWith("__") && labelKey.endsWith("__") || labelKey === GRAFANA_ORIGIN_LABEL;
}
const isPrivateLabel = ([key, _]) => isPrivateLabelKey(key);
function findCommonLabels(labelSets) {
if (!Array.isArray(labelSets) || labelSets.length === 0) {
return {};
}
return labelSets.reduce(
(acc, labels) => {
if (!labels) {
throw new Error("Need parsed labels to find common labels.");
}
Object.keys(labels).forEach((key) => {
if (acc[key] === void 0 || acc[key] !== labels[key]) {
delete acc[key];
}
});
Object.keys(acc).forEach((key) => {
if (labels[key] === void 0) {
delete acc[key];
}
});
return acc;
},
{ ...labelSets[0] }
);
}
"use strict";
const AlertLabels = ({
labels,
displayCommonLabels,
labelSets,
size,
onClick,
commonLabelsMode = "expand"
}) => {
const styles = ui.useStyles2(getStyles, size);
const [showCommonLabels, setShowCommonLabels] = react$1.useState(false);
const computedCommonLabels = react$1.useMemo(
() => displayCommonLabels && Array.isArray(labelSets) && labelSets.length > 1 ? findCommonLabels(labelSets) : {},
[displayCommonLabels, labelSets]
);
const labelsToShow = lodash.chain(labels).toPairs().reject(isPrivateLabel).reject(([key]) => showCommonLabels ? false : key in computedCommonLabels).value();
const commonLabelsCount = Object.keys(computedCommonLabels).length;
const hasCommonLabels = commonLabelsCount > 0;
const tooltip = i18n.t("alert-labels.button.show.tooltip", "Show common labels");
const commonLabelsTooltip = react$1.useMemo(
() => /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { "data-testid": "common-labels-tooltip-content", role: "list", direction: "row", wrap: "wrap", gap: 1, width: 48, children: Object.entries(computedCommonLabels).map(([label, value]) => /* @__PURE__ */ jsxRuntime.jsx(AlertLabel, { size, labelKey: label, value, colorBy: "key", role: "listitem" }, label + value)) }),
[computedCommonLabels, size]
);
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapper, role: "list", "aria-label": i18n.t("alerting.alert-labels.aria-label-labels", "Labels"), children: [
labelsToShow.map(([label, value]) => {
return /* @__PURE__ */ jsxRuntime.jsx(
AlertLabel,
{
size,
labelKey: label,
value,
colorBy: "key",
onClick,
role: "listitem"
},
label + value
);
}),
!showCommonLabels && hasCommonLabels && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listitem", children: commonLabelsMode === "expand" ? /* @__PURE__ */ jsxRuntime.jsx(
ui.Button,
{
variant: "secondary",
fill: "text",
onClick: () => setShowCommonLabels(true),
tooltip,
tooltipPlacement: "top",
size: "sm",
children: /* @__PURE__ */ jsxRuntime.jsxs(i18n.Trans, { i18nKey: "alerting.alert-labels.common-labels-count", count: commonLabelsCount, children: [
"+",
"{{count}}",
" common labels"
] })
}
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Toggletip, { content: commonLabelsTooltip, closeButton: false, fitContent: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { "data-testid": "common-labels-tooltip-trigger", variant: "secondary", fill: "text", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs(i18n.Trans, { i18nKey: "alerting.alert-labels.common-labels-count", count: commonLabelsCount, children: [
"+",
"{{count}}",
" common labels"
] }) }) }) }),
showCommonLabels && hasCommonLabels && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listitem", children: /* @__PURE__ */ jsxRuntime.jsx(
ui.Button,
{
variant: "secondary",
fill: "text",
onClick: () => setShowCommonLabels(false),
tooltipPlacement: "top",
size: "sm",
children: /* @__PURE__ */ jsxRuntime.jsx(i18n.Trans, { i18nKey: "alert-labels.button.hide", children: "Hide common labels" })
}
) })
] });
};
const getStyles = (theme, size) => {
return {
wrapper: css.css({
display: "flex",
flexWrap: "wrap",
alignItems: "center",
gap: size === "md" ? theme.spacing() : theme.spacing(0.5)
})
};
};
"use strict";
function matchLabels(matchers, labels) {
const matches = matchLabelsSet(matchers, labels);
const details = labels.map((_label, index) => ({
labelIndex: index,
match: false,
matcher: null
}));
matchers.forEach((matcher) => {
const matchingLabelIndex = labels.findIndex((label) => isLabelMatch(matcher, label));
if (matchingLabelIndex > -1) {
details[matchingLabelIndex].match = true;
details[matchingLabelIndex].matcher = matcher;
}
});
return { matches, details };
}
function isLabelMatch(matcher, label) {
const [labelKey, labelValue] = label;
const { label: matcherLabel, type: matcherType, value: matcherValue } = matcher;
if (labelKey !== matcherLabel) {
return false;
}
const matchFunction = OperatorFunctions[matcherType];
return matchFunction(labelValue, matcherValue);
}
function matchLabelsSet(matchers, labels) {
for (const matcher of matchers) {
if (!isLabelMatchInSet(matcher, labels)) {
return false;
}
}
return true;
}
function isLabelMatchInSet(matcher, labels) {
const { label, type, value } = matcher;
let labelValue = "";
const labelForMatcher = Object.fromEntries(labels)[label];
if (labelForMatcher) {
labelValue = labelForMatcher;
}
const matchFunction = OperatorFunctions[type];
try {
return matchFunction(labelValue, value);
} catch (err) {
return false;
}
}
const OperatorFunctions = {
"=": (lv, mv) => lv === mv,
"!=": (lv, mv) => lv !== mv,
// At the time of writing, Alertmanager compiles to another (anchored) Regular Expression,
// so we should also anchor our UI matches for consistency with this behaviour
// https://github.com/prometheus/alertmanager/blob/fd37ce9c95898ca68be1ab4d4529517174b73c33/pkg/labels/matcher.go#L69
"=~": (lv, mv) => {
const valueWithFlagsParsed = data.parseFlags(`^(?:${mv})$`);
const re = new RegExp(valueWithFlagsParsed.cleaned, valueWithFlagsParsed.flags);
return re.test(lv);
},
"!~": (lv, mv) => {
const valueWithFlagsParsed = data.parseFlags(`^(?:${mv})$`);
const re = new RegExp(valueWithFlagsParsed.cleaned, valueWithFlagsParsed.flags);
return !re.test(lv);
}
};
"use strict";
const VERSION = "v0alpha1";
const GROUP = "rules.alerting.grafana.app";
"use strict";
const baseUrl = getAPIBaseURL(GROUP, VERSION);
const reducerPath = getAPIReducerPath(GROUP, VERSION);
const api = react.createApi({
reducerPath,
baseQuery: react.fetchBaseQuery({
// Set URL correctly so MSW can intercept requests
// https://mswjs.io/docs/runbook#rtk-query-requests-are-not-intercepted
baseUrl: new URL(baseUrl, globalThis.location.origin).href
}),
endpoints: () => ({})
});
"use strict";
const addTagTypes = ["API Discovery", "AlertRule", "RecordingRule"];
const injectedRtkApi = api.enhanceEndpoints({
addTagTypes
}).injectEndpoints({
endpoints: (build) => ({
getApiResources: build.query({
query: () => ({ url: `/apis/rules.alerting.grafana.app/v0alpha1/` }),
providesTags: ["API Discovery"]
}),
listAlertRule: build.query({
query: (queryArg) => ({
url: `/alertrules`,
params: {
pretty: queryArg.pretty,
allowWatchBookmarks: queryArg.allowWatchBookmarks,
continue: queryArg["continue"],
fieldSelector: queryArg.fieldSelector,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds,
watch: queryArg.watch
}
}),
providesTags: ["AlertRule"]
}),
createAlertRule: build.mutation({
query: (queryArg) => ({
url: `/alertrules`,
method: "POST",
body: queryArg.alertRule,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["AlertRule"]
}),
deletecollectionAlertRule: build.mutation({
query: (queryArg) => ({
url: `/alertrules`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
continue: queryArg["continue"],
dryRun: queryArg.dryRun,
fieldSelector: queryArg.fieldSelector,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds
}
}),
invalidatesTags: ["AlertRule"]
}),
getAlertRule: build.query({
query: (queryArg) => ({
url: `/alertrules/${queryArg.name}`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["AlertRule"]
}),
replaceAlertRule: build.mutation({
query: (queryArg) => ({
url: `/alertrules/${queryArg.name}`,
method: "PUT",
body: queryArg.alertRule,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["AlertRule"]
}),
deleteAlertRule: build.mutation({
query: (queryArg) => ({
url: `/alertrules/${queryArg.name}`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy
}
}),
invalidatesTags: ["AlertRule"]
}),
updateAlertRule: build.mutation({
query: (queryArg) => ({
url: `/alertrules/${queryArg.name}`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["AlertRule"]
}),
getAlertRuleStatus: build.query({
query: (queryArg) => ({
url: `/alertrules/${queryArg.name}/status`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["AlertRule"]
}),
replaceAlertRuleStatus: build.mutation({
query: (queryArg) => ({
url: `/alertrules/${queryArg.name}/status`,
method: "PUT",
body: queryArg.alertRule,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["AlertRule"]
}),
updateAlertRuleStatus: build.mutation({
query: (queryArg) => ({
url: `/alertrules/${queryArg.name}/status`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["AlertRule"]
}),
listRecordingRule: build.query({
query: (queryArg) => ({
url: `/recordingrules`,
params: {
pretty: queryArg.pretty,
allowWatchBookmarks: queryArg.allowWatchBookmarks,
continue: queryArg["continue"],
fieldSelector: queryArg.fieldSelector,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds,
watch: queryArg.watch
}
}),
providesTags: ["RecordingRule"]
}),
createRecordingRule: build.mutation({
query: (queryArg) => ({
url: `/recordingrules`,
method: "POST",
body: queryArg.recordingRule,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["RecordingRule"]
}),
deletecollectionRecordingRule: build.mutation({
query: (queryArg) => ({
url: `/recordingrules`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
continue: queryArg["continue"],
dryRun: queryArg.dryRun,
fieldSelector: queryArg.fieldSelector,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
labelSelector: queryArg.labelSelector,
limit: queryArg.limit,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy,
resourceVersion: queryArg.resourceVersion,
resourceVersionMatch: queryArg.resourceVersionMatch,
sendInitialEvents: queryArg.sendInitialEvents,
timeoutSeconds: queryArg.timeoutSeconds
}
}),
invalidatesTags: ["RecordingRule"]
}),
getRecordingRule: build.query({
query: (queryArg) => ({
url: `/recordingrules/${queryArg.name}`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["RecordingRule"]
}),
replaceRecordingRule: build.mutation({
query: (queryArg) => ({
url: `/recordingrules/${queryArg.name}`,
method: "PUT",
body: queryArg.recordingRule,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["RecordingRule"]
}),
deleteRecordingRule: build.mutation({
query: (queryArg) => ({
url: `/recordingrules/${queryArg.name}`,
method: "DELETE",
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
gracePeriodSeconds: queryArg.gracePeriodSeconds,
ignoreStoreReadErrorWithClusterBreakingPotential: queryArg.ignoreStoreReadErrorWithClusterBreakingPotential,
orphanDependents: queryArg.orphanDependents,
propagationPolicy: queryArg.propagationPolicy
}
}),
invalidatesTags: ["RecordingRule"]
}),
updateRecordingRule: build.mutation({
query: (queryArg) => ({
url: `/recordingrules/${queryArg.name}`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["RecordingRule"]
}),
getRecordingRuleStatus: build.query({
query: (queryArg) => ({
url: `/recordingrules/${queryArg.name}/status`,
params: {
pretty: queryArg.pretty
}
}),
providesTags: ["RecordingRule"]
}),
replaceRecordingRuleStatus: build.mutation({
query: (queryArg) => ({
url: `/recordingrules/${queryArg.name}/status`,
method: "PUT",
body: queryArg.recordingRule,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation
}
}),
invalidatesTags: ["RecordingRule"]
}),
updateRecordingRuleStatus: build.mutation({
query: (queryArg) => ({
url: `/recordingrules/${queryArg.name}/status`,
method: "PATCH",
body: queryArg.patch,
params: {
pretty: queryArg.pretty,
dryRun: queryArg.dryRun,
fieldManager: queryArg.fieldManager,
fieldValidation: queryArg.fieldValidation,
force: queryArg.force
}
}),
invalidatesTags: ["RecordingRule"]
})
}),
overrideExisting: false
});
"use strict";
exports.AlertLabel = AlertLabel;
exports.AlertLabels = AlertLabels;
exports.ContactPointSelector = ContactPointSelector;
exports.StateIcon = StateIcon;
exports.StateText = StateText;
exports.getContactPointDescription = getContactPointDescription;
exports.isLabelMatch = isLabelMatch;
exports.matchLabels = matchLabels;
exports.matchLabelsSet = matchLabelsSet;
exports.notificationsAPIv0alpha1 = injectedRtkApi$1;
exports.rulesAPIv0alpha1 = injectedRtkApi;
exports.useListContactPoints = useListContactPoints;
//# sourceMappingURL=unstable.cjs.map