Browse Source

Threshold change button #161 (#171)

* remove blur event handler from threshold input fields
* Send threshold parameters to server via button click
* disable 'Apply' button on Learning || Pending statuses
master
sanke1 6 years ago committed by rozetko
parent
commit
22f4f15a55
  1. 5
      src/panel/graph_panel/controllers/analytic_controller.ts
  2. 12
      src/panel/graph_panel/partials/tab_analytics.html

5
src/panel/graph_panel/controllers/analytic_controller.ts

@ -76,6 +76,11 @@ export class AnalyticController {
return result; return result;
} }
async sendThresholdParamsToServer(id: AnalyticUnitId) {
await this.saveThreshold(id);
await this._runStatusWaiter(this._analyticUnitsSet.byId(id));
}
createNew() { createNew() {
this._newAnalyticUnit = new AnalyticUnit(); this._newAnalyticUnit = new AnalyticUnit();
this._creatingNewAnalyticType = true; this._creatingNewAnalyticType = true;

12
src/panel/graph_panel/partials/tab_analytics.html

@ -68,9 +68,7 @@
ng-model="ctrl.analyticsController.getThreshold(analyticUnit.id).condition" ng-model="ctrl.analyticsController.getThreshold(analyticUnit.id).condition"
ng-options="type for type in ctrl.analyticsController.conditions" ng-options="type for type in ctrl.analyticsController.conditions"
ng-if="analyticUnit.detectorType === 'threshold'" ng-if="analyticUnit.detectorType === 'threshold'"
ng-blur="ctrl.analyticsController.saveThreshold(analyticUnit.id)"
/> />
<input <input
class="gf-form-input width-5" class="gf-form-input width-5"
type="number" type="number"
@ -79,8 +77,16 @@
analyticUnit.detectorType === 'threshold' && analyticUnit.detectorType === 'threshold' &&
ctrl.analyticsController.getThreshold(analyticUnit.id).condition != 'NO_DATA' ctrl.analyticsController.getThreshold(analyticUnit.id).condition != 'NO_DATA'
" "
ng-blur="ctrl.analyticsController.saveThreshold(analyticUnit.id)"
/> />
<!-- TODO set .saving flag to thresholds, when learning is in progress -->
<button
class="btn btn-inverse"
ng-if="analyticUnit.detectorType === 'threshold'"
ng-click="ctrl.analyticsController.sendThresholdParamsToServer(analyticUnit.id)"
ng-disabled="analyticUnit.status === 'PENDING' || analyticUnit.status === 'LEARNING'"
>
Apply
</button>
<label class="gf-form-label"> <label class="gf-form-label">
<a <a

Loading…
Cancel
Save