Browse Source

Remove angular code related to API Keys and point the route to the React component #13411

Johannes Schill 7 years ago
parent
commit
362010c438

+ 0 - 1
public/app/features/org/all.ts

@@ -6,6 +6,5 @@ import './change_password_ctrl';
 import './new_org_ctrl';
 import './new_org_ctrl';
 import './user_invite_ctrl';
 import './user_invite_ctrl';
 import './create_team_ctrl';
 import './create_team_ctrl';
-import './org_api_keys_ctrl';
 import './org_details_ctrl';
 import './org_details_ctrl';
 import './prefs_control';
 import './prefs_control';

+ 0 - 44
public/app/features/org/org_api_keys_ctrl.ts

@@ -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);

+ 0 - 37
public/app/features/org/partials/apikeyModal.html

@@ -1,37 +0,0 @@
-<div class="modal-body">
-	<div class="modal-header">
-		<h2 class="modal-header-title">
-			<i class="fa fa-key"></i>
-			<span class="p-l-1">API Key Created</span>
-		</h2>
-
-		<a class="modal-header-close" ng-click="dismiss();">
-			<i class="fa fa-remove"></i>
-		</a>
-	</div>
-
-	<div class="modal-content">
-
-		<div class="gf-form-group">
-			<div class="gf-form">
-				<span class="gf-form-label">Key</span>
-				<span class="gf-form-label">{{key}}</span>
-			</div>
-		</div>
-
-		<div class="grafana-info-box" style="border: 0;">
-			You will only be able to view this key here once! It is not stored in this form. So be sure to copy it now.
-			<br>
-			<br>
-			You can authenticate request using the Authorization HTTP header, example:
-			<br>
-			<br>
-			<pre class="small">
-curl -H "Authorization: Bearer {{key}}" {{rootPath}}/api/dashboards/home
-			</pre>
-		</div>
-
-	</div>
-
-</div>
-

+ 0 - 49
public/app/features/org/partials/orgApiKeys.html

@@ -1,49 +0,0 @@
-<page-header model="navModel"></page-header>
-
-<div class="page-container page-body">
-
-	<h3 class="page-heading">Add new</h3>
-
-	<form name="addTokenForm" class="gf-form-group">
-		<div class="gf-form-inline">
-			<div class="gf-form max-width-21">
-				<span class="gf-form-label">Key name</span>
-				<input type="text" class="gf-form-input" ng-model='token.name' placeholder="Name"></input>
-			</div>
-			<div class="gf-form">
-				<span class="gf-form-label">Role</span>
-        <span class="gf-form-select-wrapper">
-            <select class="gf-form-input gf-size-auto" ng-model="token.role" ng-options="r for r in roleTypes"></select>
-        </span>
-			</div>
-			<div class="gf-form">
-				<button class="btn gf-form-btn btn-success" ng-click="addToken()">Add</button>
-			</div>
-		</div>
-	</form>
-
-	<h3 class="page-heading">Existing Keys</h3>
-	<table class="filter-table">
-		<thead>
-			<tr>
-				<th>Name</th>
-				<th>Role</th>
-				<th style="width: 34px;"></th>
-			</tr>
-		</thead>
-		<tbody>
-			<tr ng-repeat="t in tokens">
-				<td>{{t.name}}</td>
-				<td>{{t.role}}</td>
-				<td>
-					<a ng-click="removeToken(t.id)" class="btn btn-danger btn-mini">
-						<i class="fa fa-remove"></i>
-					</a>
-				</td>
-			</tr>
-		</tbody>
-	</table>
-</div>
-
-
-

+ 0 - 4
public/app/routes/routes.ts

@@ -139,10 +139,6 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
       controllerAs: 'ctrl',
       controllerAs: 'ctrl',
     })
     })
     .when('/org/apikeys', {
     .when('/org/apikeys', {
-      templateUrl: 'public/app/features/org/partials/orgApiKeys.html',
-      controller: 'OrgApiKeysCtrl',
-    })
-    .when('/org/apikeys2', {
       template: '<react-container />',
       template: '<react-container />',
       resolve: {
       resolve: {
         roles: () => ['Editor', 'Admin'],
         roles: () => ['Editor', 'Admin'],