mirror of
https://github.com/prymitive/karma
synced 2026-05-09 03:36:44 +00:00
chore(ui): migrate more code to typescript
This commit is contained in:
committed by
Łukasz Mierzwa
parent
55170f8812
commit
4d4dd111c1
@@ -1,4 +1,4 @@
|
||||
function IsMobile() {
|
||||
function IsMobile(): boolean {
|
||||
return window.innerWidth < 768;
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
@@ -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}`;
|
||||
}
|
||||
|
||||
@@ -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
5
ui/src/Common/Select.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
const NewLabelName = (v: string) => `New label: ${v}`;
|
||||
|
||||
const NewLabelValue = (v: string) => `New value: ${v}`;
|
||||
|
||||
export { NewLabelName, NewLabelValue };
|
||||
Reference in New Issue
Block a user