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',
|
'./dashboard/all',
|
||||||
'./account/accountCtrl',
|
'./account/accountCtrl',
|
||||||
'./account/datasourcesCtrl',
|
'./account/datasourcesCtrl',
|
||||||
'./admin/adminCtrl',
|
'./admin/accountsCtrl',
|
||||||
'./grafanaDatasource/datasource',
|
'./grafanaDatasource/datasource',
|
||||||
], function () {});
|
], function () {});
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<i class="fa fa-user"></i>
|
<i class="fa fa-user"></i>
|
||||||
Account
|
Account
|
||||||
</a>
|
</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
|
<i class="fa fa-institution"></i>Admin
|
||||||
</a>
|
</a>
|
||||||
<a class="pro-sidemenu-link" href="login?logout">
|
<a class="pro-sidemenu-link" href="login?logout">
|
||||||
|
@ -38,9 +38,9 @@ define([
|
|||||||
templateUrl: 'app/features/account/partials/account.html',
|
templateUrl: 'app/features/account/partials/account.html',
|
||||||
controller : 'AccountCtrl',
|
controller : 'AccountCtrl',
|
||||||
})
|
})
|
||||||
.when('/admin/', {
|
.when('/admin/accounts', {
|
||||||
templateUrl: 'app/features/admin/partials/admin.html',
|
templateUrl: 'app/features/admin/partials/accounts.html',
|
||||||
controller : 'AdminCtrl',
|
controller : 'AccountsCtrl',
|
||||||
})
|
})
|
||||||
.when('/login', {
|
.when('/login', {
|
||||||
templateUrl: 'app/partials/login.html',
|
templateUrl: 'app/partials/login.html',
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
background-color: @grafanaListAccent;
|
background-color: @grafanaListAccent;
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
td, th {
|
||||||
|
text-align: left;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border-bottom: 1px solid @grafanaListBorderBottom;
|
border-bottom: 1px solid @grafanaListBorderBottom;
|
||||||
|
Loading…
Reference in New Issue
Block a user