From f00e5936c99d12a6ddc4b44ec671219f9b458082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 31 Jan 2015 18:00:26 +0100 Subject: [PATCH] New design work --- src/app/controllers/sidemenuCtrl.js | 36 ++-- src/app/directives/topnav.js | 9 +- .../features/annotations/partials/editor.html | 23 +-- .../features/profile/partials/profile.html | 1 - src/app/partials/dashboard_topnav.html | 27 ++- src/app/partials/sidemenu.html | 53 +++--- src/app/partials/templating_editor.html | 175 +++++++++--------- src/css/less/grafana.less | 16 +- src/css/less/sidemenu.less | 65 ++++--- 9 files changed, 213 insertions(+), 192 deletions(-) diff --git a/src/app/controllers/sidemenuCtrl.js b/src/app/controllers/sidemenuCtrl.js index 28e826646e8..708564d8a8a 100644 --- a/src/app/controllers/sidemenuCtrl.js +++ b/src/app/controllers/sidemenuCtrl.js @@ -17,17 +17,16 @@ function (angular, _, $, config) { $scope.menu = []; $scope.menu.push({ - text: "Dashbord", + text: "Dashbords", + icon: "fa fa-th-large", href: $scope.getUrl("/"), startsWith: config.appSubUrl + '/dashboard/', - icon: "fa fa-th-large", - links: [ - { text: 'Settings', editview: 'settings'}, - { text: 'Templating', editview: 'templating'}, - { text: 'Annotations', editview: 'annotations'}, - { text: 'Export', href:""}, - { text: 'JSON', href:""}, - ] + }); + + $scope.menu.push({ + text: "Data Sources", + icon: "fa fa-database", + href: $scope.getUrl("/account/datasources"), }); if ($scope.grafana.user.accountRole === 'Admin') { @@ -48,11 +47,13 @@ function (angular, _, $, config) { $scope.menu.push({ text: "Profile", href: $scope.getUrl("/profile"), icon: "fa fa-user", - requireSignedIn: true, - links: [ - { text: 'Info', href: $scope.getUrl("/profile"), icon: "fa fa-sitemap" }, - { text: 'Password', href:"", icon: "fa fa-lock" }, - ] + }); + } + + if ($scope.grafana.user.isSignedIn) { + $scope.menu.push({ + text: "Sign out", href: $scope.getUrl("/logout"), + icon: "fa fa-sign-out", }); } @@ -80,18 +81,21 @@ function (angular, _, $, config) { $scope.updateState = function() { var currentPath = config.appSubUrl + $location.path(); var search = $location.search(); + var activeIndex; - _.each($scope.menu, function(item) { + _.each($scope.menu, function(item, index) { item.active = false; if (item.href === currentPath) { item.active = true; + activeIndex = index; } if (item.startsWith) { if (currentPath.indexOf(item.startsWith) === 0) { item.active = true; item.href = currentPath; + activeIndex = index; } } @@ -114,6 +118,8 @@ function (angular, _, $, config) { } }); }); + + //$scope.menu.splice(0, 0, $scope.menu.splice(activeIndex, 1)[0]); }; $scope.init = function() { diff --git a/src/app/directives/topnav.js b/src/app/directives/topnav.js index 5ff418c7c77..d987b652535 100644 --- a/src/app/directives/topnav.js +++ b/src/app/directives/topnav.js @@ -24,13 +24,12 @@ function (angular) { '' + '' + '' + - 'menu' + + '' + '' + '' + '' + '' + - '' + '' + '' + @@ -69,13 +68,12 @@ function (angular) { '' + '' + '' + - 'menu' + + '' + '' + '' + '' + '' + - '' + '' + '' + @@ -85,9 +83,6 @@ function (angular) { '' + '{{title}}' + - '' + - '' + - '' + '' + '', link: function(scope, elem, attrs) { diff --git a/src/app/features/annotations/partials/editor.html b/src/app/features/annotations/partials/editor.html index ae2d624edd9..47511ff755b 100644 --- a/src/app/features/annotations/partials/editor.html +++ b/src/app/features/annotations/partials/editor.html @@ -1,19 +1,16 @@
-
-
- - Annotations -
- +
- +
-
+
@@ -71,12 +68,10 @@
+
- -
diff --git a/src/app/features/profile/partials/profile.html b/src/app/features/profile/partials/profile.html index 57ba7a249a0..87d49af0bcf 100644 --- a/src/app/features/profile/partials/profile.html +++ b/src/app/features/profile/partials/profile.html @@ -6,7 +6,6 @@ -
diff --git a/src/app/partials/dashboard_topnav.html b/src/app/partials/dashboard_topnav.html index bd3b9945a2c..90485f0fa55 100644 --- a/src/app/partials/dashboard_topnav.html +++ b/src/app/partials/dashboard_topnav.html @@ -18,6 +18,21 @@ show-menu-btn="!grafana.sidemenu"> + +