|
|
|
|
@ -3,7 +3,7 @@ import _ from 'lodash'; |
|
|
|
|
|
|
|
|
|
// Types
|
|
|
|
|
import { Emitter } from 'app/core/utils/emitter'; |
|
|
|
|
import { DataQuery, TimeSeries } from '@grafana/ui'; |
|
|
|
|
import { DataQuery, TimeSeries, Threshold } from '@grafana/ui'; |
|
|
|
|
import { TableData } from '@grafana/ui/src'; |
|
|
|
|
|
|
|
|
|
export interface GridPos { |
|
|
|
|
@ -89,7 +89,9 @@ export class PanelModel { |
|
|
|
|
timeFrom?: any; |
|
|
|
|
timeShift?: any; |
|
|
|
|
hideTimeOverride?: any; |
|
|
|
|
options: object; |
|
|
|
|
options: { |
|
|
|
|
[key: string]: any; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
maxDataPoints?: number; |
|
|
|
|
interval?: string; |
|
|
|
|
@ -117,6 +119,8 @@ export class PanelModel { |
|
|
|
|
_.defaultsDeep(this, _.cloneDeep(defaults)); |
|
|
|
|
// queries must have refId
|
|
|
|
|
this.ensureQueryIds(); |
|
|
|
|
|
|
|
|
|
this.restoreInfintyForThresholds(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ensureQueryIds() { |
|
|
|
|
@ -129,6 +133,19 @@ export class PanelModel { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
restoreInfintyForThresholds() { |
|
|
|
|
if (this.options && this.options.thresholds) { |
|
|
|
|
this.options.thresholds = this.options.thresholds.map((threshold: Threshold) => { |
|
|
|
|
// JSON serialization of -Infinity is 'null' so lets convert it back to -Infinity
|
|
|
|
|
if (threshold.index === 0 && threshold.value === null) { |
|
|
|
|
return { ...threshold, value: -Infinity }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return threshold; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getOptions(panelDefaults) { |
|
|
|
|
return _.defaultsDeep(this.options || {}, panelDefaults); |
|
|
|
|
} |
|
|
|
|
|