quickfix for support suburl for sidemenu nav

This commit is contained in:
Torkel Ödegaard 2015-01-21 20:14:53 +01:00
parent fc9de68ee9
commit 1d8bb45d3a

View File

@ -2,19 +2,24 @@ define([
'angular', 'angular',
'lodash', 'lodash',
'jquery', 'jquery',
'config',
], ],
function (angular, _, $) { function (angular, _, $, config) {
'use strict'; 'use strict';
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
module.controller('SideMenuCtrl', function($scope, $location) { module.controller('SideMenuCtrl', function($scope, $location) {
$scope.getUrl = function(url) {
return config.appSubUrl + url;
};
$scope.menu = [ $scope.menu = [
{ {
text: "Dashbord", text: "Dashbord",
href: "/", href: $scope.getUrl("/"),
startsWith: '/dashboard/', startsWith: config.appSubUrl + '/dashboard/',
icon: "fa fa-th-large", icon: "fa fa-th-large",
links: [ links: [
{ text: 'Settings', editview: 'settings', icon: "fa fa-cogs" }, { text: 'Settings', editview: 'settings', icon: "fa fa-cogs" },
@ -25,19 +30,19 @@ function (angular, _, $) {
] ]
}, },
{ {
text: "Account", href: "/account", text: "Account", href: $scope.getUrl("/account"),
icon: "fa fa-shield", icon: "fa fa-shield",
links: [ links: [
{ text: 'Data sources', href:"/account/datasources", icon: "fa fa-sitemap" }, { text: 'Data sources', href: $scope.getUrl("/account/datasources"), icon: "fa fa-sitemap" },
{ text: 'Users', href:"/account/users", icon: "fa fa-users" }, { text: 'Users', href: $scope.getUrl("/account/users"), icon: "fa fa-users" },
{ text: 'API Keys', href:"/account/apikeys", icon: "fa fa-key" }, { text: 'API Keys', href: $scope.getUrl("/account/apikeys"), icon: "fa fa-key" },
] ]
}, },
{ {
text: "Profile", href: "/profile", text: "Profile", href: $scope.getUrl("/profile"),
icon: "fa fa-user", icon: "fa fa-user",
links: [ links: [
{ text: 'Password', href:"asd", icon: "fa fa-lock" }, { text: 'Password', href:"", icon: "fa fa-lock" },
] ]
} }
]; ];
@ -51,7 +56,7 @@ function (angular, _, $) {
}); });
$scope.updateState = function() { $scope.updateState = function() {
var currentPath = $location.path(); var currentPath = config.appSubUrl + $location.path();
var search = $location.search(); var search = $location.search();
_.each($scope.menu, function(item) { _.each($scope.menu, function(item) {