Typescript: Fixed strict null errors. (#25609)

pull/25619/head
Marcus Andersson 5 years ago committed by GitHub
parent bd76c66e50
commit fb7d036fa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      public/app/plugins/panel/bargauge/BarGaugePanel.tsx
  2. 2
      public/app/plugins/panel/gauge/GaugePanel.tsx
  3. 5
      public/app/plugins/panel/graph/module.ts
  4. 3
      public/app/plugins/panel/news/module.tsx
  5. 2
      public/app/plugins/panel/singlestat/specs/singlestat.test.ts
  6. 2
      public/app/plugins/panel/stat/StatPanel.tsx
  7. 4
      scripts/ci-frontend-metrics.sh

@ -45,7 +45,7 @@ export class BarGaugePanel extends PureComponent<PanelProps<BarGaugeOptions>> {
const { value } = valueProps; const { value } = valueProps;
const { hasLinks, getLinks } = value; const { hasLinks, getLinks } = value;
if (!hasLinks) { if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {}); return this.renderComponent(valueProps, {});
} }

@ -35,7 +35,7 @@ export class GaugePanel extends PureComponent<PanelProps<GaugeOptions>> {
const { value } = valueProps; const { value } = valueProps;
const { getLinks, hasLinks } = value; const { getLinks, hasLinks } = value;
if (!hasLinks) { if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {}); return this.renderComponent(valueProps, {});
} }

@ -246,7 +246,7 @@ class GraphCtrl extends MetricsPanelCtrl {
); );
} }
getDataWarning(): DataWarning { getDataWarning(): DataWarning | undefined {
const datapointsCount = this.seriesList.reduce((prev, series) => { const datapointsCount = this.seriesList.reduce((prev, series) => {
return prev + series.datapoints.length; return prev + series.datapoints.length;
}, 0); }, 0);
@ -302,8 +302,7 @@ class GraphCtrl extends MetricsPanelCtrl {
return dataWarning; return dataWarning;
} }
return undefined;
return null;
} }
onRender() { onRender() {

@ -1,3 +1,4 @@
import { isString } from 'lodash';
import { PanelPlugin } from '@grafana/data'; import { PanelPlugin } from '@grafana/data';
import { NewsPanel } from './NewsPanel'; import { NewsPanel } from './NewsPanel';
import { NewsOptions } from './types'; import { NewsOptions } from './types';
@ -18,7 +19,7 @@ export const plugin = new PanelPlugin<NewsOptions>(NewsPanel).setPanelOptions(bu
name: 'Use Proxy', name: 'Use Proxy',
description: 'If the feed is unable to connect, consider a CORS proxy', description: 'If the feed is unable to connect, consider a CORS proxy',
showIf: (currentConfig: NewsOptions) => { 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', () => { 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'); expect(name).toBe('test.cpu1');
}); });

@ -65,7 +65,7 @@ export class StatPanel extends PureComponent<PanelProps<StatPanelOptions>> {
const { value } = valueProps; const { value } = valueProps;
const { getLinks, hasLinks } = value; const { getLinks, hasLinks } = value;
if (!hasLinks) { if (!hasLinks || !getLinks) {
return this.renderComponent(valueProps, {}); return this.renderComponent(valueProps, {});
} }

@ -2,9 +2,7 @@
echo -e "Collecting code stats (typescript errors & more)" echo -e "Collecting code stats (typescript errors & more)"
ERROR_COUNT_LIMIT=724
ERROR_COUNT_LIMIT=726
DIRECTIVES_LIMIT=172 DIRECTIVES_LIMIT=172
CONTROLLERS_LIMIT=139 CONTROLLERS_LIMIT=139

Loading…
Cancel
Save