From e110402d44d43b261ee58ef4e72477ba0c03ea8a Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 13 Nov 2019 13:36:43 +0100 Subject: [PATCH] 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 --- web/ui/react-app/src/pages/TSDBStatus.tsx | 2 +- web/ui/react-app/src/pages/targets/ScrapePoolList.tsx | 9 +++++++-- web/ui/react-app/yarn.lock | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/web/ui/react-app/src/pages/TSDBStatus.tsx b/web/ui/react-app/src/pages/TSDBStatus.tsx index 826350793..0519a7373 100644 --- a/web/ui/react-app/src/pages/TSDBStatus.tsx +++ b/web/ui/react-app/src/pages/TSDBStatus.tsx @@ -53,7 +53,7 @@ function createTable(title: string, unit: string, stats: Array) { const TSDBStatus: FC = ({ pathPrefix }) => { const { response, error } = useFetch(`${pathPrefix}/api/v1/status/tsdb`); const headStats = () => { - const stats: TSDBMap = response && response.data; + const stats = response && (response.data as TSDBMap); if (error) { return ( diff --git a/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx b/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx index d46efc0c0..cf6dfac42 100644 --- a/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx +++ b/web/ui/react-app/src/pages/targets/ScrapePoolList.tsx @@ -1,13 +1,18 @@ import React, { FC } from 'react'; import { FilterData } from './Filter'; import { useFetch } from '../../utils/useFetch'; -import { ScrapePool, groupTargets } from './target'; +import { ScrapePool, groupTargets, Target } from './target'; import ScrapePoolPanel from './ScrapePoolPanel'; import PathPrefixProps from '../../PathPrefixProps'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSpinner } from '@fortawesome/free-solid-svg-icons'; import { Alert } from 'reactstrap'; +interface TargetsResponse { + activeTargets: Target[]; + droppedTargets: Target[]; +} + interface ScrapePoolListProps { filter: FilterData; } @@ -33,7 +38,7 @@ const ScrapePoolList: FC = ({ filter, pat ); } else if (response && response.data) { - const { activeTargets } = response.data; + const { activeTargets } = response.data as TargetsResponse; const targetGroups = groupTargets(activeTargets); return ( <> diff --git a/web/ui/react-app/yarn.lock b/web/ui/react-app/yarn.lock index 5a14afce3..04bbdaccc 100644 --- a/web/ui/react-app/yarn.lock +++ b/web/ui/react-app/yarn.lock @@ -10657,9 +10657,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^3.3.3: - version "3.6.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" - integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== + version "3.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" + integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== ua-parser-js@^0.7.18: version "0.7.20"