diff --git a/src/app/controllers/grafanaCtrl.js b/src/app/controllers/grafanaCtrl.js index 8df9b4155d6..33c7f028567 100644 --- a/src/app/controllers/grafanaCtrl.js +++ b/src/app/controllers/grafanaCtrl.js @@ -10,7 +10,7 @@ function (angular, config, _, $, store) { var module = angular.module('grafana.controllers'); - module.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, grafanaVersion, $rootScope, $controller, userSrv) { + module.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, grafanaVersion, $rootScope, $controller, userSrv, $timeout) { $scope.init = function() { $scope.grafana = {}; @@ -30,6 +30,7 @@ function (angular, config, _, $, store) { $scope.grafana.style = 'dark'; $scope.grafana.user = userSrv.getSignedInUser(); $scope.grafana.sidemenu = store.getBool('grafana.sidemenu'); + $scope.topnav = { title: 'Grafana' }; $scope.onAppEvent('logged-out', function() { $scope.grafana.sidemenu = false; @@ -44,6 +45,10 @@ function (angular, config, _, $, store) { $scope.toggleSideMenu = function() { $scope.grafana.sidemenu = !$scope.grafana.sidemenu; store.set('grafana.sidemenu', $scope.grafana.sidemenu); + + $timeout(function() { + $scope.$broadcast("render"); + }, 50); }; $rootScope.onAppEvent = function(name, callback) { diff --git a/src/app/controllers/sidemenuCtrl.js b/src/app/controllers/sidemenuCtrl.js index 28e826646e8..93954006309 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') { @@ -35,12 +34,16 @@ function (angular, _, $, config) { text: "Account", href: $scope.getUrl("/account"), requireRole: "Admin", icon: "fa fa-shield", - links: [ - { text: 'Info', href: $scope.getUrl("/account")}, - { text: 'Data sources', href: $scope.getUrl("/account/datasources")}, - { text: 'Users', href: $scope.getUrl("/account/users")}, - { text: 'API Keys', href: $scope.getUrl("/account/apikeys")}, - ] + }); + $scope.menu.push({ + text: "Users", href: $scope.getUrl("/account/users"), + requireRole: "Admin", + icon: "fa fa-users", + }); + $scope.menu.push({ + text: "API Keys", href: $scope.getUrl("/account/apikeys"), + requireRole: "Admin", + icon: "fa fa-key", }); } @@ -48,11 +51,6 @@ 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" }, - ] }); } @@ -69,6 +67,14 @@ function (angular, _, $, config) { }); } + if ($scope.grafana.user.isSignedIn) { + $scope.menu.push({ + text: "Sign out", href: $scope.getUrl("/logout"), + target: "_self", + icon: "fa fa-sign-out", + }); + } + $scope.onAppEvent('$routeUpdate', function() { $scope.updateState(); }); @@ -80,18 +86,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 +123,8 @@ function (angular, _, $, config) { } }); }); + + //$scope.menu.splice(0, 0, $scope.menu.splice(activeIndex, 1)[0]); }; $scope.init = function() { 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..b17c73bc14d 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(); @@ -89,7 +92,7 @@ function (angular, $) { hideScrollbars(true); var src = "'" + payload.src + "'"; - var view = $('
'); + var view = $('
'); elem.append(view); $compile(elem.contents())(editorScope); } @@ -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..9228ce9fcb0 --- /dev/null +++ b/src/app/directives/topnav.js @@ -0,0 +1,51 @@ +define([ + 'angular', + 'kbn' +], +function (angular) { + 'use strict'; + + angular + .module('grafana.directives') + .directive('topnav', function() { + return { + restrict: 'E', + transclude: true, + scope: { + title: "@", + section: "@", + titleAction: "&", + toggle: "&", + showMenuBtn: "=", + }, + template: + '', + link: function(scope, elem, attrs) { + scope.icon = attrs.icon; + } + }; + }); + +}); diff --git a/src/app/features/account/partials/account.html b/src/app/features/account/partials/account.html index 5465d0c7094..56e65c8de35 100644 --- a/src/app/features/account/partials/account.html +++ b/src/app/features/account/partials/account.html @@ -1,15 +1,8 @@ -
+ -
+
-
-
- - Account information -
-
- -
+
diff --git a/src/app/features/account/partials/apikeys.html b/src/app/features/account/partials/apikeys.html index 612a29b9a79..cc78bf89d33 100644 --- a/src/app/features/account/partials/apikeys.html +++ b/src/app/features/account/partials/apikeys.html @@ -1,15 +1,13 @@ -
+ + -
+
-
-
- - API Tokens -
-
- -
+
diff --git a/src/app/features/account/partials/datasources.html b/src/app/features/account/partials/datasources.html index b715619262e..25de55c4d4c 100644 --- a/src/app/features/account/partials/datasources.html +++ b/src/app/features/account/partials/datasources.html @@ -1,127 +1,120 @@ -
+ + -
-
-
- -
-
- - Data sources -
- -
-
-
-
- -
- - -
- -
-
-
- No datasources defined -
- - - - - - - - - - - - - - - -
NameUrl
-   - {{ds.name}} - - {{ds.url}} - - - default - - - - - Edit - - - - - -
-
-
- -
-
-
- - -
-
- - -
- -
- -
-
- - -
-
- - -
-
- -
-
-
InfluxDB Details
-
- - -
-
- - -
-
- - -
-
-
-
-
-
Elastic search details
-
- - -
-
-
-
- - - - +
+
+
+
+ +
+
+
+
+
+ No datasources defined +
+ + + + + + + + + + + + + + + +
NameUrl
+   + {{ds.name}} + + {{ds.url}} + + + default + + + + + Edit + + + + + +
+
+
+ +
+
+
+ + +
+
+ + +
+ +
+ +
+
+ + +
+
+ + +
+
+ +
+
+
InfluxDB Details
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
Elastic search details
+
+ + +
+
+
+
+ + + + +
diff --git a/src/app/features/account/partials/users.html b/src/app/features/account/partials/users.html index 819e5ef76ba..3d964aaa1e6 100644 --- a/src/app/features/account/partials/users.html +++ b/src/app/features/account/partials/users.html @@ -1,15 +1,8 @@ -
+ -
+
-
-
- - Users -
-
- -
+
diff --git a/src/app/features/admin/partials/admin.html b/src/app/features/admin/partials/admin.html index 637dd49f396..968d7ba23b6 100644 --- a/src/app/features/admin/partials/admin.html +++ b/src/app/features/admin/partials/admin.html @@ -1,23 +1,9 @@ -
+ + -
-
-
- -
-
- - System administration -
- -
-
-
-
- -
- -
-
-
+
diff --git a/src/app/features/admin/partials/users.html b/src/app/features/admin/partials/users.html index 0a2b48aa435..57a4eca5159 100644 --- a/src/app/features/admin/partials/users.html +++ b/src/app/features/admin/partials/users.html @@ -1,9 +1,13 @@ -
+ + -
- -
+
+
diff --git a/src/app/features/annotations/partials/editor.html b/src/app/features/annotations/partials/editor.html index ae2d624edd9..1aee712962a 100644 --- a/src/app/features/annotations/partials/editor.html +++ b/src/app/features/annotations/partials/editor.html @@ -1,7 +1,7 @@
-
-
+
+
Annotations
@@ -10,10 +10,12 @@
- +
-
+
@@ -71,12 +73,10 @@
+
- -
diff --git a/src/app/features/dashboard/dashboardCtrl.js b/src/app/features/dashboard/dashboardCtrl.js index c88d6dfa725..d19dcd30d81 100644 --- a/src/app/features/dashboard/dashboardCtrl.js +++ b/src/app/features/dashboard/dashboardCtrl.js @@ -61,6 +61,9 @@ function (angular, $, config, _) { $scope.setWindowTitleAndTheme = function() { window.document.title = config.window_title_prefix + $scope.dashboard.title; $scope.grafana.style = $scope.dashboard.style; + $scope.topnav.title = $scope.dashboard.title; + $scope.topnav.icon = "fa fa-th-large"; + $scope.topnav.titleAction = function() { alert("hej"); }; }; $scope.isPanel = function(obj) { diff --git a/src/app/features/dashboard/dashboardNavCtrl.js b/src/app/features/dashboard/dashboardNavCtrl.js index 14a914821b1..a9eac45e1ea 100644 --- a/src/app/features/dashboard/dashboardNavCtrl.js +++ b/src/app/features/dashboard/dashboardNavCtrl.js @@ -22,7 +22,6 @@ function (angular, _, moment, config, store) { $scope.onAppEvent('zoom-out', function() { $scope.zoom(2); }); - }; $scope.set_default = function() { @@ -35,6 +34,11 @@ function (angular, _, moment, config, store) { alertSrv.set('Local Default Clear','Your default dashboard has been reset to the default','success', 5000); }; + $scope.openEditView = function(editview) { + var search = _.extend($location.search(), {editview: editview}); + $location.search(search); + }; + $scope.saveForSharing = function() { var clone = angular.copy($scope.dashboard); clone.temp = true; diff --git a/src/app/features/profile/partials/profile.html b/src/app/features/profile/partials/profile.html index 800062c8453..87d49af0bcf 100644 --- a/src/app/features/profile/partials/profile.html +++ b/src/app/features/profile/partials/profile.html @@ -1,17 +1,23 @@ -
+ + -
-
-
-
-
+
+
+ +
+
+
Personal information
-
+
@@ -56,65 +62,66 @@
+
-
-
-
- +
+ +
+
+
+ Your accounts
-
- -
- - - - - - -
Name: {{ac.name}}Role: {{ac.role}} - - active now - - - - Select - -
+
+ + + + + + + +
Name: {{ac.name}}Role: {{ac.role}} + + active now + + + + Select + +
+
+
-
- -
-
+
+
+
+
Add account
-
- - -
-
    -
  • - Account name -
  • -
  • - -
  • -
  • - -
  • -
-
-
- +
+
+
+
    +
  • + Account name +
  • +
  • + +
  • +
  • + +
  • +
+
+
+
+
-
-
-
diff --git a/src/app/panels/timepicker/editor.html b/src/app/panels/timepicker/editor.html index 8771bcadb20..33a5fbfaf00 100644 --- a/src/app/panels/timepicker/editor.html +++ b/src/app/panels/timepicker/editor.html @@ -1,5 +1,6 @@
+
  • @@ -34,6 +35,7 @@
+


diff --git a/src/app/panels/timepicker/module.html b/src/app/panels/timepicker/module.html index f0cfb2e316c..e73516126ae 100644 --- a/src/app/panels/timepicker/module.html +++ b/src/app/panels/timepicker/module.html @@ -21,6 +21,7 @@