Skip to content

Commit

Permalink
Remove old nodes endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
skh committed Apr 23, 2019
1 parent 282e974 commit 48b2dbd
Show file tree
Hide file tree
Showing 51 changed files with 32 additions and 2,314 deletions.
88 changes: 0 additions & 88 deletions x-pack/plugins/infra/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export interface InfraSource {
logSummaryBetween: InfraLogSummaryInterval;

logItem: InfraLogItem;
/** A hierarchy of hosts, pods, containers, services or arbitrary groups */
map?: InfraResponse | null;
/** A snapshot of nodes */
snapshot?: InfraSnapshotResponse | null;

Expand Down Expand Up @@ -199,32 +197,6 @@ export interface InfraLogItemField {
value: string;
}

export interface InfraResponse {
nodes: InfraNode[];
}

export interface InfraNode {
path: InfraNodePath[];

metric: InfraNodeMetric;
}

export interface InfraNodePath {
value: string;

label: string;
}

export interface InfraNodeMetric {
name: InfraMetricType;

value: number;

avg: number;

max: number;
}

export interface InfraSnapshotResponse {
/** Nodes of type host, container or pod grouped by 0, 1 or 2 terms */
nodes: InfraSnapshotNode[];
Expand Down Expand Up @@ -313,29 +285,6 @@ export interface InfraTimerangeInput {
from: number;
}

export interface InfraPathInput {
/** The type of path */
type: InfraPathType;
/** The label to use in the results for the group by for the terms group by */
label?: string | null;
/** The field to group by from a terms aggregation, this is ignored by the filter type */
field?: string | null;
/** The fitlers for the filter group by */
filters?: InfraPathFilterInput[] | null;
}
/** A group by filter */
export interface InfraPathFilterInput {
/** The label for the filter, this will be used as the group name in the final results */
label: string;
/** The query string query */
query: string;
}

export interface InfraMetricInput {
/** The type of metric */
type: InfraMetricType;
}

export interface InfraSnapshotGroupbyInput {
/** The label to use in the results for the group by for the terms group by */
label?: string | null;
Expand Down Expand Up @@ -463,11 +412,6 @@ export interface LogSummaryBetweenInfraSourceArgs {
export interface LogItemInfraSourceArgs {
id: string;
}
export interface MapInfraSourceArgs {
timerange: InfraTimerangeInput;

filterQuery?: string | null;
}
export interface SnapshotInfraSourceArgs {
timerange: InfraTimerangeInput;

Expand All @@ -485,11 +429,6 @@ export interface MetricsInfraSourceArgs {
export interface IndexFieldsInfraSourceStatusArgs {
indexType?: InfraIndexType | null;
}
export interface NodesInfraResponseArgs {
path: InfraPathInput[];

metric: InfraMetricInput;
}
export interface NodesInfraSnapshotResponseArgs {
type: InfraNodeType;

Expand Down Expand Up @@ -530,25 +469,6 @@ export enum InfraNodeType {
host = 'host',
}

export enum InfraPathType {
terms = 'terms',
filters = 'filters',
hosts = 'hosts',
pods = 'pods',
containers = 'containers',
custom = 'custom',
}

export enum InfraMetricType {
count = 'count',
cpu = 'cpu',
load = 'load',
memory = 'memory',
tx = 'tx',
rx = 'rx',
logRate = 'logRate',
}

export enum InfraSnapshotMetricType {
count = 'count',
cpu = 'cpu',
Expand Down Expand Up @@ -589,14 +509,6 @@ export enum InfraMetric {
nginxRequestsPerConnection = 'nginxRequestsPerConnection',
}

export enum InfraOperator {
gt = 'gt',
gte = 'gte',
lt = 'lt',
lte = 'lte',
eq = 'eq',
}

// ====================================================
// Unions
// ====================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { EuiButtonEmpty, EuiInMemoryTable, EuiToolTip } from '@elastic/eui';
import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
import { last } from 'lodash';
import React from 'react';
import { InfraNodeType } from '../../../server/lib/adapters/nodes';
import { createWaffleMapNode } from '../../containers/waffle/nodes_to_wafflemap';
import { InfraSnapshotNode, InfraSnapshotNodePath, InfraTimerangeInput } from '../../graphql/types';
import { InfraSnapshotNode, InfraSnapshotNodePath, InfraTimerangeInput, InfraNodeType } from '../../graphql/types';
import { InfraWaffleMapNode, InfraWaffleMapOptions } from '../../lib/lib';
import { fieldToName } from '../waffle/lib/field_to_display_name';
import { NodeContextMenu } from '../waffle/node_context_menu';
Expand Down Expand Up @@ -72,7 +71,7 @@ export const TableView = injectI18n(
</NodeContextMenu>
),
},
...options.groupBy.map((grouping, index) => ({
...options.groupby.map((grouping, index) => ({
field: `group_${index}`,
name: fieldToName((grouping && grouping.field) || '', intl),
sortable: true,
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/infra/public/components/waffle/group_name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export class GroupName extends React.PureComponent<Props, {}> {

private handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
const { groupBy } = this.props.options;
const { groupby } = this.props.options;
// When groupBy is empty that means there is nothing todo so let's just do nothing.
if (groupBy.length === 0) {
if (groupby.length === 0) {
return;
}
const currentPath = this.props.isChild && groupBy.length > 1 ? groupBy[1] : groupBy[0];
const currentPath = this.props.isChild && groupby.length > 1 ? groupby[1] : groupby[0];
this.props.onDrilldown(`${currentPath.field}: "${this.props.group.name}"`);
};
}
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/infra/public/components/waffle/node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import React from 'react';

import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
import euiStyled from '../../../../../common/eui_styled_components';
import { InfraNodeType } from '../../../server/lib/adapters/nodes';
import { InfraTimerangeInput } from '../../graphql/types';
import { InfraTimerangeInput, InfraNodeType } from '../../graphql/types';
import { InfraWaffleMapBounds, InfraWaffleMapNode, InfraWaffleMapOptions } from '../../lib/lib';
import { colorFromValue } from './lib/color_from_value';
import { NodeContextMenu } from './node_context_menu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ import {
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import React from 'react';

import { InfraMetricInput, InfraMetricType, InfraNodeType } from '../../graphql/types';
import { InfraSnapshotMetricInput, InfraSnapshotMetricType, InfraNodeType } from '../../graphql/types';

interface Props {
nodeType: InfraNodeType;
metric: InfraMetricInput;
onChange: (metric: InfraMetricInput) => void;
metric: InfraSnapshotMetricInput;
onChange: (metric: InfraSnapshotMetricInput) => void;
intl: InjectedIntl;
}

let OPTIONS: { [P in InfraNodeType]: Array<{ text: string; value: InfraMetricType }> };
let OPTIONS: { [P in InfraNodeType]: Array<{ text: string; value: InfraSnapshotMetricType }> };
const getOptions = (
nodeType: InfraNodeType,
intl: InjectedIntl
): Array<{ text: string; value: InfraMetricType }> => {
): Array<{ text: string; value: InfraSnapshotMetricType }> => {
if (!OPTIONS) {
const CPUUsage = intl.formatMessage({
id: 'xpack.infra.waffle.metricOptions.cpuUsageText',
Expand All @@ -53,69 +53,69 @@ const getOptions = (
[InfraNodeType.pod]: [
{
text: CPUUsage,
value: InfraMetricType.cpu,
value: InfraSnapshotMetricType.cpu,
},
{
text: MemoryUsage,
value: InfraMetricType.memory,
value: InfraSnapshotMetricType.memory,
},
{
text: InboundTraffic,
value: InfraMetricType.rx,
value: InfraSnapshotMetricType.rx,
},
{
text: OutboundTraffic,
value: InfraMetricType.tx,
value: InfraSnapshotMetricType.tx,
},
],
[InfraNodeType.container]: [
{
text: CPUUsage,
value: InfraMetricType.cpu,
value: InfraSnapshotMetricType.cpu,
},
{
text: MemoryUsage,
value: InfraMetricType.memory,
value: InfraSnapshotMetricType.memory,
},
{
text: InboundTraffic,
value: InfraMetricType.rx,
value: InfraSnapshotMetricType.rx,
},
{
text: OutboundTraffic,
value: InfraMetricType.tx,
value: InfraSnapshotMetricType.tx,
},
],
[InfraNodeType.host]: [
{
text: CPUUsage,
value: InfraMetricType.cpu,
value: InfraSnapshotMetricType.cpu,
},
{
text: MemoryUsage,
value: InfraMetricType.memory,
value: InfraSnapshotMetricType.memory,
},
{
text: intl.formatMessage({
id: 'xpack.infra.waffle.metricOptions.loadText',
defaultMessage: 'Load',
}),
value: InfraMetricType.load,
value: InfraSnapshotMetricType.load,
},
{
text: InboundTraffic,
value: InfraMetricType.rx,
value: InfraSnapshotMetricType.rx,
},
{
text: OutboundTraffic,
value: InfraMetricType.tx,
value: InfraSnapshotMetricType.tx,
},
{
text: intl.formatMessage({
id: 'xpack.infra.waffle.metricOptions.hostLogRateText',
defaultMessage: 'Log Rate',
}),
value: InfraMetricType.logRate,
value: InfraSnapshotMetricType.logRate,
},
],
};
Expand Down Expand Up @@ -193,7 +193,7 @@ export const WaffleMetricControls = injectI18n(
this.setState(state => ({ isPopoverOpen: !state.isPopoverOpen }));
};

private handleClick = (value: InfraMetricType) => () => {
private handleClick = (value: InfraSnapshotMetricType) => () => {
this.props.onChange({ type: value });
this.handleClose();
};
Expand Down
26 changes: 3 additions & 23 deletions x-pack/plugins/infra/public/containers/with_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
import moment from 'moment';
import React from 'react';

import { InfraMetricType, InfraPathType } from '../graphql/types';
import { InfraSnapshotMetricType } from '../graphql/types';
import {
InfraFormatterType,
InfraOptions,
InfraWaffleMapLegendMode,
// InfraWaffleMapRuleOperator,
} from '../lib/lib';
import { RendererFunction } from '../utils/typed_react';

Expand All @@ -29,27 +28,8 @@ const initialState = {
wafflemap: {
formatter: InfraFormatterType.percent,
formatTemplate: '{{value}}',
metric: { type: InfraMetricType.cpu },
path: [{ type: InfraPathType.hosts }],
/*
legend: {
type: InfraWaffleMapLegendMode.step,
rules: [
{
value: 0,
color: '#00B3A4',
operator: InfraWaffleMapRuleOperator.gte,
label: 'Ok',
},
{
value: 10000,
color: '#DB1374',
operator: InfraWaffleMapRuleOperator.gte,
label: 'Over 10,000',
},
],
},
*/
metric: { type: InfraSnapshotMetricType.cpu },
groupby: [],
legend: {
type: InfraWaffleMapLegendMode.gradient,
rules: [
Expand Down
Loading

0 comments on commit 48b2dbd

Please sign in to comment.