mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
more work on annotations
This commit is contained in:
@@ -135,6 +135,7 @@ export class AnnotationsSrv {
|
||||
}
|
||||
|
||||
saveAnnotationEvent(annotation) {
|
||||
this.globalAnnotationsPromise = null;
|
||||
return this.backendSrv.post('/api/annotations', annotation);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
import coreModule from 'app/core/core_module';
|
||||
import {coreModule} from 'app/core/core';
|
||||
import {MetricsPanelCtrl} from 'app/plugins/sdk';
|
||||
|
||||
export class AnnotationEvent {
|
||||
@@ -20,13 +20,13 @@ export class EventEditorCtrl {
|
||||
annotation: AnnotationEvent;
|
||||
timeRange: {from: number, to: number};
|
||||
form: any;
|
||||
close: any;
|
||||
|
||||
/** @ngInject **/
|
||||
constructor(private annotationsSrv) {
|
||||
this.annotation = new AnnotationEvent();
|
||||
this.annotation.panelId = this.panelCtrl.panel.id;
|
||||
this.annotation.dashboardId = this.panelCtrl.dashboard.id;
|
||||
this.annotation.text = "hello";
|
||||
|
||||
this.annotation.time = moment(this.timeRange.from);
|
||||
if (this.timeRange.to) {
|
||||
@@ -51,7 +51,10 @@ export class EventEditorCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
this.annotationsSrv.saveAnnotationEvent(saveModel);
|
||||
this.annotationsSrv.saveAnnotationEvent(saveModel).then(() => {
|
||||
this.panelCtrl.refresh();
|
||||
this.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +68,7 @@ export function eventEditor() {
|
||||
scope: {
|
||||
"panelCtrl": "=",
|
||||
"timeRange": "=",
|
||||
"cancel": "&",
|
||||
"close": "&",
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div class="gf-form-button-row">
|
||||
<button type="submit" class="btn gf-form-btn btn-success" ng-click="ctrl.save()">Save</button>
|
||||
<a class="btn-text" ng-click="ctrl.cancel();">Cancel</a>
|
||||
<a class="btn-text" ng-click="ctrl.close();">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user