Browse Source

Anomaly detector bounds: switch disabling to enabling #356 (#360)

master
Evgeny Smyshlyaev 5 years ago committed by rozetko
parent
commit
dd3fdc254c
  1. 12
      src/panel/graph_panel/models/analytic_units/anomaly_analytic_unit.ts
  2. 4
      src/panel/graph_panel/partials/analytic_unit.html

12
src/panel/graph_panel/models/analytic_units/anomaly_analytic_unit.ts

@ -9,13 +9,13 @@ type TimePeriod = {
}; };
enum Bound { enum Bound {
NONE = 'NONE', ALL = 'ALL',
UPPER = 'UPPER', UPPER = 'UPPER',
LOWER = 'LOWER' LOWER = 'LOWER'
}; };
export const BOUND_TYPES = [ export const BOUND_TYPES = [
{ name: 'None', value: Bound.NONE }, { name: 'Both', value: Bound.ALL },
{ name: 'Upper', value: Bound.UPPER }, { name: 'Upper', value: Bound.UPPER },
{ name: 'Lower', value: Bound.LOWER } { name: 'Lower', value: Bound.LOWER }
]; ];
@ -30,7 +30,7 @@ const DEFAULTS = {
value: 0, value: 0,
unit: 'seconds' unit: 'seconds'
}, },
disableBound: Bound.NONE enableBounds: Bound.ALL
}; };
const LABELING_MODES = [ const LABELING_MODES = [
@ -53,7 +53,7 @@ export class AnomalyAnalyticUnit extends AnalyticUnit {
confidence: this.confidence, confidence: this.confidence,
seasonality: this.seasonality, seasonality: this.seasonality,
seasonalityPeriod: this.seasonalityPeriod, seasonalityPeriod: this.seasonalityPeriod,
disableBound: this.disableBound enableBounds: this.enableBounds
}; };
} }
@ -72,8 +72,8 @@ export class AnomalyAnalyticUnit extends AnalyticUnit {
set seasonalityPeriod(val: TimePeriod) { this._serverObject.seasonalityPeriod = val; } set seasonalityPeriod(val: TimePeriod) { this._serverObject.seasonalityPeriod = val; }
get seasonalityPeriod(): TimePeriod { return this._serverObject.seasonalityPeriod; } get seasonalityPeriod(): TimePeriod { return this._serverObject.seasonalityPeriod; }
set disableBound(val: Bound) { this._serverObject.disableBound = val; } set enableBounds(val: Bound) { this._serverObject.enableBounds = val; }
get disableBound(): Bound { return this._serverObject.disableBound; } get enableBounds(): Bound { return this._serverObject.enableBounds; }
// TODO: merge seasonality and hasSeasonality // TODO: merge seasonality and hasSeasonality
set hasSeasonality(val: boolean) { set hasSeasonality(val: boolean) {

4
src/panel/graph_panel/partials/analytic_unit.html

@ -155,10 +155,10 @@
<div class="gf-form-inline" ng-if="analyticUnit.detectorType === 'anomaly'"> <div class="gf-form-inline" ng-if="analyticUnit.detectorType === 'anomaly'">
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label query-keyword width-8"> Disable bound </label> <label class="gf-form-label query-keyword width-8"> Enabled bounds </label>
<div class="gf-form-select-wrapper"> <div class="gf-form-select-wrapper">
<select class="gf-form-input width-12" <select class="gf-form-input width-12"
ng-model="analyticUnit.disableBound" ng-model="analyticUnit.enableBounds"
ng-change="ctrl.onAnalyticUnitChange(analyticUnit)" ng-change="ctrl.onAnalyticUnitChange(analyticUnit)"
ng-options="bound.value as bound.name for bound in ctrl.boundTypes" ng-options="bound.value as bound.name for bound in ctrl.boundTypes"
/> />

Loading…
Cancel
Save