Fix few null checks to make master green (#25965)

This commit is contained in:
Dominik Prokop 2020-07-01 11:40:37 +02:00 committed by GitHub
parent bd27be1351
commit 19d27351e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

View File

@ -86,7 +86,7 @@ export class ConfigEditor extends PureComponent<Props> {
label="Rollup indicator" label="Rollup indicator"
labelClass={'width-10'} labelClass={'width-10'}
tooltip="Shows up as an info icon in panel headers when data is aggregated" tooltip="Shows up as an info icon in panel headers when data is aggregated"
checked={options.jsonData.rollupIndicatorEnabled} checked={!!options.jsonData.rollupIndicatorEnabled}
onChange={onUpdateDatasourceJsonDataOptionChecked(this.props, 'rollupIndicatorEnabled')} onChange={onUpdateDatasourceJsonDataOptionChecked(this.props, 'rollupIndicatorEnabled')}
/> />
</div> </div>

View File

@ -84,6 +84,7 @@ type DebugField = {
value?: string; value?: string;
href?: string; href?: string;
}; };
function makeDebugFields(derivedFields: DerivedFieldConfig[], debugText: string): DebugField[] { function makeDebugFields(derivedFields: DerivedFieldConfig[], debugText: string): DebugField[] {
return derivedFields return derivedFields
.filter(field => field.name && field.matcherRegex) .filter(field => field.name && field.matcherRegex)
@ -91,7 +92,7 @@ function makeDebugFields(derivedFields: DerivedFieldConfig[], debugText: string)
try { try {
const testMatch = debugText.match(field.matcherRegex); const testMatch = debugText.match(field.matcherRegex);
const value = testMatch && testMatch[1]; const value = testMatch && testMatch[1];
let link: LinkModel<Field>; let link: LinkModel<Field> = null;
if (field.url && value) { if (field.url && value) {
link = getFieldLinksForExplore( link = getFieldLinksForExplore(

View File

@ -518,7 +518,7 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
} }
showContextToggle = (row?: LogRowModel) => { showContextToggle = (row?: LogRowModel) => {
return row.searchWords && row.searchWords.length > 0; return row && row.searchWords && row.searchWords.length > 0;
}; };
throwUnless = (err: any, condition: boolean, target: LokiQuery) => { throwUnless = (err: any, condition: boolean, target: LokiQuery) => {

View File

@ -502,7 +502,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
function addSparkline() { function addSparkline() {
const data: ShowData = ctrl.data; const data: ShowData = ctrl.data;
const width = elem.width(); const width = elem.width();
if (width < 30) { if (width && width < 30) {
// element has not gotten it's width yet // element has not gotten it's width yet
// delay sparkline render // delay sparkline render
setTimeout(addSparkline, 30); setTimeout(addSparkline, 30);