prometheus/web/ui/react-app/src/pages/serviceDiscovery/Services.tsx

123 lines
3.3 KiB
TypeScript
Raw Normal View History

import React, { FC } from 'react';
import { RouteComponentProps } from '@reach/router';
import { useFetch } from '../../hooks/useFetch';
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
import { LabelsTable } from './LabelsTable';
import { Target, Labels, DroppedTarget } from '../targets/target';
2020-02-03 06:14:25 -08:00
import { withStatusIndicator } from '../../components/withStatusIndicator';
import { mapObjEntries } from '../../utils';
import { usePathPrefix } from '../../contexts/PathPrefixContext';
import { API_PATH } from '../../constants/constants';
2020-02-03 06:14:25 -08:00
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
interface ServiceMap {
activeTargets: Target[];
droppedTargets: DroppedTarget[];
}
export interface TargetLabels {
discoveredLabels: Labels;
labels: Labels;
isDropped: boolean;
}
2020-02-03 06:14:25 -08:00
export const processSummary = (activeTargets: Target[], droppedTargets: DroppedTarget[]) => {
const targets: Record<string, { active: number; total: number }> = {};
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
// Get targets of each type along with the total and active end points
for (const target of activeTargets) {
const { scrapePool: name } = target;
if (!targets[name]) {
targets[name] = {
total: 0,
active: 0,
};
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
}
2020-02-03 06:14:25 -08:00
targets[name].total++;
targets[name].active++;
}
for (const target of droppedTargets) {
const { job: name } = target.discoveredLabels;
if (!targets[name]) {
targets[name] = {
total: 0,
active: 0,
};
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
}
2020-02-03 06:14:25 -08:00
targets[name].total++;
}
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
return targets;
};
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
export const processTargets = (activeTargets: Target[], droppedTargets: DroppedTarget[]) => {
const labels: Record<string, TargetLabels[]> = {};
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
for (const target of activeTargets) {
const name = target.scrapePool;
if (!labels[name]) {
labels[name] = [];
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
}
2020-02-03 06:14:25 -08:00
labels[name].push({
discoveredLabels: target.discoveredLabels,
labels: target.labels,
isDropped: false,
});
}
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
for (const target of droppedTargets) {
const { job: name } = target.discoveredLabels;
if (!labels[name]) {
labels[name] = [];
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
}
2020-02-03 06:14:25 -08:00
labels[name].push({
discoveredLabels: target.discoveredLabels,
isDropped: true,
labels: {},
});
}
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
return labels;
};
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
export const ServiceDiscoveryContent: FC<ServiceMap> = ({ activeTargets, droppedTargets }) => {
const targets = processSummary(activeTargets, droppedTargets);
const labels = processTargets(activeTargets, droppedTargets);
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
2020-02-03 06:14:25 -08:00
return (
<>
<h2>Service Discovery</h2>
<ul>
{mapObjEntries(targets, ([k, v]) => (
<li key={k}>
<a href={'#' + k}>
{k} ({v.active} / {v.total} active targets)
</a>
</li>
))}
</ul>
<hr />
{mapObjEntries(labels, ([k, v]) => {
return <LabelsTable value={v} name={k} key={k} />;
})}
</>
);
};
ServiceDiscoveryContent.displayName = 'ServiceDiscoveryContent';
const ServicesWithStatusIndicator = withStatusIndicator(ServiceDiscoveryContent);
const ServiceDiscovery: FC<RouteComponentProps> = () => {
const pathPrefix = usePathPrefix();
const { response, error, isLoading } = useFetch<ServiceMap>(`${pathPrefix}/${API_PATH}/targets`);
2020-02-03 06:14:25 -08:00
return (
<ServicesWithStatusIndicator
{...response.data}
error={error}
isLoading={isLoading}
componentTitle="Service Discovery information"
/>
);
Adds support service discovery page in react ui (#6394) * active targets component completed Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * support for service-discovery in react ui Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * restored prev files Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> * used fc Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed trivial keys Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * FC based labels Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implmented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * minor word change Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * before dropped addressed Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. removed false styles Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Unified buttons with targets screen. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * component for ToggleButton Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * removed false Button Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * implemented suggestions. Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * tests for ToggleMoreLess component Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * fixed nested h3. implemented suggestions Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com> * linted Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 09:41:50 -08:00
};
2020-02-03 06:14:25 -08:00
export default ServiceDiscovery;