Commit e1d078f2 by Torkel Ödegaard

Final frontend changes for account -> org rename

parent 563d5e3a
......@@ -9,7 +9,6 @@ function (angular) {
module.controller('AdminSettingsCtrl', function($scope, backendSrv) {
$scope.init = function() {
$scope.accounts = [];
$scope.getUsers();
};
......
......@@ -9,7 +9,6 @@ function (angular) {
module.controller('AdminUsersCtrl', function($scope, backendSrv) {
$scope.init = function() {
$scope.accounts = [];
$scope.getUsers();
};
......
......@@ -54,7 +54,7 @@ function (angular) {
backendSrv.post('/api/datasources', $scope.current).then(function() {
$scope.updateFrontendSettings();
$location.path("account/datasources");
$location.path("datasources");
});
};
......@@ -65,7 +65,7 @@ function (angular) {
backendSrv.put('/api/datasources', $scope.current).then(function() {
$scope.updateFrontendSettings();
$location.path("account/datasources");
$location.path("datasources");
});
};
......
......@@ -13,8 +13,8 @@ function (angular) {
};
$scope.getOrgInfo = function() {
backendSrv.get('/api/org').then(function(account) {
$scope.org = account;
backendSrv.get('/api/org').then(function(org) {
$scope.org = org;
});
};
......
......@@ -51,34 +51,34 @@
<button type="submit" class="pull-right btn btn-success" ng-click="update()">Update</button>
</form>
<h2>Your accounts</h2>
<h2>Your Organizations</h2>
<table class="grafana-options-table">
<tr ng-repeat="ac in accounts">
<td style="width: 98%"><strong>Name: </strong> {{ac.name}}</td>
<td><strong>Role: </strong> {{ac.role}}</td>
<tr ng-repeat="org in orgs">
<td style="width: 98%"><strong>Name: </strong> {{org.name}}</td>
<td><strong>Role: </strong> {{org.role}}</td>
<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
</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
</a>
</td>
</tr>
</table>
<h2 style="margin-top: 30px;">Add account</h2>
<h2 style="margin-top: 30px;">Add Organization</h2>
<form name="form">
<div>
<div class="tight-form">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 100px;">
<strong>Account name</strong>
<strong>Org. name</strong>
</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>
......@@ -87,7 +87,7 @@
</div>
</div>
<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>
</div>
......
......@@ -9,11 +9,11 @@ function (angular, config) {
module.controller('ProfileCtrl', function($scope, backendSrv) {
$scope.newAccount = {name: ''};
$scope.newOrg = {name: ''};
$scope.init = function() {
$scope.getUser();
$scope.getUserAccounts();
$scope.getUserOrgs();
};
$scope.getUser = function() {
......@@ -22,14 +22,14 @@ function (angular, config) {
});
};
$scope.getUserAccounts = function() {
backendSrv.get('/api/user/accounts').then(function(accounts) {
$scope.accounts = accounts;
$scope.getUserOrgs = function() {
backendSrv.get('/api/user/orgs').then(function(orgs) {
$scope.orgs = orgs;
});
};
$scope.setUsingAccount = function(account) {
backendSrv.post('/api/user/using/' + account.accountId).then(function() {
$scope.setUsingOrg = function(org) {
backendSrv.post('/api/user/using/' + org.orgId).then(function() {
window.location.href = config.appSubUrl + '/profile';
});
};
......@@ -39,8 +39,8 @@ function (angular, config) {
backendSrv.put('/api/user/', $scope.user);
};
$scope.createAccount = function() {
backendSrv.post('/api/account/', $scope.newAccount).then($scope.getUserAccounts);
$scope.createOrg = function() {
backendSrv.post('/api/org/', $scope.newOrg).then($scope.getUserOrgs);
};
$scope.init();
......
......@@ -28,7 +28,7 @@ function (angular, _, store) {
});
this.hasRole = function(role) {
return this.user.accountRole === role;
return this.user.orgRole === role;
};
this.setSideMenuState = function(state) {
......
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