mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Final frontend changes for account -> org rename
This commit is contained in:
@@ -9,7 +9,6 @@ function (angular) {
|
|||||||
module.controller('AdminSettingsCtrl', function($scope, backendSrv) {
|
module.controller('AdminSettingsCtrl', function($scope, backendSrv) {
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.accounts = [];
|
|
||||||
$scope.getUsers();
|
$scope.getUsers();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ function (angular) {
|
|||||||
module.controller('AdminUsersCtrl', function($scope, backendSrv) {
|
module.controller('AdminUsersCtrl', function($scope, backendSrv) {
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.accounts = [];
|
|
||||||
$scope.getUsers();
|
$scope.getUsers();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ function (angular) {
|
|||||||
|
|
||||||
backendSrv.post('/api/datasources', $scope.current).then(function() {
|
backendSrv.post('/api/datasources', $scope.current).then(function() {
|
||||||
$scope.updateFrontendSettings();
|
$scope.updateFrontendSettings();
|
||||||
$location.path("account/datasources");
|
$location.path("datasources");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ function (angular) {
|
|||||||
|
|
||||||
backendSrv.put('/api/datasources', $scope.current).then(function() {
|
backendSrv.put('/api/datasources', $scope.current).then(function() {
|
||||||
$scope.updateFrontendSettings();
|
$scope.updateFrontendSettings();
|
||||||
$location.path("account/datasources");
|
$location.path("datasources");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ function (angular) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.getOrgInfo = function() {
|
$scope.getOrgInfo = function() {
|
||||||
backendSrv.get('/api/org').then(function(account) {
|
backendSrv.get('/api/org').then(function(org) {
|
||||||
$scope.org = account;
|
$scope.org = org;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -51,34 +51,34 @@
|
|||||||
<button type="submit" class="pull-right btn btn-success" ng-click="update()">Update</button>
|
<button type="submit" class="pull-right btn btn-success" ng-click="update()">Update</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2>Your accounts</h2>
|
<h2>Your Organizations</h2>
|
||||||
|
|
||||||
<table class="grafana-options-table">
|
<table class="grafana-options-table">
|
||||||
<tr ng-repeat="ac in accounts">
|
<tr ng-repeat="org in orgs">
|
||||||
<td style="width: 98%"><strong>Name: </strong> {{ac.name}}</td>
|
<td style="width: 98%"><strong>Name: </strong> {{org.name}}</td>
|
||||||
<td><strong>Role: </strong> {{ac.role}}</td>
|
<td><strong>Role: </strong> {{org.role}}</td>
|
||||||
<td class="nobg max-width-btns">
|
<td class="nobg max-width-btns">
|
||||||
<span class="btn btn-primary" ng-show="ac.isUsing">
|
<span class="btn btn-primary" ng-show="org.isUsing">
|
||||||
Current
|
Current
|
||||||
</span>
|
</span>
|
||||||
<a ng-click="setUsingAccount(ac)" class="btn btn-inverse" ng-show="!ac.isUsing">
|
<a ng-click="setUsingOrg(org)" class="btn btn-inverse" ng-show="!org.isUsing">
|
||||||
Select
|
Select
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2 style="margin-top: 30px;">Add account</h2>
|
<h2 style="margin-top: 30px;">Add Organization</h2>
|
||||||
|
|
||||||
<form name="form">
|
<form name="form">
|
||||||
<div>
|
<div>
|
||||||
<div class="tight-form">
|
<div class="tight-form">
|
||||||
<ul class="tight-form-list">
|
<ul class="tight-form-list">
|
||||||
<li class="tight-form-item" style="width: 100px;">
|
<li class="tight-form-item" style="width: 100px;">
|
||||||
<strong>Account name</strong>
|
<strong>Org. name</strong>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="text" ng-model="newAccount.name" required class="input-xxlarge tight-form-input last" placeholder="account name">
|
<input type="text" ng-model="newOrg.name" required class="input-xxlarge tight-form-input last" placeholder="organization name">
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
</li>
|
</li>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<button class="btn btn-success pull-right" ng-click="createAccount()">Create</button>
|
<button class="btn btn-success pull-right" ng-click="createOrg()">Create</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ function (angular, config) {
|
|||||||
|
|
||||||
module.controller('ProfileCtrl', function($scope, backendSrv) {
|
module.controller('ProfileCtrl', function($scope, backendSrv) {
|
||||||
|
|
||||||
$scope.newAccount = {name: ''};
|
$scope.newOrg = {name: ''};
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.getUser();
|
$scope.getUser();
|
||||||
$scope.getUserAccounts();
|
$scope.getUserOrgs();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.getUser = function() {
|
$scope.getUser = function() {
|
||||||
@@ -22,14 +22,14 @@ function (angular, config) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.getUserAccounts = function() {
|
$scope.getUserOrgs = function() {
|
||||||
backendSrv.get('/api/user/accounts').then(function(accounts) {
|
backendSrv.get('/api/user/orgs').then(function(orgs) {
|
||||||
$scope.accounts = accounts;
|
$scope.orgs = orgs;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.setUsingAccount = function(account) {
|
$scope.setUsingOrg = function(org) {
|
||||||
backendSrv.post('/api/user/using/' + account.accountId).then(function() {
|
backendSrv.post('/api/user/using/' + org.orgId).then(function() {
|
||||||
window.location.href = config.appSubUrl + '/profile';
|
window.location.href = config.appSubUrl + '/profile';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -39,8 +39,8 @@ function (angular, config) {
|
|||||||
backendSrv.put('/api/user/', $scope.user);
|
backendSrv.put('/api/user/', $scope.user);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.createAccount = function() {
|
$scope.createOrg = function() {
|
||||||
backendSrv.post('/api/account/', $scope.newAccount).then($scope.getUserAccounts);
|
backendSrv.post('/api/org/', $scope.newOrg).then($scope.getUserOrgs);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.init();
|
$scope.init();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function (angular, _, store) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.hasRole = function(role) {
|
this.hasRole = function(role) {
|
||||||
return this.user.accountRole === role;
|
return this.user.orgRole === role;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setSideMenuState = function(state) {
|
this.setSideMenuState = function(state) {
|
||||||
|
|||||||
Reference in New Issue
Block a user