mirror of
https://github.com/grafana/grafana.git
synced 2025-01-18 12:33:37 -06:00
added ability to create accounts from profile page
This commit is contained in:
parent
d9a33680a6
commit
9667f324f1
@ -58,8 +58,8 @@
|
||||
<div class="section">
|
||||
<div class="dashboard-editor-header">
|
||||
<div class="dashboard-editor-title">
|
||||
<i class="fa fa-eye"></i>
|
||||
Active account
|
||||
<i class="fa fa-cubes"></i>
|
||||
Your accounts
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@ -69,7 +69,9 @@
|
||||
<td>Name: {{ac.name}}</td>
|
||||
<td>Role: {{ac.role}}</td>
|
||||
<td ng-show="ac.isUsing">
|
||||
currently using this account
|
||||
<span class="label label-info">
|
||||
active now
|
||||
</span>
|
||||
</td>
|
||||
<td ng-show="!ac.isUsing">
|
||||
<a ng-click="setUsingAccount(ac)" class="btn btn-success btn-mini">
|
||||
@ -78,7 +80,34 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
|
||||
<div class="dashboard-editor-header">
|
||||
<div class="dashboard-editor-title">
|
||||
<i class="fa fa-plus-square"></i>
|
||||
Add account
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<form name="form">
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item">
|
||||
<strong>Account name</strong>
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" ng-model="newAccount.name" required class="input-xlarge tight-form-input" placeholder="account name">
|
||||
</li>
|
||||
<li>
|
||||
<button class="btn btn-success tight-form-btn" ng-click="createAccount()">Create</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -8,6 +8,8 @@ function (angular) {
|
||||
|
||||
module.controller('ProfileCtrl', function($scope, $http, backendSrv) {
|
||||
|
||||
$scope.newAccount = {name: ''};
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.getUser();
|
||||
$scope.getUserAccounts();
|
||||
@ -26,11 +28,7 @@ function (angular) {
|
||||
};
|
||||
|
||||
$scope.setUsingAccount = function(account) {
|
||||
backendSrv.request({
|
||||
method: 'POST',
|
||||
url: '/api/user/using/' + account.accountId,
|
||||
desc: 'Change active account',
|
||||
}).then($scope.getUserAccounts);
|
||||
backendSrv.post('/api/user/using/' + account.accountId).then($scope.getUserAccounts);
|
||||
};
|
||||
|
||||
$scope.update = function() {
|
||||
@ -39,6 +37,10 @@ function (angular) {
|
||||
backendSrv.post('/api/user/', $scope.user);
|
||||
};
|
||||
|
||||
$scope.createAccount = function() {
|
||||
backendSrv.put('/api/account/', $scope.newAccount).then($scope.getUserAccounts);
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
|
||||
});
|
||||
|
@ -486,7 +486,7 @@ legend, label {
|
||||
}
|
||||
|
||||
.label {
|
||||
color: @grayLighter;
|
||||
color: @white;
|
||||
}
|
||||
|
||||
.badge {
|
||||
|
Loading…
Reference in New Issue
Block a user