Skip to content

Commit d765a56

Browse files
committed
fix(ui): fix types
1 parent e805ef1 commit d765a56

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

ui/src/Components/MainModal/Configuration/AlertGroupCollapseConfiguration.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { FC } from "react";
22

33
import { observer } from "mobx-react-lite";
44

5-
import Select from "react-select";
5+
import Select, { OnChangeValue } from "react-select";
66

77
import type { OptionT } from "Common/Select";
88
import type { Settings, CollapseStateT } from "Stores/Settings";
@@ -41,10 +41,10 @@ const AlertGroupCollapseConfiguration: FC<{
4141
classNamePrefix="react-select"
4242
instanceId="configuration-collapse"
4343
defaultValue={valueToOption(
44-
settingsStore.alertGroupConfig.config.defaultCollapseState,
44+
settingsStore.alertGroupConfig.config.defaultCollapseState
4545
)}
4646
options={Object.values(settingsStore.alertGroupConfig.options)}
47-
onChange={(option) =>
47+
onChange={(option: OnChangeValue<OptionT, false>) =>
4848
onCollapseChange((option as OptionT).value as CollapseStateT)
4949
}
5050
hideSelectedOptions

ui/src/Components/MainModal/Configuration/GridLabelName.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { Settings } from "Stores/Settings";
88
import { ThemeContext } from "Components/Theme";
99
import { AnimatedMenu } from "Components/Select";
1010
import { NewLabelName, StringToOption, OptionT } from "Common/Select";
11+
import { OnChangeValue } from "react-select";
1112

1213
const disabledLabel = "Disable multi-grid";
1314

@@ -29,7 +30,7 @@ const GridLabelName: FC<{
2930
settingsStore: Settings;
3031
}> = ({ settingsStore }) => {
3132
const { response } = useFetchGet<string[]>(
32-
FormatBackendURI(`labelNames.json`),
33+
FormatBackendURI(`labelNames.json`)
3334
);
3435

3536
const context = React.useContext(ThemeContext);
@@ -54,7 +55,7 @@ const GridLabelName: FC<{
5455
]
5556
: staticValues
5657
}
57-
onChange={(option) => {
58+
onChange={(option: OnChangeValue<OptionT, false>) => {
5859
settingsStore.multiGridConfig.setGridLabel((option as OptionT).value);
5960
}}
6061
components={{ Menu: AnimatedMenu }}

ui/src/Components/MainModal/Configuration/SortLabelName.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import { useFetchGet } from "Hooks/useFetchGet";
1010
import { ThemeContext } from "Components/Theme";
1111
import { AnimatedMenu } from "Components/Select";
1212
import { NewLabelName, StringToOption } from "Common/Select";
13+
import { OnChangeValue } from "react-select";
1314

1415
const SortLabelName: FC<{
1516
settingsStore: Settings;
1617
}> = ({ settingsStore }) => {
1718
const { response } = useFetchGet<string[]>(
18-
FormatBackendURI(`labelNames.json`),
19+
FormatBackendURI(`labelNames.json`)
1920
);
2021

2122
if (!settingsStore.gridConfig.config.sortLabel) {
@@ -31,14 +32,14 @@ const SortLabelName: FC<{
3132
instanceId="configuration-sort-label"
3233
formatCreateLabel={NewLabelName}
3334
defaultValue={StringToOption(
34-
settingsStore.gridConfig.config.sortLabel as string,
35+
settingsStore.gridConfig.config.sortLabel as string
3536
)}
3637
options={
3738
response ? response.map((value: string) => StringToOption(value)) : []
3839
}
39-
onChange={(option) => {
40+
onChange={(option: OnChangeValue<OptionT, false>) => {
4041
settingsStore.gridConfig.setSortLabel(
41-
(option as OptionT).value as string,
42+
(option as OptionT).value as string
4243
);
4344
}}
4445
components={{ Menu: AnimatedMenu }}

ui/src/Components/SilenceModal/SilenceMatch/LabelNameInput.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import { ValidationError } from "Components/ValidationError";
99
import { ThemeContext } from "Components/Theme";
1010
import { AnimatedMenu } from "Components/Select";
1111
import { NewLabelName, OptionT, StringToOption } from "Common/Select";
12+
import { OnChangeValue } from "react-select";
1213

1314
const LabelNameInput: FC<{
1415
matcher: MatcherWithIDT;
1516
isValid: boolean;
1617
}> = ({ matcher, isValid }) => {
1718
const { response } = useFetchGet<string[]>(
18-
FormatBackendURI(`labelNames.json`),
19+
FormatBackendURI(`labelNames.json`)
1920
);
2021

2122
const context = React.useContext(ThemeContext);
@@ -31,7 +32,7 @@ const LabelNameInput: FC<{
3132
response ? response.map((value: string) => StringToOption(value)) : []
3233
}
3334
placeholder={isValid ? "Label name" : <ValidationError />}
34-
onChange={(option) => {
35+
onChange={(option: OnChangeValue<OptionT, false>) => {
3536
matcher.name = (option as OptionT).value;
3637
}}
3738
hideSelectedOptions

0 commit comments

Comments
 (0)