mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Typescript: Fixed strict null errors. (#25609)
This commit is contained in:
parent
bd76c66e50
commit
fb7d036fa4
@ -45,7 +45,7 @@ export class BarGaugePanel extends PureComponent<PanelProps<BarGaugeOptions>> {
|
||||
const { value } = valueProps;
|
||||
const { hasLinks, getLinks } = value;
|
||||
|
||||
if (!hasLinks) {
|
||||
if (!hasLinks || !getLinks) {
|
||||
return this.renderComponent(valueProps, {});
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ export class GaugePanel extends PureComponent<PanelProps<GaugeOptions>> {
|
||||
const { value } = valueProps;
|
||||
const { getLinks, hasLinks } = value;
|
||||
|
||||
if (!hasLinks) {
|
||||
if (!hasLinks || !getLinks) {
|
||||
return this.renderComponent(valueProps, {});
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ class GraphCtrl extends MetricsPanelCtrl {
|
||||
);
|
||||
}
|
||||
|
||||
getDataWarning(): DataWarning {
|
||||
getDataWarning(): DataWarning | undefined {
|
||||
const datapointsCount = this.seriesList.reduce((prev, series) => {
|
||||
return prev + series.datapoints.length;
|
||||
}, 0);
|
||||
@ -302,8 +302,7 @@ class GraphCtrl extends MetricsPanelCtrl {
|
||||
|
||||
return dataWarning;
|
||||
}
|
||||
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
onRender() {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { isString } from 'lodash';
|
||||
import { PanelPlugin } from '@grafana/data';
|
||||
import { NewsPanel } from './NewsPanel';
|
||||
import { NewsOptions } from './types';
|
||||
@ -18,7 +19,7 @@ export const plugin = new PanelPlugin<NewsOptions>(NewsPanel).setPanelOptions(bu
|
||||
name: 'Use Proxy',
|
||||
description: 'If the feed is unable to connect, consider a CORS proxy',
|
||||
showIf: (currentConfig: NewsOptions) => {
|
||||
return currentConfig.feedUrl && !currentConfig.feedUrl.startsWith(PROXY_PREFIX);
|
||||
return isString(currentConfig.feedUrl) && !currentConfig.feedUrl.startsWith(PROXY_PREFIX);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -90,7 +90,7 @@ describe('SingleStatCtrl', () => {
|
||||
});
|
||||
|
||||
it('Should use series avg as default main value', () => {
|
||||
const name = getFieldDisplayName(ctx.data.field);
|
||||
const name = getFieldDisplayName(ctx.data.field!);
|
||||
expect(name).toBe('test.cpu1');
|
||||
});
|
||||
|
||||
|
@ -65,7 +65,7 @@ export class StatPanel extends PureComponent<PanelProps<StatPanelOptions>> {
|
||||
const { value } = valueProps;
|
||||
const { getLinks, hasLinks } = value;
|
||||
|
||||
if (!hasLinks) {
|
||||
if (!hasLinks || !getLinks) {
|
||||
return this.renderComponent(valueProps, {});
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
echo -e "Collecting code stats (typescript errors & more)"
|
||||
|
||||
|
||||
|
||||
ERROR_COUNT_LIMIT=726
|
||||
ERROR_COUNT_LIMIT=724
|
||||
DIRECTIVES_LIMIT=172
|
||||
CONTROLLERS_LIMIT=139
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user