From b94839574c91219efe92716bc0e79fc35b9b4a22 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Thu, 23 Nov 2017 17:04:50 +0100 Subject: [PATCH] migration of org files from js to ts (#9974) * migration of org files from js to ts * more migration of org files to ts * minor fix to change_password * renamed files --- public/app/core/config.ts | 2 ++ public/app/features/org/all.js | 12 ----------- public/app/features/org/all.ts | 10 +++++++++ ...ssword_ctrl.js => change_password_ctrl.ts} | 21 +++++++------------ .../org/{newOrgCtrl.js => new_org_ctrl.ts} | 21 +++++++------------ ...orgApiKeysCtrl.js => org_api_keys_ctrl.ts} | 17 +++++++-------- ...{orgDetailsCtrl.js => org_details_ctrl.ts} | 17 +++++++-------- ...{select_org_ctrl.js => select_org_ctrl.ts} | 21 +++++++------------ ...{userInviteCtrl.js => user_invite_ctrl.ts} | 20 ++++++++---------- 9 files changed, 59 insertions(+), 82 deletions(-) delete mode 100644 public/app/features/org/all.js create mode 100644 public/app/features/org/all.ts rename public/app/features/org/{change_password_ctrl.js => change_password_ctrl.ts} (67%) rename public/app/features/org/{newOrgCtrl.js => new_org_ctrl.ts} (57%) rename public/app/features/org/{orgApiKeysCtrl.js => org_api_keys_ctrl.ts} (80%) rename public/app/features/org/{orgDetailsCtrl.js => org_details_ctrl.ts} (75%) rename public/app/features/org/{select_org_ctrl.js => select_org_ctrl.ts} (63%) rename public/app/features/org/{userInviteCtrl.js => user_invite_ctrl.ts} (80%) diff --git a/public/app/core/config.ts b/public/app/core/config.ts index f4898b4e08b..63f01bea458 100644 --- a/public/app/core/config.ts +++ b/public/app/core/config.ts @@ -15,6 +15,8 @@ class Settings { disableLoginForm: boolean; defaultDatasource: string; alertingEnabled: boolean; + authProxyEnabled: boolean; + ldapEnabled: boolean; constructor(options) { var defaults = { diff --git a/public/app/features/org/all.js b/public/app/features/org/all.js deleted file mode 100644 index e206583a8c7..00000000000 --- a/public/app/features/org/all.js +++ /dev/null @@ -1,12 +0,0 @@ -define([ - './org_users_ctrl', - './profile_ctrl', - './org_users_ctrl', - './select_org_ctrl', - './change_password_ctrl', - './newOrgCtrl', - './userInviteCtrl', - './orgApiKeysCtrl', - './orgDetailsCtrl', - './prefs_control', -], function () {}); diff --git a/public/app/features/org/all.ts b/public/app/features/org/all.ts new file mode 100644 index 00000000000..6b3eb67e7fb --- /dev/null +++ b/public/app/features/org/all.ts @@ -0,0 +1,10 @@ +import './org_users_ctrl'; +import './profile_ctrl'; +import './org_users_ctrl'; +import './select_org_ctrl'; +import './change_password_ctrl'; +import './new_org_ctrl'; +import './user_invite_ctrl'; +import './org_api_keys_ctrl'; +import './org_details_ctrl'; +import './prefs_control'; diff --git a/public/app/features/org/change_password_ctrl.js b/public/app/features/org/change_password_ctrl.ts similarity index 67% rename from public/app/features/org/change_password_ctrl.js rename to public/app/features/org/change_password_ctrl.ts index e1b9b8c9b37..9d4d1e9a770 100644 --- a/public/app/features/org/change_password_ctrl.js +++ b/public/app/features/org/change_password_ctrl.ts @@ -1,16 +1,10 @@ -define([ - 'angular', - 'app/core/config', -], -function (angular, config) { - 'use strict'; +import angular from 'angular'; +import config from 'app/core/config'; - config = config.default; - - var module = angular.module('grafana.controllers'); - - module.controller('ChangePasswordCtrl', function($scope, backendSrv, $location, navModelSrv) { +export class ChangePasswordCtrl { + /** @ngInject **/ + constructor($scope, backendSrv, $location, navModelSrv) { $scope.command = {}; $scope.authProxyEnabled = config.authProxyEnabled; $scope.ldapEnabled = config.ldapEnabled; @@ -28,6 +22,7 @@ function (angular, config) { $location.path("profile"); }); }; + } +} - }); -}); +angular.module('grafana.controllers').controller('ChangePasswordCtrl', ChangePasswordCtrl); diff --git a/public/app/features/org/newOrgCtrl.js b/public/app/features/org/new_org_ctrl.ts similarity index 57% rename from public/app/features/org/newOrgCtrl.js rename to public/app/features/org/new_org_ctrl.ts index cf8e239d065..72601df248f 100644 --- a/public/app/features/org/newOrgCtrl.js +++ b/public/app/features/org/new_org_ctrl.ts @@ -1,16 +1,10 @@ -define([ - 'angular', - 'app/core/config', -], -function (angular, config) { - 'use strict'; +import angular from 'angular'; +import config from 'app/core/config'; - config = config.default; - - var module = angular.module('grafana.controllers'); - - module.controller('NewOrgCtrl', function($scope, $http, backendSrv, navModelSrv) { +export class NewOrgCtrl { + /** @ngInject **/ + constructor($scope, $http, backendSrv, navModelSrv) { $scope.navModel = navModelSrv.getOrgNav(0); $scope.newOrg = {name: ''}; @@ -21,6 +15,7 @@ function (angular, config) { }); }); }; + } +} - }); -}); +angular.module('grafana.controllers').controller('NewOrgCtrl', NewOrgCtrl); diff --git a/public/app/features/org/orgApiKeysCtrl.js b/public/app/features/org/org_api_keys_ctrl.ts similarity index 80% rename from public/app/features/org/orgApiKeysCtrl.js rename to public/app/features/org/org_api_keys_ctrl.ts index 345f21cabfd..14b1b2b467d 100644 --- a/public/app/features/org/orgApiKeysCtrl.js +++ b/public/app/features/org/org_api_keys_ctrl.ts @@ -1,13 +1,9 @@ -define([ - 'angular', -], -function (angular) { - 'use strict'; +import angular from 'angular'; - var module = angular.module('grafana.controllers'); - - module.controller('OrgApiKeysCtrl', function($scope, $http, backendSrv, navModelSrv) { +export class OrgApiKeysCtrl { + /** @ngInject **/ + constructor ($scope, $http, backendSrv, navModelSrv) { $scope.navModel = navModelSrv.getOrgNav(0); $scope.roleTypes = ['Viewer', 'Editor', 'Admin']; $scope.token = { role: 'Viewer' }; @@ -43,6 +39,7 @@ function (angular) { }; $scope.init(); + } +} - }); -}); +angular.module('grafana.controllers').controller('OrgApiKeysCtrl', OrgApiKeysCtrl); diff --git a/public/app/features/org/orgDetailsCtrl.js b/public/app/features/org/org_details_ctrl.ts similarity index 75% rename from public/app/features/org/orgDetailsCtrl.js rename to public/app/features/org/org_details_ctrl.ts index 08c965fd333..b991b8a0b7c 100644 --- a/public/app/features/org/orgDetailsCtrl.js +++ b/public/app/features/org/org_details_ctrl.ts @@ -1,13 +1,9 @@ -define([ - 'angular', -], -function (angular) { - 'use strict'; +import angular from 'angular'; - var module = angular.module('grafana.controllers'); - - module.controller('OrgDetailsCtrl', function($scope, $http, backendSrv, contextSrv, navModelSrv) { +export class OrgDetailsCtrl { + /** @ngInject **/ + constructor($scope, $http, backendSrv, contextSrv, navModelSrv) { $scope.init = function() { $scope.getOrgInfo(); $scope.navModel = navModelSrv.getOrgNav(0); @@ -33,6 +29,7 @@ function (angular) { }; $scope.init(); + } +} - }); -}); +angular.module('grafana.controllers').controller('OrgDetailsCtrl', OrgDetailsCtrl); diff --git a/public/app/features/org/select_org_ctrl.js b/public/app/features/org/select_org_ctrl.ts similarity index 63% rename from public/app/features/org/select_org_ctrl.js rename to public/app/features/org/select_org_ctrl.ts index a6954dc2f9a..28a9b057e7f 100644 --- a/public/app/features/org/select_org_ctrl.js +++ b/public/app/features/org/select_org_ctrl.ts @@ -1,16 +1,10 @@ -define([ - 'angular', - 'app/core/config', -], -function (angular, config) { - 'use strict'; +import angular from 'angular'; +import config from 'app/core/config'; - config = config.default; - - var module = angular.module('grafana.controllers'); - - module.controller('SelectOrgCtrl', function($scope, backendSrv, contextSrv) { +export class SelectOrgCtrl { + /** @ngInject **/ + constructor($scope, backendSrv, contextSrv) { contextSrv.sidemenu = false; $scope.init = function() { @@ -30,6 +24,7 @@ function (angular, config) { }; $scope.init(); + } +} - }); -}); +angular.module('grafana.controllers').controller('SelectOrgCtrl', SelectOrgCtrl); diff --git a/public/app/features/org/userInviteCtrl.js b/public/app/features/org/user_invite_ctrl.ts similarity index 80% rename from public/app/features/org/userInviteCtrl.js rename to public/app/features/org/user_invite_ctrl.ts index 52b307612b3..cd6da83f10a 100644 --- a/public/app/features/org/userInviteCtrl.js +++ b/public/app/features/org/user_invite_ctrl.ts @@ -1,14 +1,10 @@ -define([ - 'angular', - 'lodash', -], -function (angular, _) { - 'use strict'; +import angular from 'angular'; +import _ from 'lodash'; - var module = angular.module('grafana.controllers'); - - module.controller('UserInviteCtrl', function($scope, backendSrv) { +export class UserInviteCtrl { + /** @ngInject **/ + constructor($scope, backendSrv) { $scope.invites = [ {name: '', email: '', role: 'Editor'}, ]; @@ -44,5 +40,7 @@ function (angular, _) { } }); }; - }); -}); + } +} + +angular.module('grafana.controllers').controller('UserInviteCtrl', UserInviteCtrl);