chore(ui): migrate more code to typescript

This commit is contained in:
Łukasz Mierzwa
2020-06-29 16:14:53 +01:00
committed by Łukasz Mierzwa
parent 55170f8812
commit 4d4dd111c1
36 changed files with 392 additions and 205 deletions

View File

@@ -1,4 +1,4 @@
function IsMobile() {
function IsMobile(): boolean {
return window.innerWidth < 768;
}

View File

@@ -14,7 +14,13 @@ const FetchRetryConfig = {
maxTimeout: 5000,
};
const FetchGet = async (uri, options, beforeRetry) =>
type PreRetryCallback = (number: number) => void;
const FetchGet = async (
uri: string,
options: RequestInit,
beforeRetry: PreRetryCallback
) =>
await promiseRetry(
(retry, number) =>
fetch(

View File

@@ -14,7 +14,7 @@ const StaticLabels = Object.freeze({
SilenceID: "@silence_id",
});
function FormatQuery(name, operator, value) {
function FormatQuery(name: string, operator: string, value: string) {
return `${name}${operator}${value}`;
}

View File

@@ -1,5 +0,0 @@
const NewLabelName = (v) => `New label: ${v}`;
const NewLabelValue = (v) => `New value: ${v}`;
export { NewLabelName, NewLabelValue };

5
ui/src/Common/Select.ts Normal file
View File

@@ -0,0 +1,5 @@
const NewLabelName = (v: string) => `New label: ${v}`;
const NewLabelValue = (v: string) => `New value: ${v}`;
export { NewLabelName, NewLabelValue };