mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 13:14:05 -08:00
upgrade react-app to typescript 4
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
parent
143fce73cd
commit
405198f430
14
web/ui/react-app/package-lock.json
generated
14
web/ui/react-app/package-lock.json
generated
|
@ -77,7 +77,7 @@
|
||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
"react-scripts": "4.0.3",
|
"react-scripts": "4.0.3",
|
||||||
"sinon": "^9.0.3",
|
"sinon": "^9.0.3",
|
||||||
"typescript": "^3.3.3"
|
"typescript": "^4.4.2"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"fsevents": "^2.3.2"
|
"fsevents": "^2.3.2"
|
||||||
|
@ -22808,9 +22808,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "3.9.10",
|
"version": "4.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
||||||
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
|
@ -43168,9 +43168,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.9.10",
|
"version": "4.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
||||||
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"unbox-primitive": {
|
"unbox-primitive": {
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
"react-scripts": "4.0.3",
|
"react-scripts": "4.0.3",
|
||||||
"sinon": "^9.0.3",
|
"sinon": "^9.0.3",
|
||||||
"typescript": "^3.3.3"
|
"typescript": "^4.4.2"
|
||||||
},
|
},
|
||||||
"proxy": "http://localhost:9090",
|
"proxy": "http://localhost:9090",
|
||||||
"jest": {
|
"jest": {
|
||||||
|
|
|
@ -34,7 +34,8 @@ export const useFetch = <T extends Record<string, any>>(url: string, options?: R
|
||||||
const json = (await res.json()) as APIResponse<T>;
|
const json = (await res.json()) as APIResponse<T>;
|
||||||
setResponse(json);
|
setResponse(json);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
} catch (error) {
|
} catch (err: unknown) {
|
||||||
|
const error = err as Error;
|
||||||
setError(error);
|
setError(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -200,7 +200,8 @@ class Panel extends Component<PanelProps, PanelState> {
|
||||||
loading: false,
|
loading: false,
|
||||||
});
|
});
|
||||||
this.abortInFlightFetch = null;
|
this.abortInFlightFetch = null;
|
||||||
} catch (error) {
|
} catch (err: unknown) {
|
||||||
|
const error = err as Error;
|
||||||
if (error.name === 'AbortError') {
|
if (error.name === 'AbortError') {
|
||||||
// Aborts are expected, don't show an error for them.
|
// Aborts are expected, don't show an error for them.
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,10 +10,11 @@ const EndpointLink: FC<EndpointLinkProps> = ({ endpoint, globalUrl }) => {
|
||||||
let url: URL;
|
let url: URL;
|
||||||
try {
|
try {
|
||||||
url = new URL(endpoint);
|
url = new URL(endpoint);
|
||||||
} catch (e) {
|
} catch (err: unknown) {
|
||||||
|
const error = err as Error;
|
||||||
return (
|
return (
|
||||||
<Alert color="danger">
|
<Alert color="danger">
|
||||||
<strong>Error:</strong> {e.message}
|
<strong>Error:</strong> {error.message}
|
||||||
</Alert>
|
</Alert>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react",
|
"jsx": "react-jsx",
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
|
Loading…
Reference in a new issue