Commit 5b93e097 by Torkel Ödegaard

Very basic start for accounts admin view

parent cf344abf
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() {
};
});
});
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();
});
});
<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>
&nbsp;&nbsp;
<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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment