diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index ef6f473e34e..bf5c8164397 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -7,5 +7,6 @@ define([ './inspectCtrl', './jsonEditorCtrl', './loginCtrl', + './sidemenuCtrl', './errorCtrl', ], function () {}); diff --git a/src/app/controllers/sidemenuCtrl.js b/src/app/controllers/sidemenuCtrl.js new file mode 100644 index 00000000000..63edb5c5af9 --- /dev/null +++ b/src/app/controllers/sidemenuCtrl.js @@ -0,0 +1,71 @@ +define([ + 'angular', + 'lodash', +], +function (angular, _) { + 'use strict'; + + var module = angular.module('grafana.controllers'); + + module.controller('SideMenuCtrl', function($scope, $location) { + + $scope.menu = [ + { + text: "Dashbord", + href: "/", + icon: "fa fa-th-large", + links: [ + { text: 'Settings', href:"asd", icon: "fa fa-cogs" }, + { text: 'Templating', href:"asd", icon: "fa fa-cogs" }, + { text: 'Annotations', href:"asd", icon: "fa fa-bolt" }, + { text: 'More', href:"asd", icon: "fa fa-bolt" }, + ] + }, + { + text: "Account", href: "/account", + icon: "fa fa-shield", + links: [ + { text: 'Data sources', href:"/account/datasources", icon: "fa fa-sitemap" }, + { text: 'Users', href:"/account/datasources", icon: "fa fa-users" }, + { text: 'API Keys', href:"/account/datasources", icon: "fa fa-key" }, + ] + }, + { + text: "Profile", href: "/profile", + icon: "fa fa-user", + links: [ + { text: 'Password', href:"asd", icon: "fa fa-lock" }, + ] + } + ]; + + $scope.onAppEvent('$routeChangeSuccess', function() { + $scope.updateState(); + }); + + $scope.updateState = function() { + var currentPath = $location.path(); + _.each($scope.menu, function(item) { + item.active = false; + + if (item.href === currentPath) { + item.active = true; + } + + _.each(item.links, function(link) { + link.active = false; + + if (link.href === currentPath) { + item.active = true; + link.active = true; + } + }); + }); + }; + + $scope.init = function() { + $scope.updateState(); + }; + }); + +}); diff --git a/src/app/features/account/partials/account.html b/src/app/features/account/partials/account.html new file mode 100644 index 00000000000..e41c05584de --- /dev/null +++ b/src/app/features/account/partials/account.html @@ -0,0 +1,3 @@ +
+ + diff --git a/src/app/partials/sidemenu.html b/src/app/partials/sidemenu.html index fb3b5206899..f45622cfa6f 100644 --- a/src/app/partials/sidemenu.html +++ b/src/app/partials/sidemenu.html @@ -1,4 +1,55 @@ +