diff --git a/ui/src/App.test.tsx b/ui/src/App.test.tsx
index ec53451ba..a6d1939fc 100644
--- a/ui/src/App.test.tsx
+++ b/ui/src/App.test.tsx
@@ -291,52 +291,45 @@ describe(" theme", () => {
const testCases: testCaseT[] = [
{
- name:
- "applies LightTheme when config=auto and browser doesn't support prefers-color-scheme",
+ name: "applies LightTheme when config=auto and browser doesn't support prefers-color-scheme",
settings: "auto",
matchMedia: {},
theme: "LightTheme",
},
{
- name:
- "applies LightTheme when config=auto and browser prefers-color-scheme:light matches",
+ name: "applies LightTheme when config=auto and browser prefers-color-scheme:light matches",
settings: "auto",
matchMedia: lightMatch(),
theme: "LightTheme",
},
{
- name:
- "applies DarkTheme when config=auto and browser prefers-color-scheme:dark matches",
+ name: "applies DarkTheme when config=auto and browser prefers-color-scheme:dark matches",
settings: "auto",
matchMedia: darkMatch(),
theme: "DarkTheme",
},
{
- name:
- "applies LightTheme when config=light and browser doesn't support prefers-color-scheme",
+ name: "applies LightTheme when config=light and browser doesn't support prefers-color-scheme",
settings: "light",
matchMedia: {},
theme: "LightTheme",
},
{
- name:
- "applies LightTheme when config=light and browser prefers-color-scheme:light matches",
+ name: "applies LightTheme when config=light and browser prefers-color-scheme:light matches",
settings: "light",
matchMedia: lightMatch(),
theme: "LightTheme",
},
{
- name:
- "applies DarkTheme when config=dark and browser doesn't support prefers-color-scheme",
+ name: "applies DarkTheme when config=dark and browser doesn't support prefers-color-scheme",
settings: "dark",
matchMedia: {},
theme: "DarkTheme",
},
{
- name:
- "applies DarkTheme when config=dark and browser prefers-color-scheme:dark matches",
+ name: "applies DarkTheme when config=dark and browser prefers-color-scheme:dark matches",
settings: "dark",
matchMedia: darkMatch(),
theme: "DarkTheme",
diff --git a/ui/src/Components/AlertAck/index.tsx b/ui/src/Components/AlertAck/index.tsx
index 32b78ce9f..9c0e65f9a 100644
--- a/ui/src/Components/AlertAck/index.tsx
+++ b/ui/src/Components/AlertAck/index.tsx
@@ -41,9 +41,8 @@ const AlertAck: FC<{
const [currentCluster, setCurrentCluster] = useState(0);
const [isAcking, setIsAcking] = useState(false);
- const { response, error, inProgress, reset } = useFetchAny(
- upstreams
- );
+ const { response, error, inProgress, reset } =
+ useFetchAny(upstreams);
const onACK = () => {
setIsAcking(true);
diff --git a/ui/src/Components/AlertHistory/index.tsx b/ui/src/Components/AlertHistory/index.tsx
index 87e3b34b0..5457f2bc2 100644
--- a/ui/src/Components/AlertHistory/index.tsx
+++ b/ui/src/Components/AlertHistory/index.tsx
@@ -20,9 +20,8 @@ export const AlertHistory: FC<{ group: APIAlertGroupT }> = ({ group }) => {
const [sources, setSources] = useState([]);
const [upstreams, setUpstreams] = useState([]);
const [labels] = useState({ ...group.labels, ...group.shared.labels });
- const { response, error, inProgress } = useFetchAny(
- upstreams
- );
+ const { response, error, inProgress } =
+ useFetchAny(upstreams);
const [maxValue, setMaxValue] = useState(0);
useEffect(() => {
diff --git a/ui/src/Components/Grid/AlertGrid/index.test.tsx b/ui/src/Components/Grid/AlertGrid/index.test.tsx
index 38ee39ab3..aeb5a927d 100644
--- a/ui/src/Components/Grid/AlertGrid/index.test.tsx
+++ b/ui/src/Components/Grid/AlertGrid/index.test.tsx
@@ -579,20 +579,7 @@ describe("", () => {
}
expect(results).toStrictEqual([
- 400,
- 396,
- 400,
- 396,
- 400,
- 396,
- 400,
- 396,
- 400,
- 396,
- 400,
- 396,
- 400,
- 396,
+ 400, 396, 400, 396, 400, 396, 400, 396, 400, 396, 400, 396, 400, 396,
]);
});
diff --git a/ui/src/Components/ManagedSilence/DeleteSilence.test.tsx b/ui/src/Components/ManagedSilence/DeleteSilence.test.tsx
index fe19e4b69..348fc6d3b 100644
--- a/ui/src/Components/ManagedSilence/DeleteSilence.test.tsx
+++ b/ui/src/Components/ManagedSilence/DeleteSilence.test.tsx
@@ -175,9 +175,9 @@ describe("", () => {
});
it("sends a DELETE request after clicking 'Confirm' button", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({ response: "success", error: null, isDeleting: false });
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({ response: "success", error: null, isDeleting: false });
const tree = MountedDeleteSilenceModalContent();
tree.find(".btn-danger").simulate("click");
@@ -198,9 +198,9 @@ describe("", () => {
});
it("sends headers from alertmanager config", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({ response: "success", error: null, isDeleting: false });
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({ response: "success", error: null, isDeleting: false });
const upstreams = generateUpstreams();
upstreams.instances[0].headers = {
@@ -227,9 +227,9 @@ describe("", () => {
});
it("uses CORS credentials from alertmanager config", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({ response: "success", error: null, isDeleting: false });
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({ response: "success", error: null, isDeleting: false });
const upstreams = generateUpstreams();
upstreams.instances[0].corsCredentials = "omit";
@@ -254,9 +254,9 @@ describe("", () => {
});
it("renders ProgressMessage while awaiting response status", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({ response: null, error: null, isDeleting: true });
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({ response: null, error: null, isDeleting: true });
const tree = MountedDeleteSilenceModalContent();
tree.find(".btn-danger").simulate("click");
@@ -265,9 +265,9 @@ describe("", () => {
});
it("renders SuccessMessage on successful response status", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({ response: "success", error: null, isDeleting: false });
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({ response: "success", error: null, isDeleting: false });
const tree = MountedDeleteSilenceModalContent();
tree.find(".btn-danger").simulate("click");
@@ -276,9 +276,9 @@ describe("", () => {
});
it("renders ErrorMessage on failed delete fetch request", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({
response: null,
error: "failed",
isDeleting: false,
@@ -291,9 +291,9 @@ describe("", () => {
});
it("'Retry' button is present after failed delete", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({
response: null,
error: "fake error",
isDeleting: false,
@@ -306,9 +306,9 @@ describe("", () => {
});
it("'Retry' button is not present after successful delete", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({ response: "success", error: null, isDeleting: false });
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({ response: "success", error: null, isDeleting: false });
const tree = MountedDeleteSilenceModalContent();
tree.find(".btn-danger").simulate("click");
@@ -317,9 +317,9 @@ describe("", () => {
});
it("Clicking 'Retry' button triggers new delete", () => {
- (useFetchDelete as jest.MockedFunction<
- typeof useFetchDelete
- >).mockReturnValue({
+ (
+ useFetchDelete as jest.MockedFunction
+ ).mockReturnValue({
response: null,
error: "fake error",
isDeleting: false,
diff --git a/ui/src/Components/ManagedSilence/DeleteSilence.tsx b/ui/src/Components/ManagedSilence/DeleteSilence.tsx
index 6937d2de7..c7ba36623 100644
--- a/ui/src/Components/ManagedSilence/DeleteSilence.tsx
+++ b/ui/src/Components/ManagedSilence/DeleteSilence.tsx
@@ -68,10 +68,7 @@ const DeleteResult: FC<{
credentials: am.corsCredentials,
});
- const {
- error,
- isDeleting,
- } = useFetchDelete(
+ const { error, isDeleting } = useFetchDelete(
`${am.uri}/api/v2/silence/${silence.id}`,
deleteFetchOptions,
[currentTime]
@@ -175,9 +172,8 @@ const DeleteSilence: FC<{
}> = ({ alertStore, silenceFormStore, cluster, silence, isUpper = false }) => {
const [visible, setVisible] = useState(false);
- const members = alertStore.data.getClusterAlertmanagersWithoutReadOnly(
- cluster
- );
+ const members =
+ alertStore.data.getClusterAlertmanagersWithoutReadOnly(cluster);
return (
<>
diff --git a/ui/src/Components/SilenceModal/SilenceMatch/MatchCounter.tsx b/ui/src/Components/SilenceModal/SilenceMatch/MatchCounter.tsx
index 9fad4d7ed..481e3a2ae 100644
--- a/ui/src/Components/SilenceModal/SilenceMatch/MatchCounter.tsx
+++ b/ui/src/Components/SilenceModal/SilenceMatch/MatchCounter.tsx
@@ -22,14 +22,10 @@ const MatchCounter: FC<{
filters.push(AlertManagersToFilter(silenceFormStore.data.alertmanagers));
}
- const {
- response,
- error,
- isLoading,
- isRetrying,
- } = useFetchGet(
- FormatBackendURI("alerts.json?") + FormatAlertsQ(filters)
- );
+ const { response, error, isLoading, isRetrying } =
+ useFetchGet(
+ FormatBackendURI("alerts.json?") + FormatAlertsQ(filters)
+ );
return error ? (
= ({ alertStore, silenceFormStore, cluster, members, payload }) => {
const [upstreams, setUpstreams] = useState([]);
- const {
- response,
- error,
- inProgress,
- responseURI,
- } = useFetchAny(upstreams);
+ const { response, error, inProgress, responseURI } =
+ useFetchAny(upstreams);
const [publicURIs, setPublicURIs] = useState<{ [key: string]: string }>({});
useEffect(() => {
diff --git a/ui/src/Components/TooltipWrapper/index.tsx b/ui/src/Components/TooltipWrapper/index.tsx
index c96d2dca6..10351a7c2 100644
--- a/ui/src/Components/TooltipWrapper/index.tsx
+++ b/ui/src/Components/TooltipWrapper/index.tsx
@@ -12,9 +12,8 @@ const TooltipWrapper: FC<{
children: ReactNode;
className?: string;
}> = ({ title, children, className }) => {
- const [referenceElement, setReferenceElement] = useState(
- null
- );
+ const [referenceElement, setReferenceElement] =
+ useState(null);
const [popperElement, setPopperElement] = useState(null);
const { styles, attributes } = usePopper(referenceElement, popperElement, {
placement: "top",
diff --git a/ui/src/setupTests.ts b/ui/src/setupTests.ts
index 0671f84ed..ec1203a11 100644
--- a/ui/src/setupTests.ts
+++ b/ui/src/setupTests.ts
@@ -36,7 +36,8 @@ require("jest-canvas-mock");
require("jest-date-mock");
// https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#new-deprecations
-const reactDeprecationWarning = /.*has been renamed, and is not recommended for use.*/;
+const reactDeprecationWarning =
+ /.*has been renamed, and is not recommended for use.*/;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const consoleHandler = (message?: any, ...args: any): void => {
if (reactDeprecationWarning.test(message as string) === false) {
@@ -58,9 +59,9 @@ React.useLayoutEffect = React.useEffect;
beforeEach(() => {
useFetchGetMock.fetch.reset();
(useFetchGet as jest.MockedFunction).mockRestore();
- (useFetchGet as jest.MockedFunction<
- typeof useFetchGetMock
- >).mockImplementation(useFetchGetMock);
+ (
+ useFetchGet as jest.MockedFunction
+ ).mockImplementation(useFetchGetMock);
(useInView as jest.MockedFunction).mockReturnValue([
jest.fn(),