React UI: Fix build (#6312)

This fixes two TypeScript errors. Not sure why we didn't catch the
breakage in the PR CI tests... also, updating TypeScript just for good
measure.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2019-11-13 13:36:43 +01:00 committed by GitHub
parent 8a9509b0a8
commit e110402d44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -53,7 +53,7 @@ function createTable(title: string, unit: string, stats: Array<Stats>) {
const TSDBStatus: FC<RouteComponentProps & PathPrefixProps> = ({ pathPrefix }) => { const TSDBStatus: FC<RouteComponentProps & PathPrefixProps> = ({ pathPrefix }) => {
const { response, error } = useFetch(`${pathPrefix}/api/v1/status/tsdb`); const { response, error } = useFetch(`${pathPrefix}/api/v1/status/tsdb`);
const headStats = () => { const headStats = () => {
const stats: TSDBMap = response && response.data; const stats = response && (response.data as TSDBMap);
if (error) { if (error) {
return ( return (
<Alert color="danger"> <Alert color="danger">

View File

@ -1,13 +1,18 @@
import React, { FC } from 'react'; import React, { FC } from 'react';
import { FilterData } from './Filter'; import { FilterData } from './Filter';
import { useFetch } from '../../utils/useFetch'; import { useFetch } from '../../utils/useFetch';
import { ScrapePool, groupTargets } from './target'; import { ScrapePool, groupTargets, Target } from './target';
import ScrapePoolPanel from './ScrapePoolPanel'; import ScrapePoolPanel from './ScrapePoolPanel';
import PathPrefixProps from '../../PathPrefixProps'; import PathPrefixProps from '../../PathPrefixProps';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSpinner } from '@fortawesome/free-solid-svg-icons'; import { faSpinner } from '@fortawesome/free-solid-svg-icons';
import { Alert } from 'reactstrap'; import { Alert } from 'reactstrap';
interface TargetsResponse {
activeTargets: Target[];
droppedTargets: Target[];
}
interface ScrapePoolListProps { interface ScrapePoolListProps {
filter: FilterData; filter: FilterData;
} }
@ -33,7 +38,7 @@ const ScrapePoolList: FC<ScrapePoolListProps & PathPrefixProps> = ({ filter, pat
</Alert> </Alert>
); );
} else if (response && response.data) { } else if (response && response.data) {
const { activeTargets } = response.data; const { activeTargets } = response.data as TargetsResponse;
const targetGroups = groupTargets(activeTargets); const targetGroups = groupTargets(activeTargets);
return ( return (
<> <>

View File

@ -10657,9 +10657,9 @@ typedarray@^0.0.6:
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^3.3.3: typescript@^3.3.3:
version "3.6.4" version "3.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb"
integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==
ua-parser-js@^0.7.18: ua-parser-js@^0.7.18:
version "0.7.20" version "0.7.20"