mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Very basic start for accounts admin view
This commit is contained in:
parent
cf344abff2
commit
5b93e09714
40
src/app/controllers/sideMenuCtrl.js
Normal file
40
src/app/controllers/sideMenuCtrl.js
Normal file
@ -0,0 +1,40 @@
|
||||
define([
|
||||
'angular',
|
||||
'config',
|
||||
],
|
||||
function (angular, config) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('SideMenuCtrl', function($scope) {
|
||||
|
||||
$scope.menu = [
|
||||
{
|
||||
href: config.appSubUrl,
|
||||
text: 'Dashboards',
|
||||
icon: 'fa fa-th-large'
|
||||
},
|
||||
{
|
||||
href: 'panels',
|
||||
text: 'Panels',
|
||||
icon: 'fa fa-signal',
|
||||
},
|
||||
{
|
||||
href: 'alerts',
|
||||
text: 'Alerts',
|
||||
icon: 'fa fa-bolt',
|
||||
},
|
||||
{
|
||||
href: 'account',
|
||||
text: 'Account',
|
||||
icon: 'fa fa-user',
|
||||
},
|
||||
];
|
||||
|
||||
$scope.init = function() {
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
});
|
26
src/app/features/admin/accountsCtrl.js
Normal file
26
src/app/features/admin/accountsCtrl.js
Normal file
@ -0,0 +1,26 @@
|
||||
define([
|
||||
'angular',
|
||||
],
|
||||
function (angular) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('AccountsCtrl', function($scope, backendSrv) {
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.accounts = [];
|
||||
$scope.getAccounts();
|
||||
};
|
||||
|
||||
$scope.getAccounts = function() {
|
||||
backendSrv.get('/api/admin/accounts').then(function(accounts) {
|
||||
console.log(accounts);
|
||||
$scope.accounts = accounts;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
|
||||
});
|
||||
});
|
37
src/app/features/admin/partials/accounts.html
Normal file
37
src/app/features/admin/partials/accounts.html
Normal file
@ -0,0 +1,37 @@
|
||||
<div ng-include="'app/partials/navbar.html'" ng-init="pageTitle='Accounts'"></div>
|
||||
|
||||
<div class="dashboard-edit-view" style="min-height: 500px">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
|
||||
<table class="grafana-options-table">
|
||||
<tr>
|
||||
<th style="text-align:left">Id</th>
|
||||
<th>Login</th>
|
||||
<th>Email</th>
|
||||
<th>Name</th>
|
||||
<th>Admin</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr ng-repeat="account in accounts">
|
||||
<td>{{account.id}}</td>
|
||||
<td>{{account.login}}</td>
|
||||
<td>{{account.email}}</td>
|
||||
<td>{{account.name}}</td>
|
||||
<td>{{account.isAdmin}}</td>
|
||||
<td style="width: 1%">
|
||||
<a ng-click="edit(variable)" class="btn btn-success">
|
||||
<i class="fa fa-edit"></i>
|
||||
Edit
|
||||
</a>
|
||||
|
||||
<a ng-click="edit(variable)" class="btn btn-danger">
|
||||
<i class="fa fa-remove"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -9,6 +9,6 @@ define([
|
||||
'./dashboard/all',
|
||||
'./account/accountCtrl',
|
||||
'./account/datasourcesCtrl',
|
||||
'./admin/adminCtrl',
|
||||
'./admin/accountsCtrl',
|
||||
'./grafanaDatasource/datasource',
|
||||
], function () {});
|
||||
|
@ -28,7 +28,7 @@
|
||||
<i class="fa fa-user"></i>
|
||||
Account
|
||||
</a>
|
||||
<a class="pro-sidemenu-link" href="admin" ng-if="grafana.user.isAdmin">
|
||||
<a class="pro-sidemenu-link" href="admin/accounts" ng-if="grafana.user.isAdmin">
|
||||
<i class="fa fa-institution"></i>Admin
|
||||
</a>
|
||||
<a class="pro-sidemenu-link" href="login?logout">
|
||||
|
@ -38,9 +38,9 @@ define([
|
||||
templateUrl: 'app/features/account/partials/account.html',
|
||||
controller : 'AccountCtrl',
|
||||
})
|
||||
.when('/admin/', {
|
||||
templateUrl: 'app/features/admin/partials/admin.html',
|
||||
controller : 'AdminCtrl',
|
||||
.when('/admin/accounts', {
|
||||
templateUrl: 'app/features/admin/partials/accounts.html',
|
||||
controller : 'AccountsCtrl',
|
||||
})
|
||||
.when('/login', {
|
||||
templateUrl: 'app/partials/login.html',
|
||||
|
@ -5,7 +5,8 @@
|
||||
background-color: @grafanaListAccent;
|
||||
}
|
||||
|
||||
td {
|
||||
td, th {
|
||||
text-align: left;
|
||||
padding: 5px 10px;
|
||||
white-space: nowrap;
|
||||
border-bottom: 1px solid @grafanaListBorderBottom;
|
||||
|
Loading…
Reference in New Issue
Block a user