mirror of https://github.com/grafana/grafana
parent
c892d9d6f6
commit
34ab1e529b
@ -0,0 +1,14 @@ |
||||
<div class="navbar navbar-static-top"> |
||||
<div class="navbar-inner"> |
||||
<div class="container-fluid"> |
||||
<span class="brand"> |
||||
<a ng-click="toggleProSideMenu()"> |
||||
<img src="img/small.png"> |
||||
</a> |
||||
Admin / Data sources |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
@ -0,0 +1,45 @@ |
||||
<div class="navbar navbar-static-top"> |
||||
<div class="navbar-inner"> |
||||
<div class="container-fluid"> |
||||
<span class="brand"> |
||||
<i class="icon-gears" style=""></i> |
||||
<span style="color: white; padding-left: 4px;">Grafana</span> |
||||
<ul class="nav" ng-controller='DashboardNavCtrl' ng-init="init()"> |
||||
</span> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<section class="pro-sidemenu-items"> |
||||
<a class="pro-sidemenu-link pro-side-menu-user" href="/login?logout"> |
||||
<img src="https://secure.gravatar.com/avatar/c8656e8972626f01e1703681d5e55f92?s=90&default=blank"> |
||||
logout |
||||
</a> |
||||
<a class="pro-sidemenu-link" href="/dashboard/db/home"> |
||||
<i class="icon-th-large"></i> |
||||
Dashboards |
||||
</a> |
||||
<a class="pro-sidemenu-link" href="/charts"> |
||||
<i class="icon-signal"></i> |
||||
Graphs |
||||
</a> |
||||
<a class="pro-sidemenu-link" href="/charts"> |
||||
<i class="icon-bolt" style="padding-right: 23px"></i> |
||||
Alerts |
||||
</a> |
||||
<a class="pro-sidemenu-link" href="/admin/datasources"> |
||||
<i class="icon-sitemap"></i> |
||||
Data sources |
||||
</a> |
||||
<a class="pro-sidemenu-link" href="/admin"> |
||||
<i class="icon-tasks"></i> |
||||
Global options |
||||
</a> |
||||
<a class="pro-sidemenu-link" href="/admin"> |
||||
<i class="icon-user"></i> |
||||
User accounts |
||||
</a> |
||||
</section> |
||||
|
||||
</div> |
@ -0,0 +1,21 @@ |
||||
define([ |
||||
'angular', |
||||
], |
||||
function (angular) { |
||||
"use strict"; |
||||
|
||||
var module = angular.module('grafana.routes'); |
||||
|
||||
module.config(function($routeProvider) { |
||||
$routeProvider |
||||
.when('/admin/datasources', { |
||||
templateUrl: 'app/partials/pro/admin_datasources.html', |
||||
controller : 'AdminCtrl', |
||||
}); |
||||
}); |
||||
|
||||
module.controller('AdminCtrl', function() { |
||||
|
||||
}); |
||||
|
||||
}); |
@ -1,5 +1,7 @@ |
||||
define([ |
||||
'./p_dashboard', |
||||
'./p_solo-panel', |
||||
'./p_admin', |
||||
'./p_login', |
||||
], |
||||
function () {}); |
||||
|
@ -0,0 +1,59 @@ |
||||
define([ |
||||
'angular', |
||||
], |
||||
function (angular) { |
||||
"use strict"; |
||||
|
||||
var module = angular.module('grafana.routes'); |
||||
|
||||
module.config(function($routeProvider) { |
||||
$routeProvider |
||||
.when('/login', { |
||||
templateUrl: 'app/partials/pro/login.html', |
||||
controller : 'LoginCtrl', |
||||
}); |
||||
}); |
||||
|
||||
module.controller('LoginCtrl', function($scope, $http, $location, $routeParams, alertSrv) { |
||||
$scope.loginModel = {}; |
||||
|
||||
$scope.init = function() { |
||||
if ($routeParams.logout) { |
||||
$scope.logout(); |
||||
} |
||||
}; |
||||
|
||||
$scope.logout = function() { |
||||
$http.post('/logout').then(function() { |
||||
alertSrv.set('Logged out!', '', 'success', 3000); |
||||
$scope.emitAppEvent('logged-out'); |
||||
}, function() { |
||||
alertSrv.set('Logout failed:', 'Unexpected error', 'error', 3000); |
||||
}); |
||||
}; |
||||
|
||||
$scope.login = function() { |
||||
delete $scope.loginError; |
||||
|
||||
if (!$scope.loginForm.$valid) { |
||||
return; |
||||
} |
||||
|
||||
$http.post('/login', $scope.loginModel).then(function() { |
||||
$scope.emitAppEvent('logged-in'); |
||||
$location.path('/'); |
||||
}, function(err) { |
||||
if (err.status === 401) { |
||||
$scope.loginError = "Username or password is incorrect"; |
||||
} |
||||
else { |
||||
$scope.loginError = "Unexpected error"; |
||||
} |
||||
}); |
||||
}; |
||||
|
||||
$scope.init(); |
||||
|
||||
}); |
||||
|
||||
}); |
Loading…
Reference in new issue