Graphite: Rollup Indicator (#22738)

* WIP: Rollup indiator progress

* Progress

* Progress, can now open inspector with right tab

* changed type and made inspect

* Showing stats

* Progress

* Progress

* Getting ready for v1

* Added option and fixed some strict nulls

* Updated

* Fixed test
This commit is contained in:
Torkel Ödegaard
2020-03-18 13:00:14 +01:00
committed by GitHub
parent 579abad9cc
commit 044ec40112
21 changed files with 631 additions and 226 deletions
@@ -1,6 +1,15 @@
import React from 'react';
import { mount, ReactWrapper } from 'enzyme';
import { PanelData, dateMath, TimeRange, VizOrientation, PanelProps, LoadingState, dateTime } from '@grafana/data';
import {
PanelData,
dateMath,
TimeRange,
VizOrientation,
PanelProps,
LoadingState,
dateTime,
toDataFrame,
} from '@grafana/data';
import { BarGaugeDisplayMode } from '@grafana/ui';
import { BarGaugePanel } from './BarGaugePanel';
@@ -19,6 +28,27 @@ describe('BarGaugePanel', () => {
expect(displayValue).toBe('No data');
});
});
describe('when there is data', () => {
const wrapper = createBarGaugePanelWithData({
series: [
toDataFrame({
target: 'test',
datapoints: [
[100, 1000],
[100, 200],
],
}),
],
timeRange: createTimeRange(),
state: LoadingState.Done,
});
it('should render with title "No data"', () => {
const displayValue = wrapper.find('div.bar-gauge__value').text();
expect(displayValue).toBe('100');
});
});
});
function createTimeRange(): TimeRange {
@@ -6,7 +6,7 @@ import { NewsOptions, DEFAULT_FEED_URL } from './types';
const PROXY_PREFIX = 'https://cors-anywhere.herokuapp.com/';
interface State {
feedUrl: string;
feedUrl?: string;
}
export class NewsPanelEditor extends PureComponent<PanelEditorProps<NewsOptions>, State> {
@@ -41,27 +41,29 @@ export class NewsPanelEditor extends PureComponent<PanelEditorProps<NewsOptions>
return (
<>
<PanelOptionsGroup title="Feed">
<div className="gf-form">
<FormField
label="URL"
labelWidth={7}
inputWidth={30}
value={feedUrl || ''}
placeholder={DEFAULT_FEED_URL}
onChange={this.onFeedUrlChange}
tooltip="Only RSS feed formats are supported (not Atom)."
onBlur={this.onUpdatePanel}
/>
</div>
{suggestProxy && (
<div>
<br />
<div>If the feed is unable to connect, consider a CORS proxy</div>
<Button variant="inverse" onClick={this.onSetProxyPrefix}>
Use Proxy
</Button>
<>
<div className="gf-form">
<FormField
label="URL"
labelWidth={7}
inputWidth={30}
value={feedUrl || ''}
placeholder={DEFAULT_FEED_URL}
onChange={this.onFeedUrlChange}
tooltip="Only RSS feed formats are supported (not Atom)."
onBlur={this.onUpdatePanel}
/>
</div>
)}
{suggestProxy && (
<div>
<br />
<div>If the feed is unable to connect, consider a CORS proxy</div>
<Button variant="inverse" onClick={this.onSetProxyPrefix}>
Use Proxy
</Button>
</div>
)}
</>
</PanelOptionsGroup>
</>
);
@@ -175,7 +175,8 @@ class SingleStatCtrl extends MetricsPanelCtrl {
}
const distinct = getDistinctNames(frames);
let fieldInfo = distinct.byName[panel.tableColumn]; //
let fieldInfo: FieldInfo | undefined = distinct.byName[panel.tableColumn];
this.fieldNames = distinct.names;
if (!fieldInfo) {