From 362010c43816c426e97534a50f1bcbda44f737f5 Mon Sep 17 00:00:00 2001 From: Johannes Schill Date: Thu, 27 Sep 2018 11:34:28 +0200 Subject: [PATCH] Remove angular code related to API Keys and point the route to the React component #13411 --- public/app/features/org/all.ts | 1 - public/app/features/org/org_api_keys_ctrl.ts | 44 ----------------- .../features/org/partials/apikeyModal.html | 37 -------------- .../app/features/org/partials/orgApiKeys.html | 49 ------------------- public/app/routes/routes.ts | 4 -- 5 files changed, 135 deletions(-) delete mode 100644 public/app/features/org/org_api_keys_ctrl.ts delete mode 100644 public/app/features/org/partials/apikeyModal.html delete mode 100644 public/app/features/org/partials/orgApiKeys.html diff --git a/public/app/features/org/all.ts b/public/app/features/org/all.ts index 8872450e3ab..1cbca483138 100644 --- a/public/app/features/org/all.ts +++ b/public/app/features/org/all.ts @@ -6,6 +6,5 @@ import './change_password_ctrl'; import './new_org_ctrl'; import './user_invite_ctrl'; import './create_team_ctrl'; -import './org_api_keys_ctrl'; import './org_details_ctrl'; import './prefs_control'; diff --git a/public/app/features/org/org_api_keys_ctrl.ts b/public/app/features/org/org_api_keys_ctrl.ts deleted file mode 100644 index 1ead0a350b9..00000000000 --- a/public/app/features/org/org_api_keys_ctrl.ts +++ /dev/null @@ -1,44 +0,0 @@ -import angular from 'angular'; - -export class OrgApiKeysCtrl { - /** @ngInject */ - constructor($scope, $http, backendSrv, navModelSrv) { - $scope.navModel = navModelSrv.getNav('cfg', 'apikeys', 0); - - $scope.roleTypes = ['Viewer', 'Editor', 'Admin']; - $scope.token = { role: 'Viewer' }; - - $scope.init = () => { - $scope.getTokens(); - }; - - $scope.getTokens = () => { - backendSrv.get('/api/auth/keys').then(tokens => { - $scope.tokens = tokens; - }); - }; - - $scope.removeToken = id => { - backendSrv.delete('/api/auth/keys/' + id).then($scope.getTokens); - }; - - $scope.addToken = () => { - backendSrv.post('/api/auth/keys', $scope.token).then(result => { - const modalScope = $scope.$new(true); - modalScope.key = result.key; - modalScope.rootPath = window.location.origin + $scope.$root.appSubUrl; - - $scope.appEvent('show-modal', { - src: 'public/app/features/org/partials/apikeyModal.html', - scope: modalScope, - }); - - $scope.getTokens(); - }); - }; - - $scope.init(); - } -} - -angular.module('grafana.controllers').controller('OrgApiKeysCtrl', OrgApiKeysCtrl); diff --git a/public/app/features/org/partials/apikeyModal.html b/public/app/features/org/partials/apikeyModal.html deleted file mode 100644 index eeefcafc634..00000000000 --- a/public/app/features/org/partials/apikeyModal.html +++ /dev/null @@ -1,37 +0,0 @@ - - diff --git a/public/app/features/org/partials/orgApiKeys.html b/public/app/features/org/partials/orgApiKeys.html deleted file mode 100644 index a2b4ceb6670..00000000000 --- a/public/app/features/org/partials/orgApiKeys.html +++ /dev/null @@ -1,49 +0,0 @@ - - -
- -

Add new

- -
-
-
- Key name - -
-
- Role - - - -
-
- -
-
-
- -

Existing Keys

- - - - - - - - - - - - - - - -
NameRole
{{t.name}}{{t.role}} - - - -
-
- - - diff --git a/public/app/routes/routes.ts b/public/app/routes/routes.ts index 9b90e374769..470153f5dd1 100644 --- a/public/app/routes/routes.ts +++ b/public/app/routes/routes.ts @@ -139,10 +139,6 @@ export function setupAngularRoutes($routeProvider, $locationProvider) { controllerAs: 'ctrl', }) .when('/org/apikeys', { - templateUrl: 'public/app/features/org/partials/orgApiKeys.html', - controller: 'OrgApiKeysCtrl', - }) - .when('/org/apikeys2', { template: '', resolve: { roles: () => ['Editor', 'Admin'],