diff --git a/src/app/features/account/accountCtrl.js b/src/app/features/account/accountCtrl.js
index 07cc75058c4..5d76445866c 100644
--- a/src/app/features/account/accountCtrl.js
+++ b/src/app/features/account/accountCtrl.js
@@ -9,20 +9,12 @@ function (angular) {
module.controller('AccountCtrl', function($scope, $http, backendSrv) {
$scope.collaborator = {};
- $scope.token = {
- role: "ReadWrite"
- };
- $scope.roleTypes = [
- "ReadWrite",
- "Read"
- ];
- $scope.showTokens = false;
+ $scope.showTokens = false;
$scope.init = function() {
$scope.getAccount();
$scope.getOtherAccounts();
- $scope.getTokens();
-
+
};
$scope.getAccount = function() {
@@ -45,25 +37,6 @@ function (angular) {
}).then($scope.getOtherAccounts);
};
- $scope.getTokens = function() {
- backendSrv.get('/api/tokens').then(function(tokens) {
- $scope.tokens = tokens;
- });
- }
-
- $scope.removeToken = function(id) {
- backendSrv.delete('/api/tokens/'+id).then($scope.getTokens);
- }
-
- $scope.addToken = function() {
- backendSrv.request({
- method: 'PUT',
- url: '/api/tokens',
- data: $scope.token,
- desc: 'Add token'
- }).then($scope.getTokens);
- }
-
$scope.update = function() {
if (!$scope.accountForm.$valid) { return; }
diff --git a/src/app/features/account/apiKeysCtrl.js b/src/app/features/account/apiKeysCtrl.js
new file mode 100644
index 00000000000..8878edc3506
--- /dev/null
+++ b/src/app/features/account/apiKeysCtrl.js
@@ -0,0 +1,40 @@
+define([
+ 'angular',
+],
+function (angular) {
+ 'use strict';
+
+ var module = angular.module('grafana.controllers');
+
+ module.controller('ApiKeysCtrl', function($scope, $http, backendSrv) {
+
+ $scope.roleTypes = ['Viewer', 'Editor', 'Admin'];
+ $scope.token = { role: 'Viewer' };
+
+ $scope.init = function() {
+ $scope.getTokens();
+ };
+
+ $scope.getTokens = function() {
+ backendSrv.get('/api/tokens').then(function(tokens) {
+ $scope.tokens = tokens;
+ });
+ };
+
+ $scope.removeToken = function(id) {
+ backendSrv.delete('/api/tokens/'+id).then($scope.getTokens);
+ };
+
+ $scope.addToken = function() {
+ backendSrv.request({
+ method: 'PUT',
+ url: '/api/tokens',
+ data: $scope.token,
+ desc: 'Add token'
+ }).then($scope.getTokens);
+ };
+
+ $scope.init();
+
+ });
+});
diff --git a/src/app/features/account/partials/account.html b/src/app/features/account/partials/account.html
index 734c86bbe8c..24ccbef850f 100644
--- a/src/app/features/account/partials/account.html
+++ b/src/app/features/account/partials/account.html
@@ -1,4 +1,3 @@
-
@@ -81,45 +80,6 @@
-
-
-
-
-
-
-
-
- | {{t.name}} |
- {{t.role}} |
- {{t.token}} |
-
-
-
-
- |
-
-
-
-
-
diff --git a/src/app/features/account/partials/apikeys.html b/src/app/features/account/partials/apikeys.html
new file mode 100644
index 00000000000..f286360a811
--- /dev/null
+++ b/src/app/features/account/partials/apikeys.html
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | {{t.name}} |
+ {{t.role}} |
+ {{t.token}} |
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/features/all.js b/src/app/features/all.js
index 056747fb584..6b22c50e98c 100644
--- a/src/app/features/all.js
+++ b/src/app/features/all.js
@@ -10,6 +10,7 @@ define([
'./account/accountCtrl',
'./account/collaboratorsCtrl',
'./account/datasourcesCtrl',
+ './account/apiKeysCtrl',
'./admin/accountsCtrl',
'./grafanaDatasource/datasource',
], function () {});
diff --git a/src/app/partials/sidemenu.html b/src/app/partials/sidemenu.html
index 3553169c379..6e0691f359c 100644
--- a/src/app/partials/sidemenu.html
+++ b/src/app/partials/sidemenu.html
@@ -31,6 +31,9 @@
+
diff --git a/src/app/routes/backend/all.js b/src/app/routes/backend/all.js
index 423ab898911..ec26356038c 100644
--- a/src/app/routes/backend/all.js
+++ b/src/app/routes/backend/all.js
@@ -38,6 +38,10 @@ define([
templateUrl: 'app/features/account/partials/collaborators.html',
controller : 'CollaboratorsCtrl',
})
+ .when('/account/apikeys', {
+ templateUrl: 'app/features/account/partials/apikeys.html',
+ controller : 'ApiKeysCtrl',
+ })
.when('/account', {
templateUrl: 'app/features/account/partials/account.html',
controller : 'AccountCtrl',