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"
labelClass={'width-10'}
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')}
/>
</div>

View File

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

View File

@ -518,7 +518,7 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
}
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) => {

View File

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