mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-19 13:29:35 +00:00
scope-app: * Adds `-app.metrics-graph` cli flag for configuring the base url to use for graph links; supports :orgID and :query placeholders * Assigns query URLs to existing metrics and appends empty metrics if missing scope-ui: * Extends <CloudFeature /> with option alwaysShow * Adds <CloudLink /> to simplify routing when in cloud vs not in cloud * Links metric graphs in the ui's node details view for all k8s toplogies and containers so far * Tracks metric graph click in mixpanel `scope.node.metric.click` * Uses percentages and MB for CPU/Memory urls * Passes timetravel timestamp to cortex in deeplink
63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
import React from 'react';
|
|
|
|
import ShowMore from '../show-more';
|
|
import NodeDetailsHealthLinkItem from './node-details-health-link-item';
|
|
|
|
export default class NodeDetailsHealth extends React.Component {
|
|
|
|
constructor(props, context) {
|
|
super(props, context);
|
|
this.state = {
|
|
expanded: false
|
|
};
|
|
this.handleClickMore = this.handleClickMore.bind(this);
|
|
}
|
|
|
|
handleClickMore() {
|
|
const expanded = !this.state.expanded;
|
|
this.setState({expanded});
|
|
}
|
|
|
|
render() {
|
|
const {
|
|
metrics = [],
|
|
topologyId,
|
|
} = this.props;
|
|
|
|
let primeMetrics = metrics.filter(m => !m.valueEmpty);
|
|
let emptyMetrics = metrics.filter(m => m.valueEmpty);
|
|
|
|
if (primeMetrics.length === 0 && emptyMetrics.length > 0) {
|
|
primeMetrics = emptyMetrics;
|
|
emptyMetrics = [];
|
|
}
|
|
|
|
const shownWithData = this.state.expanded ? primeMetrics : primeMetrics.slice(0, 3);
|
|
const shownEmpty = this.state.expanded ? emptyMetrics : [];
|
|
const notShown = metrics.length - shownWithData.length - shownEmpty.length;
|
|
|
|
return (
|
|
<div className="node-details-health" style={{ justifyContent: 'space-around' }}>
|
|
<div className="node-details-health-wrapper">
|
|
{shownWithData.map(item => <NodeDetailsHealthLinkItem
|
|
{...item}
|
|
key={item.id}
|
|
topologyId={topologyId}
|
|
/>)}
|
|
</div>
|
|
<div className="node-details-health-wrapper">
|
|
{shownEmpty.map(item => <NodeDetailsHealthLinkItem
|
|
{...item}
|
|
key={item.id}
|
|
topologyId={topologyId}
|
|
/>)}
|
|
</div>
|
|
<ShowMore
|
|
handleClick={this.handleClickMore} collection={metrics}
|
|
expanded={this.state.expanded} notShown={notShown} hideNumber={this.state.expanded}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|