diff --git a/public/app/core/components/switch.ts b/public/app/core/components/switch.ts index 2a64ec487f7..889398d5138 100644 --- a/public/app/core/components/switch.ts +++ b/public/app/core/components/switch.ts @@ -9,7 +9,7 @@ import Drop from 'tether-drop'; var template = ` diff --git a/public/app/features/dashboard/all.js b/public/app/features/dashboard/all.js index c3a71a11818..5a3d6ea5203 100644 --- a/public/app/features/dashboard/all.js +++ b/public/app/features/dashboard/all.js @@ -22,4 +22,5 @@ define([ './ad_hoc_filters', './row/row_ctrl', './repeat_option/repeat_option', + './event_editor', ], function () {}); diff --git a/public/app/features/dashboard/event_editor.ts b/public/app/features/dashboard/event_editor.ts new file mode 100644 index 00000000000..35606a5ac73 --- /dev/null +++ b/public/app/features/dashboard/event_editor.ts @@ -0,0 +1,22 @@ +/// + +import _ from 'lodash'; +import coreModule from 'app/core/core_module'; + +export class EventEditorCtrl { + /** @ngInject */ + constructor() { + } +} + +export function eventEditor() { + return { + restrict: 'E', + controller: EventEditorCtrl, + bindToController: true, + controllerAs: 'ctrl', + templateUrl: 'public/app/features/dashboard/partials/event_editor.html', + }; +} + +coreModule.directive('eventEditor', eventEditor); diff --git a/public/app/features/dashboard/partials/event_editor.html b/public/app/features/dashboard/partials/event_editor.html new file mode 100644 index 00000000000..3aaa9d6855f --- /dev/null +++ b/public/app/features/dashboard/partials/event_editor.html @@ -0,0 +1,27 @@ +
+
Add annotation event
+ +
+ Title + +
+
+ Time + +
+
+ To + +
+
+ Description + +
+
+ +
+ +
diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index 4d68e10bbc0..a0e18dae597 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -19,7 +19,7 @@ import GraphTooltip from './graph_tooltip'; import {ThresholdManager} from './threshold_manager'; import {convertValuesToHistogram, getSeriesValues} from './histogram'; -coreModule.directive('grafanaGraph', function($rootScope, timeSrv) { +coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) { return { restrict: 'A', template: '', @@ -91,10 +91,23 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) { to: null }; - ctrl.showAddAnnotationModal(timeRange); + showAddAnnotationView(timeRange); } }, scope); + function showAddAnnotationView(timeRange) { + popoverSrv.show({ + element: elem[0], + position: 'bottom center', + openOn: 'click', + template: '', + model: { + timeRange: timeRange, + panelCtrl: ctrl, + }, + }); + } + function getLegendHeight(panelHeight) { if (!panel.legend.show || panel.legend.rightSide) { return 0; @@ -658,7 +671,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) { if (ranges.ctrlKey || ranges.metaKey) { // Create new annotation from time range let timeRange = ranges.xaxis; - ctrl.showAddAnnotationModal(timeRange); + showAddAnnotationView(timeRange); plot.clearSelection(); } else { scope.$apply(function() {