From 1ddc2e68bf82b0d56c1fd1341942000094e82858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Jan 2015 11:34:54 +0100 Subject: [PATCH] Further progress on new design --- src/app/directives/all.js | 1 + src/app/directives/dashEditLink.js | 13 +++++-- src/app/directives/topnav.js | 52 ++++++++++++++++++++++++++ src/app/partials/dashboard_topnav.html | 32 +++++++--------- src/css/less/grafana.less | 18 +++++++-- 5 files changed, 89 insertions(+), 27 deletions(-) create mode 100644 src/app/directives/topnav.js 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 @@