diff --git a/src/app/directives/all.js b/src/app/directives/all.js index 879b61e2512..4126ec81b9a 100644 --- a/src/app/directives/all.js +++ b/src/app/directives/all.js @@ -16,4 +16,5 @@ define([ './graphiteSegment', './grafanaVersionCheck', './dropdown.typeahead', + './topnav', ], function () {}); diff --git a/src/app/directives/dashEditLink.js b/src/app/directives/dashEditLink.js index b44b048f9d4..b8f3cae2da3 100644 --- a/src/app/directives/dashEditLink.js +++ b/src/app/directives/dashEditLink.js @@ -6,9 +6,9 @@ function (angular, $) { 'use strict'; var editViewMap = { - 'settings': 'app/partials/dasheditor.html', - 'annotations': 'app/features/annotations/partials/editor.html', - 'templating': 'app/partials/templating_editor.html', + 'settings': { src: 'app/partials/dasheditor.html', title: "Settings" }, + 'annotations': { src: 'app/features/annotations/partials/editor.html', title: "Annotations" }, + 'templating': { src: 'app/partials/templating_editor.html', title: "Templating" } }; angular @@ -55,7 +55,10 @@ function (angular, $) { } function showEditorPane(evt, payload, editview) { - if (editview) { payload.src = editViewMap[editview]; } + if (editview) { + scope.grafana.editview = editViewMap[editview]; + payload.src = scope.grafana.editview.src; + } if (lastEditor === payload.src) { hideEditorPane(); @@ -98,10 +101,12 @@ function (angular, $) { if (newValue) { showEditorPane(null, {}, newValue); } else if (oldValue) { + scope.grafana.editview = null; hideEditorPane(); } }); + scope.grafana.editview = null; scope.$on("$destroy", hideEditorPane); scope.onAppEvent('hide-dash-editor', hideEditorPane); scope.onAppEvent('show-dash-editor', showEditorPane); diff --git a/src/app/directives/topnav.js b/src/app/directives/topnav.js new file mode 100644 index 00000000000..3d670983309 --- /dev/null +++ b/src/app/directives/topnav.js @@ -0,0 +1,52 @@ +define([ + 'angular', + 'kbn' +], +function (angular) { + 'use strict'; + + angular + .module('grafana.directives') + .directive('topnav', function() { + return { + restrict: 'E', + scope: { + title: "@", + section: "@", + titleAction: "&", + toggle: "&", + showMenuBtn: "=", + }, + template: + '
' + + '' + + '' + + '' + + 'menu' + + '' + + '' + + + '' + + '' + + '' + + '' + + + '' + + '{{section}}' + + '' + + '' + + + '' + + '{{title}}' + + '' + + '' + + '' + + '' + + '
', + link: function(scope, elem, attrs) { + scope.icon = attrs.icon; + } + }; + }); + +}); diff --git a/src/app/partials/dashboard_topnav.html b/src/app/partials/dashboard_topnav.html index e8edf4eea4f..b75de3f3f2f 100644 --- a/src/app/partials/dashboard_topnav.html +++ b/src/app/partials/dashboard_topnav.html @@ -2,26 +2,20 @@