From 26af4adb61914e7c4fb4f4298baf0697a152c06e Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Sat, 24 Jun 2017 21:50:31 -0400 Subject: [PATCH 01/21] Removed ClearScope service in favor of logic in stateChangeStart --- awx/ui/client/src/app.js | 26 ++++++++++++- .../configuration/configuration.controller.js | 4 +- .../list/credentials-list.controller.js | 6 +-- awx/ui/client/src/home/home.controller.js | 6 +-- .../inventories/adhoc/adhoc.controller.js | 6 +-- .../add/smart-inventory-add.controller.js | 6 +-- .../edit/smart-inventory-edit.controller.js | 7 +--- .../add/inventory-add.controller.js | 8 ++-- .../edit/inventory-edit.controller.js | 4 +- .../client/src/jobs/jobs-list.controller.js | 6 +-- .../login/loginModal/loginModal.directive.js | 4 +- .../add/organizations-add.controller.js | 6 +-- .../edit/organizations-edit.controller.js | 6 +-- .../list/organizations-list.controller.js | 6 +-- .../projects/edit/projects-edit.controller.js | 6 +-- .../src/scheduler/schedulerList.controller.js | 6 +-- awx/ui/client/src/shared/Utilities.js | 37 ------------------- .../standard-out/standard-out.controller.js | 6 +-- .../src/teams/add/teams-add.controller.js | 7 +--- .../src/teams/edit/teams-edit.controller.js | 5 +-- .../src/teams/list/teams-list.controller.js | 6 +-- .../job-template-add.controller.js | 5 +-- .../job-template-edit.controller.js | 6 +-- .../list/templates-list.controller.js | 7 ++-- .../add-workflow/workflow-add.controller.js | 5 +-- .../edit-workflow/workflow-edit.controller.js | 5 +-- .../src/users/add/users-add.controller.js | 5 +-- .../src/users/edit/users-edit.controller.js | 5 +-- .../src/users/list/users-list.controller.js | 6 +-- .../templates-list.controller-test.js | 7 +--- .../workflows/workflow-add.controller-test.js | 11 +----- 31 files changed, 81 insertions(+), 155 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index ccbf9b04ef..9762e4a922 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -203,12 +203,12 @@ var tower = angular.module('Tower', [ ]) .run(['$stateExtender', '$q', '$compile', '$cookies', '$rootScope', '$log', '$stateParams', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer', - 'ClearScope', 'LoadConfig', 'Store', 'pendoService', 'Prompt', 'Rest', + 'LoadConfig', 'Store', 'pendoService', 'Prompt', 'Rest', 'Wait', 'ProcessErrors', '$state', 'GetBasePath', 'ConfigService', 'FeaturesService', '$filter', 'SocketService', function($stateExtender, $q, $compile, $cookies, $rootScope, $log, $stateParams, CheckLicense, $location, Authorization, LoadBasePaths, Timer, - ClearScope, LoadConfig, Store, pendoService, Prompt, Rest, Wait, + LoadConfig, Store, pendoService, Prompt, Rest, Wait, ProcessErrors, $state, GetBasePath, ConfigService, FeaturesService, $filter, SocketService) { @@ -305,6 +305,28 @@ var tower = angular.module('Tower', [ window.clearInterval($rootScope.jobStdOutInterval); } + $rootScope.flashMessage = null; + + $('#form-modal2 .modal-body').empty(); + + $('.tooltip').each(function() { + $(this).remove(); + }); + + $('.popover').each(function() { + $(this).remove(); + }); + + $('.ui-dialog-content').each(function() { + $(this).dialog('close'); + }); + + try { + $('#help-modal').dialog('close'); + } catch (e) { + // ignore + } + // On each navigation request, check that the user is logged in if (!/^\/(login|logout)/.test($location.path())) { // capture most recent URL, excluding login/logout diff --git a/awx/ui/client/src/configuration/configuration.controller.js b/awx/ui/client/src/configuration/configuration.controller.js index b1d9063bc6..b9a151c524 100644 --- a/awx/ui/client/src/configuration/configuration.controller.js +++ b/awx/ui/client/src/configuration/configuration.controller.js @@ -5,7 +5,7 @@ *************************************************/ export default [ - '$scope', '$rootScope', '$state', '$stateParams', '$timeout', '$q', 'Alert', 'ClearScope', + '$scope', '$rootScope', '$state', '$stateParams', '$timeout', '$q', 'Alert', 'ConfigurationService', 'ConfigurationUtils', 'CreateDialog', 'CreateSelect2', 'i18n', 'ParseTypeChange', 'ProcessErrors', 'Store', 'Wait', 'configDataResolve', 'ToJSON', //Form definitions @@ -24,7 +24,7 @@ export default [ 'ConfigurationJobsForm', 'ConfigurationUiForm', function( - $scope, $rootScope, $state, $stateParams, $timeout, $q, Alert, ClearScope, + $scope, $rootScope, $state, $stateParams, $timeout, $q, Alert, ConfigurationService, ConfigurationUtils, CreateDialog, CreateSelect2, i18n, ParseTypeChange, ProcessErrors, Store, Wait, configDataResolve, ToJSON, //Form definitions diff --git a/awx/ui/client/src/credentials/list/credentials-list.controller.js b/awx/ui/client/src/credentials/list/credentials-list.controller.js index fb0c903b4c..968b7def7c 100644 --- a/awx/ui/client/src/credentials/list/credentials-list.controller.js +++ b/awx/ui/client/src/credentials/list/credentials-list.controller.js @@ -4,14 +4,12 @@ * All Rights Reserved *************************************************/ -export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ClearScope', +export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'i18n', - function($scope, Rest, CredentialList, Prompt, ClearScope, + function($scope, Rest, CredentialList, Prompt, ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, i18n) { - ClearScope(); - var list = CredentialList, defaultUrl = GetBasePath('credentials'); diff --git a/awx/ui/client/src/home/home.controller.js b/awx/ui/client/src/home/home.controller.js index bbdc615c69..3b70235c84 100644 --- a/awx/ui/client/src/home/home.controller.js +++ b/awx/ui/client/src/home/home.controller.js @@ -5,11 +5,9 @@ *************************************************/ export default ['$scope', '$rootScope','Wait', - 'ClearScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'graphData', + 'Rest', 'GetBasePath', 'ProcessErrors', 'graphData', function($scope, $rootScope, Wait, - ClearScope, Rest, GetBasePath, ProcessErrors, graphData) { - - ClearScope('home'); + Rest, GetBasePath, ProcessErrors, graphData) { var dataCount = 0; diff --git a/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js b/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js index f1b8db2d9b..be89a6cee0 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/adhoc/adhoc.controller.js @@ -11,11 +11,9 @@ */ function adhocController($q, $scope, $stateParams, $state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm, - GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices, + GenerateForm, Rest, ProcessErrors, GetBasePath, GetChoices, KindChange, Wait, ParseTypeChange) { - ClearScope(); - // this is done so that we can access private functions for testing, but // we don't want to populate the "public" scope with these internal // functions @@ -302,6 +300,6 @@ function adhocController($q, $scope, $stateParams, export default ['$q', '$scope', '$stateParams', '$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2', - 'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath', + 'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'GetBasePath', 'GetChoices', 'KindChange', 'Wait', 'ParseTypeChange', adhocController]; diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js index b390dbe606..4d916c5b99 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js @@ -12,13 +12,11 @@ function SmartInventoryAdd($scope, $location, GenerateForm, smartInventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors, - ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, + GetBasePath, ParseTypeChange, Wait, ToJSON, $state, canAdd) { $scope.canAdd = canAdd; - ClearScope(); - // Inject dynamic view var defaultUrl = GetBasePath('inventory'), form = smartInventoryForm; @@ -90,6 +88,6 @@ function SmartInventoryAdd($scope, $location, export default ['$scope', '$location', 'GenerateForm', 'smartInventoryForm', 'rbacUiControlService', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', + 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', '$state', 'canAdd', SmartInventoryAdd ]; diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js index 637110dd0e..885556e6bd 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js @@ -6,7 +6,7 @@ function SmartInventoryEdit($scope, $location, $stateParams, InventoryForm, Rest, ProcessErrors, - ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, + GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, $state, OrgAdminLookup, resourceData, $rootScope) { // Inject dynamic view @@ -14,12 +14,9 @@ function SmartInventoryEdit($scope, $location, form = InventoryForm, inventory_id = $stateParams.smartinventory_id, inventoryData = resourceData.data; - - ClearScope(); init(); function init() { - ClearScope(); form.formLabelSize = null; form.formFieldSize = null; $scope.inventory_id = inventory_id; @@ -97,7 +94,7 @@ function SmartInventoryEdit($scope, $location, export default [ '$scope', '$location', '$stateParams', 'InventoryForm', 'Rest', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', 'Wait', + 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', 'ParseVariableString', '$state', 'OrgAdminLookup', 'resourceData', '$rootScope', SmartInventoryEdit ]; diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/inventory-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/inventory-add.controller.js index af1f2cae85..5d332b80f0 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/inventory-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/inventory-add.controller.js @@ -12,13 +12,11 @@ function InventoriesAdd($scope, $location, GenerateForm, InventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors, - ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, + GetBasePath, ParseTypeChange, Wait, ToJSON, $state, canAdd, CreateSelect2, InstanceGroupsService) { $scope.canAdd = canAdd; - ClearScope(); - // Inject dynamic view var defaultUrl = GetBasePath('inventory'), form = InventoryForm; @@ -96,6 +94,6 @@ function InventoriesAdd($scope, $location, export default ['$scope', '$location', 'GenerateForm', 'InventoryForm', 'rbacUiControlService', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', + 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', '$state','canAdd', 'CreateSelect2', 'InstanceGroupsService', InventoriesAdd -]; \ No newline at end of file +]; diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js index 1a0cc2f3dc..443a65be35 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js @@ -12,7 +12,7 @@ function InventoriesEdit($scope, $location, $stateParams, InventoryForm, Rest, ProcessErrors, - ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, + GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData, CreateSelect2, InstanceGroupsService, InstanceGroupsData) { // Inject dynamic view @@ -111,7 +111,7 @@ function InventoriesEdit($scope, $location, export default ['$scope', '$location', '$stateParams', 'InventoryForm', 'Rest', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', 'Wait', + 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', 'ParseVariableString', '$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', InventoriesEdit, ]; diff --git a/awx/ui/client/src/jobs/jobs-list.controller.js b/awx/ui/client/src/jobs/jobs-list.controller.js index 36c7e468ba..e86ccbc1d8 100644 --- a/awx/ui/client/src/jobs/jobs-list.controller.js +++ b/awx/ui/client/src/jobs/jobs-list.controller.js @@ -11,14 +11,12 @@ */ export default ['$state', '$rootScope', '$scope', '$stateParams', - 'ClearScope', 'Find', 'DeleteJob', 'RelaunchJob', + 'Find', 'DeleteJob', 'RelaunchJob', 'GetBasePath', 'Dataset', 'QuerySet', 'ListDefinition', '$interpolate', function($state, $rootScope, $scope, $stateParams, - ClearScope, Find, DeleteJob, RelaunchJob, + Find, DeleteJob, RelaunchJob, GetBasePath, Dataset, qs, ListDefinition, $interpolate) { - ClearScope(); - var list = ListDefinition; init(); diff --git a/awx/ui/client/src/login/loginModal/loginModal.directive.js b/awx/ui/client/src/login/loginModal/loginModal.directive.js index 058593eb4c..f9b3f8866b 100644 --- a/awx/ui/client/src/login/loginModal/loginModal.directive.js +++ b/awx/ui/client/src/login/loginModal/loginModal.directive.js @@ -8,9 +8,8 @@ import authenticationController from './loginModal.controller'; /* jshint unused: vars */ export default [ 'templateUrl', - 'ClearScope', 'Wait', - function(templateUrl, ClearScope, Wait) { + function(templateUrl, Wait) { return { restrict: 'E', scope: true, @@ -19,7 +18,6 @@ export default link: function(scope, element, attrs) { var setLoginFocus = function () { // Need to clear out any open dialog windows that might be open when this modal opens. - ClearScope(); $('#login-username').focus(); }; diff --git a/awx/ui/client/src/organizations/add/organizations-add.controller.js b/awx/ui/client/src/organizations/add/organizations-add.controller.js index b8d2140374..2a43f8652d 100644 --- a/awx/ui/client/src/organizations/add/organizations-add.controller.js +++ b/awx/ui/client/src/organizations/add/organizations-add.controller.js @@ -6,9 +6,9 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', 'CreateSelect2', '$state','InstanceGroupsService', + 'ProcessErrors', 'GetBasePath', 'Wait', 'CreateSelect2', '$state','InstanceGroupsService', function($scope, $rootScope, $location, $stateParams, OrganizationForm, - GenerateForm, Rest, Alert, ProcessErrors, ClearScope, GetBasePath, Wait, CreateSelect2, $state, InstanceGroupsService) { + GenerateForm, Rest, Alert, ProcessErrors, GetBasePath, Wait, CreateSelect2, $state, InstanceGroupsService) { Rest.setUrl(GetBasePath('organizations')); Rest.options() @@ -19,8 +19,6 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', } }); - ClearScope(); - var form = OrganizationForm(), base = $location.path().replace(/^\//, '').split('/')[0]; init(); diff --git a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js index 7c7b48e7d2..7c74e1e3cb 100644 --- a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js +++ b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js @@ -5,14 +5,12 @@ *************************************************/ export default ['$scope', '$location', '$stateParams', - 'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt', 'ClearScope', + 'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt', 'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', function($scope, $location, $stateParams, - OrganizationForm, Rest, ProcessErrors, Prompt, ClearScope, + OrganizationForm, Rest, ProcessErrors, Prompt, GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData) { - ClearScope(); - let form = OrganizationForm(), defaultUrl = GetBasePath('organizations'), base = $location.path().replace(/^\//, '').split('/')[0], diff --git a/awx/ui/client/src/organizations/list/organizations-list.controller.js b/awx/ui/client/src/organizations/list/organizations-list.controller.js index 0711c21e01..bf9640db26 100644 --- a/awx/ui/client/src/organizations/list/organizations-list.controller.js +++ b/awx/ui/client/src/organizations/list/organizations-list.controller.js @@ -6,14 +6,12 @@ export default ['$stateParams', '$scope', '$rootScope', - 'Rest', 'OrganizationList', 'Prompt', 'ClearScope', + 'Rest', 'OrganizationList', 'Prompt', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', 'rbacUiControlService', '$filter', 'Dataset', 'i18n', function($stateParams, $scope, $rootScope, - Rest, OrganizationList, Prompt, ClearScope, + Rest, OrganizationList, Prompt, ProcessErrors, GetBasePath, Wait, $state, rbacUiControlService, $filter, Dataset, i18n) { - ClearScope(); - var defaultUrl = GetBasePath('organizations'), list = OrganizationList; diff --git a/awx/ui/client/src/projects/edit/projects-edit.controller.js b/awx/ui/client/src/projects/edit/projects-edit.controller.js index 67980870a4..283bbeabd3 100644 --- a/awx/ui/client/src/projects/edit/projects-edit.controller.js +++ b/awx/ui/client/src/projects/edit/projects-edit.controller.js @@ -5,17 +5,15 @@ *************************************************/ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', - 'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt', 'ClearScope', + 'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt', 'GetBasePath', 'GetProjectPath', 'Authorization', 'GetChoices', 'Empty', 'Wait', 'ProjectUpdate', '$state', 'CreateSelect2', 'ToggleNotification', 'i18n', 'CredentialTypes', function($scope, $rootScope, $stateParams, ProjectsForm, Rest, Alert, - ProcessErrors, GenerateForm, Prompt, ClearScope, GetBasePath, + ProcessErrors, GenerateForm, Prompt, GetBasePath, GetProjectPath, Authorization, GetChoices, Empty, Wait, ProjectUpdate, $state, CreateSelect2, ToggleNotification, i18n, CredentialTypes) { - ClearScope('htmlTemplate'); - var form = ProjectsForm(), defaultUrl = GetBasePath('projects') + $stateParams.project_id + '/', master = {}, diff --git a/awx/ui/client/src/scheduler/schedulerList.controller.js b/awx/ui/client/src/scheduler/schedulerList.controller.js index 4604a04778..db400dc9c4 100644 --- a/awx/ui/client/src/scheduler/schedulerList.controller.js +++ b/awx/ui/client/src/scheduler/schedulerList.controller.js @@ -13,16 +13,14 @@ export default [ '$scope', '$location', '$stateParams', 'ScheduleList', 'Rest', - 'ClearScope', 'rbacUiControlService', + 'rbacUiControlService', 'ToggleSchedule', 'DeleteSchedule', '$q', '$state', 'Dataset', 'ParentObject', 'UnifiedJobsOptions', function($scope, $location, $stateParams, - ScheduleList, Rest, ClearScope, + ScheduleList, Rest, rbacUiControlService, ToggleSchedule, DeleteSchedule, $q, $state, Dataset, ParentObject, UnifiedJobsOptions) { - ClearScope(); - var base, scheduleEndpoint, list = ScheduleList; diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index 9bfecdf780..09e0b1c867 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -20,43 +20,6 @@ export default angular.module('Utilities', ['RestServices', 'Utilities']) -/** - * @ngdoc method - * @name shared.function:Utilities#ClearScope - * @methodOf shared.function:Utilities - * @description - * Place to remove things that might be lingering from a prior tab or view. - * This used to destroy the scope, but that causes issues in angular 1.2.x - */ -.factory('ClearScope', ['$rootScope', function($rootScope) { - return function() { - - $rootScope.flashMessage = null; - - //$('#form-modal .modal-body').empty(); - $('#form-modal2 .modal-body').empty(); - - $('.tooltip').each(function() { - $(this).remove(); - }); - - $('.popover').each(function() { - $(this).remove(); - }); - - $('.ui-dialog-content').each(function() { - $(this).dialog('close'); - }); - - try { - $('#help-modal').dialog('close'); - } catch (e) { - // ignore - } - }; -}]) - - /** * @ngdoc method * @name shared.function:Utilities#Empty diff --git a/awx/ui/client/src/standard-out/standard-out.controller.js b/awx/ui/client/src/standard-out/standard-out.controller.js index debc8efcb0..bbaf6c4536 100644 --- a/awx/ui/client/src/standard-out/standard-out.controller.js +++ b/awx/ui/client/src/standard-out/standard-out.controller.js @@ -11,11 +11,9 @@ */ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, - ClearScope, GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName, + GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName, ParseTypeChange, ParseVariableString, RelaunchJob, DeleteJob, Wait, i18n) { - ClearScope(); - var job_id = $stateParams.id, jobType = $state.current.data.jobType; @@ -279,6 +277,6 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, } JobStdoutController.$inject = [ '$rootScope', '$scope', '$state', - '$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors', + '$stateParams', 'GetBasePath', 'Rest', 'ProcessErrors', 'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange', 'ParseVariableString', 'RelaunchJob', 'DeleteJob', 'Wait', 'i18n']; diff --git a/awx/ui/client/src/teams/add/teams-add.controller.js b/awx/ui/client/src/teams/add/teams-add.controller.js index 6204565958..c309947b4d 100644 --- a/awx/ui/client/src/teams/add/teams-add.controller.js +++ b/awx/ui/client/src/teams/add/teams-add.controller.js @@ -5,12 +5,9 @@ *************************************************/ export default ['$scope', '$rootScope', 'TeamForm', 'GenerateForm', 'Rest', - 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', '$state', + 'Alert', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', function($scope, $rootScope, TeamForm, GenerateForm, Rest, Alert, - ProcessErrors, ClearScope, GetBasePath, Wait, $state) { - - ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior - //$scope. + ProcessErrors, GetBasePath, Wait, $state) { Rest.setUrl(GetBasePath('teams')); Rest.options() diff --git a/awx/ui/client/src/teams/edit/teams-edit.controller.js b/awx/ui/client/src/teams/edit/teams-edit.controller.js index 0091baf109..cb1c320e43 100644 --- a/awx/ui/client/src/teams/edit/teams-edit.controller.js +++ b/awx/ui/client/src/teams/edit/teams-edit.controller.js @@ -5,10 +5,9 @@ *************************************************/ export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', '$state', + 'ProcessErrors', 'GetBasePath', 'Wait', '$state', function($scope, $rootScope, $stateParams, TeamForm, Rest, ProcessErrors, - ClearScope, GetBasePath, Wait, $state) { - ClearScope(); + GetBasePath, Wait, $state) { var form = TeamForm, id = $stateParams.team_id, diff --git a/awx/ui/client/src/teams/list/teams-list.controller.js b/awx/ui/client/src/teams/list/teams-list.controller.js index 2e59cf0b42..ffea0daea6 100644 --- a/awx/ui/client/src/teams/list/teams-list.controller.js +++ b/awx/ui/client/src/teams/list/teams-list.controller.js @@ -4,14 +4,12 @@ * All Rights Reserved *************************************************/ -export default ['$scope', 'Rest', 'TeamList', 'Prompt', 'ClearScope', +export default ['$scope', 'Rest', 'TeamList', 'Prompt', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', - function($scope, Rest, TeamList, Prompt, ClearScope, ProcessErrors, + function($scope, Rest, TeamList, Prompt, ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset) { - ClearScope(); - var list = TeamList, defaultUrl = GetBasePath('teams'); diff --git a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js index 9af650ae77..a76ac90481 100644 --- a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js +++ b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js @@ -7,13 +7,13 @@ export default [ '$filter', '$scope', '$stateParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait', + 'ProcessErrors', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait', 'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state', 'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService', 'MultiCredentialService', function( $filter, $scope, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert, - ProcessErrors, ClearScope, GetBasePath, md5Setup, ParseTypeChange, Wait, + ProcessErrors, GetBasePath, md5Setup, ParseTypeChange, Wait, Empty, ToJSON, CallbackHelpInit, GetChoices, $state, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService, MultiCredentialService ) { @@ -27,7 +27,6 @@ } }); - ClearScope(); // Inject dynamic view let defaultUrl = GetBasePath('job_templates'), form = JobTemplateForm(), diff --git a/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js b/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js index ea1bce9c0c..a0173af964 100644 --- a/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js +++ b/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js @@ -13,7 +13,7 @@ export default [ '$filter', '$scope', '$rootScope', '$location', '$stateParams', 'JobTemplateForm', 'GenerateForm', - 'Rest', 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'md5Setup', + 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait', 'Empty', 'Prompt', 'ToJSON', 'GetChoices', 'CallbackHelpInit', 'InitiatePlaybookRun' , 'initSurvey', '$state', 'CreateSelect2', @@ -21,14 +21,12 @@ export default function( $filter, $scope, $rootScope, $location, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert, - ProcessErrors, ClearScope, GetBasePath, md5Setup, + ProcessErrors, GetBasePath, md5Setup, ParseTypeChange, Wait, Empty, Prompt, ToJSON, GetChoices, CallbackHelpInit, InitiatePlaybookRun, SurveyControllerInit, $state, CreateSelect2, ToggleNotification, $q, InstanceGroupsService, InstanceGroupsData, MultiCredentialService ) { - ClearScope(); - $scope.$watch('job_template_obj.summary_fields.user_capabilities.edit', function(val) { if (val === false) { $scope.canAddJobTemplate = false; diff --git a/awx/ui/client/src/templates/list/templates-list.controller.js b/awx/ui/client/src/templates/list/templates-list.controller.js index dc6467b834..b43e3f0232 100644 --- a/awx/ui/client/src/templates/list/templates-list.controller.js +++ b/awx/ui/client/src/templates/list/templates-list.controller.js @@ -5,17 +5,16 @@ *************************************************/ export default ['$scope', '$rootScope', - 'Alert','TemplateList', 'Prompt', 'ClearScope', 'ProcessErrors', + 'Alert','TemplateList', 'Prompt', 'ProcessErrors', 'GetBasePath', 'InitiatePlaybookRun', 'Wait', '$state', '$filter', 'Dataset', 'rbacUiControlService', 'TemplatesService','QuerySet', 'TemplateCopyService', function( $scope, $rootScope, Alert, - TemplateList, Prompt, ClearScope, ProcessErrors, GetBasePath, + TemplateList, Prompt, ProcessErrors, GetBasePath, InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, TemplatesService, qs, TemplateCopyService ) { - ClearScope(); var list = TemplateList; @@ -77,7 +76,7 @@ export default ['$scope', '$rootScope', $scope[list.name] = $scope[`${list.iterator}_dataset`].results; }); }); - + $scope.editJobTemplate = function(template) { if(template) { if(template.type && (template.type === 'Job Template' || template.type === 'job_template')) { diff --git a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js index be496f559e..255ab47faf 100644 --- a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js +++ b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js @@ -6,10 +6,10 @@ export default [ '$scope', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors', - 'ClearScope', 'Wait', '$state', 'CreateSelect2', 'TemplatesService', + 'Wait', '$state', 'CreateSelect2', 'TemplatesService', 'ToJSON', 'ParseTypeChange', '$q', 'Rest', 'GetBasePath', function($scope, WorkflowForm, GenerateForm, Alert, ProcessErrors, - ClearScope, Wait, $state, CreateSelect2, TemplatesService, ToJSON, + Wait, $state, CreateSelect2, TemplatesService, ToJSON, ParseTypeChange, $q, Rest, GetBasePath) { Rest.setUrl(GetBasePath('workflow_job_templates')); @@ -21,7 +21,6 @@ export default [ } }); - ClearScope(); // Inject dynamic view let form = WorkflowForm(), generator = GenerateForm; diff --git a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js index fb408745a2..2f74ba7b81 100644 --- a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js +++ b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js @@ -6,15 +6,14 @@ export default [ '$scope', '$stateParams', 'WorkflowForm', 'GenerateForm', 'Alert', - 'ProcessErrors', 'ClearScope', 'GetBasePath', '$q', 'ParseTypeChange', + 'ProcessErrors', 'GetBasePath', '$q', 'ParseTypeChange', 'Wait', 'Empty', 'ToJSON', 'initSurvey', '$state', 'CreateSelect2', 'ParseVariableString', 'TemplatesService', 'Rest', 'ToggleNotification', 'OrgAdminLookup', function($scope, $stateParams, WorkflowForm, GenerateForm, Alert, - ProcessErrors, ClearScope, GetBasePath, $q, ParseTypeChange, Wait, Empty, + ProcessErrors, GetBasePath, $q, ParseTypeChange, Wait, Empty, ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString, TemplatesService, Rest, ToggleNotification, OrgAdminLookup) { - ClearScope(); $scope.$watch('workflow_job_template_obj.summary_fields.user_capabilities.edit', function(val) { if (val === false) { diff --git a/awx/ui/client/src/users/add/users-add.controller.js b/awx/ui/client/src/users/add/users-add.controller.js index 3263b6d545..d3e7abc3dd 100644 --- a/awx/ui/client/src/users/add/users-add.controller.js +++ b/awx/ui/client/src/users/add/users-add.controller.js @@ -13,12 +13,11 @@ const user_type_options = [ ]; export default ['$scope', '$rootScope', 'UserForm', 'GenerateForm', 'Rest', - 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'GetBasePath', + 'Alert', 'ProcessErrors', 'ReturnToCaller', 'GetBasePath', 'Wait', 'CreateSelect2', '$state', '$location', 'i18n', function($scope, $rootScope, UserForm, GenerateForm, Rest, Alert, - ProcessErrors, ReturnToCaller, ClearScope, GetBasePath, Wait, CreateSelect2, + ProcessErrors, ReturnToCaller, GetBasePath, Wait, CreateSelect2, $state, $location, i18n) { - ClearScope(); var defaultUrl = GetBasePath('organizations'), form = UserForm; diff --git a/awx/ui/client/src/users/edit/users-edit.controller.js b/awx/ui/client/src/users/edit/users-edit.controller.js index 9db7d1f83f..93e8b02658 100644 --- a/awx/ui/client/src/users/edit/users-edit.controller.js +++ b/awx/ui/client/src/users/edit/users-edit.controller.js @@ -13,15 +13,14 @@ const user_type_options = [ ]; export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', 'CreateSelect2', + 'ProcessErrors', 'GetBasePath', 'Wait', 'CreateSelect2', '$state', 'i18n', function($scope, $rootScope, $stateParams, UserForm, Rest, ProcessErrors, - ClearScope, GetBasePath, Wait, CreateSelect2, $state, i18n) { + GetBasePath, Wait, CreateSelect2, $state, i18n) { for (var i = 0; i < user_type_options.length; i++) { user_type_options[i].label = i18n._(user_type_options[i].label); } - ClearScope(); var form = UserForm, master = {}, diff --git a/awx/ui/client/src/users/list/users-list.controller.js b/awx/ui/client/src/users/list/users-list.controller.js index c443c634b2..60a41def0a 100644 --- a/awx/ui/client/src/users/list/users-list.controller.js +++ b/awx/ui/client/src/users/list/users-list.controller.js @@ -13,9 +13,9 @@ const user_type_options = [ ]; export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt', - 'ClearScope', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', + 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'i18n', - function($scope, $rootScope, Rest, UserList, Prompt, ClearScope, + function($scope, $rootScope, Rest, UserList, Prompt, ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, i18n) { @@ -23,8 +23,6 @@ export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt', user_type_options[i].label = i18n._(user_type_options[i].label); } - ClearScope(); - var list = UserList, defaultUrl = GetBasePath('users'); diff --git a/awx/ui/tests/spec/templates/templates-list.controller-test.js b/awx/ui/tests/spec/templates/templates-list.controller-test.js index 837b42ff12..d620e39d6f 100644 --- a/awx/ui/tests/spec/templates/templates-list.controller-test.js +++ b/awx/ui/tests/spec/templates/templates-list.controller-test.js @@ -6,7 +6,6 @@ describe('Controller: TemplatesList', () => { rootScope, state, TemplatesListController, - ClearScope, GetChoices, Alert, Prompt, @@ -53,7 +52,6 @@ describe('Controller: TemplatesList', () => { } }; - ClearScope = jasmine.createSpy('ClearScope'); GetChoices = jasmine.createSpy('GetChoices'); Alert = jasmine.createSpy('Alert'); Prompt = jasmine.createSpy('Prompt').and.callFake(function(args) { @@ -61,7 +59,6 @@ describe('Controller: TemplatesList', () => { }); InitiatePlaybookRun = jasmine.createSpy('InitiatePlaybookRun'); - $provide.value('ClearScope', ClearScope); $provide.value('GetChoices', GetChoices); $provide.value('Alert', Alert); $provide.value('Prompt', Prompt); @@ -69,12 +66,11 @@ describe('Controller: TemplatesList', () => { $provide.value('InitiatePlaybookRun', InitiatePlaybookRun); })); - beforeEach(angular.mock.inject( ($rootScope, $controller, $q, _state_, _ConfigService_, _ClearScope_, _GetChoices_, _Alert_, _Prompt_, _InitiatePlaybookRun_) => { + beforeEach(angular.mock.inject( ($rootScope, $controller, $q, _state_, _ConfigService_, _GetChoices_, _Alert_, _Prompt_, _InitiatePlaybookRun_) => { scope = $rootScope.$new(); rootScope = $rootScope; q = $q; state = _state_; - ClearScope = _ClearScope_; GetChoices = _GetChoices_; Alert = _Alert_; Prompt = _Prompt_; @@ -92,7 +88,6 @@ describe('Controller: TemplatesList', () => { $scope: scope, $rootScope: rootScope, $state: state, - ClearScope: ClearScope, GetChoices: GetChoices, Alert: Alert, Prompt: Prompt, diff --git a/awx/ui/tests/spec/workflows/workflow-add.controller-test.js b/awx/ui/tests/spec/workflows/workflow-add.controller-test.js index a65f6991d9..697e093a67 100644 --- a/awx/ui/tests/spec/workflows/workflow-add.controller-test.js +++ b/awx/ui/tests/spec/workflows/workflow-add.controller-test.js @@ -5,7 +5,6 @@ describe('Controller: WorkflowAdd', () => { let scope, state, WorkflowAdd, - ClearScope, Alert, GenerateForm, TemplatesService, @@ -45,7 +44,6 @@ describe('Controller: WorkflowAdd', () => { } }; - ClearScope = jasmine.createSpy('ClearScope'); Alert = jasmine.createSpy('Alert'); ProcessErrors = jasmine.createSpy('ProcessErrors'); CreateSelect2 = jasmine.createSpy('CreateSelect2'); @@ -53,7 +51,6 @@ describe('Controller: WorkflowAdd', () => { ParseTypeChange = jasmine.createSpy('ParseTypeChange'); ToJSON = jasmine.createSpy('ToJSON'); - $provide.value('ClearScope', ClearScope); $provide.value('Alert', Alert); $provide.value('GenerateForm', GenerateForm); $provide.value('state', state); @@ -64,11 +61,10 @@ describe('Controller: WorkflowAdd', () => { $provide.value('ToJSON', ToJSON); })); - beforeEach(angular.mock.inject( ($rootScope, $controller, $q, $httpBackend, _state_, _ConfigService_, _ClearScope_, _GetChoices_, _Alert_, _GenerateForm_, _ProcessErrors_, _CreateSelect2_, _Wait_, _ParseTypeChange_, _ToJSON_) => { + beforeEach(angular.mock.inject( ($rootScope, $controller, $q, $httpBackend, _state_, _ConfigService_, _GetChoices_, _Alert_, _GenerateForm_, _ProcessErrors_, _CreateSelect2_, _Wait_, _ParseTypeChange_, _ToJSON_) => { scope = $rootScope.$new(); state = _state_; q = $q; - ClearScope = _ClearScope_; Alert = _Alert_; GenerateForm = _GenerateForm_; httpBackend = $httpBackend; @@ -94,7 +90,6 @@ describe('Controller: WorkflowAdd', () => { WorkflowAdd = $controller('WorkflowAdd', { $scope: scope, $state: state, - ClearScope: ClearScope, Alert: Alert, GenerateForm: GenerateForm, TemplatesService: TemplatesService, @@ -106,10 +101,6 @@ describe('Controller: WorkflowAdd', () => { }); })); - it('should call ClearScope', ()=>{ - expect(ClearScope).toHaveBeenCalled(); - }); - it('should get/set the label options and select2-ify the input', ()=>{ // Resolve TemplatesService.getLabelsForJobTemplate getLabelsDeferred.resolve({ From 48a46049f9f749940f9f9ca1ea1d1fb2e80ceda3 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Sat, 24 Jun 2017 22:07:45 -0400 Subject: [PATCH 02/21] Fixed inventory credential_type lookup search tag --- .../inventories/standard-inventory/inventory.form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js index 06e79d7239..73d81559bb 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js @@ -76,7 +76,7 @@ function(i18n, InventoryCompletedJobsList) { sourceModel: 'insights_credential', sourceField: 'name', search: { - credential_type: 13 //insights + credential_type: '13' //insights } }, instance_groups: { From f11aef01efbb929c963651758d680ee09b8cd4e2 Mon Sep 17 00:00:00 2001 From: gconsidine Date: Tue, 20 Jun 2017 10:02:47 -0400 Subject: [PATCH 03/21] Add contextual variables and update references --- .../edit-credentials.controller.js | 2 +- .../client/lib/components/action/_index.less | 4 +- .../lib/components/form/action.directive.js | 4 +- .../client/lib/components/input/_index.less | 95 ++++++------- .../lib/components/input/group.directive.js | 15 +- .../lib/components/input/lookup.partial.html | 2 +- .../client/lib/components/panel/_index.less | 8 +- .../client/lib/components/popover/_index.less | 26 ++-- awx/ui/client/lib/components/tabs/_index.less | 19 +-- .../lib/components/tabs/tab.partial.html | 2 +- awx/ui/client/lib/theme/_base-variables.less | 67 +++++++++ awx/ui/client/lib/theme/_common.less | 38 ------ .../lib/theme/_contextual-variables.less | 128 ++++++++++++++++++ awx/ui/client/lib/theme/_global.less | 41 ++++++ awx/ui/client/lib/theme/_mixins.less | 37 ++--- awx/ui/client/lib/theme/_variables.less | 72 ---------- awx/ui/client/lib/theme/index.less | 5 +- 17 files changed, 349 insertions(+), 216 deletions(-) create mode 100644 awx/ui/client/lib/theme/_base-variables.less delete mode 100644 awx/ui/client/lib/theme/_common.less create mode 100644 awx/ui/client/lib/theme/_contextual-variables.less create mode 100644 awx/ui/client/lib/theme/_global.less delete mode 100644 awx/ui/client/lib/theme/_variables.less diff --git a/awx/ui/client/features/credentials/edit-credentials.controller.js b/awx/ui/client/features/credentials/edit-credentials.controller.js index b7370fe7c6..421baa1808 100644 --- a/awx/ui/client/features/credentials/edit-credentials.controller.js +++ b/awx/ui/client/features/credentials/edit-credentials.controller.js @@ -77,7 +77,7 @@ function EditCredentialsController (models, $state, $scope) { }; vm.form.onSaveSuccess = res => { - $state.go('credentials', { reload: true }); + $state.go('credentials.edit', { credential_id: credential.get('id') }, { reload: true }); }; } diff --git a/awx/ui/client/lib/components/action/_index.less b/awx/ui/client/lib/components/action/_index.less index 95231f8a41..6208e2a41d 100644 --- a/awx/ui/client/lib/components/action/_index.less +++ b/awx/ui/client/lib/components/action/_index.less @@ -1,7 +1,7 @@ .at-ActionGroup { - margin-top: @at-space-6x; + margin-top: @at-margin-panel; button:last-child { - margin-left: @at-space-5x; + margin-left: @at-margin-panel-inset; } } diff --git a/awx/ui/client/lib/components/form/action.directive.js b/awx/ui/client/lib/components/form/action.directive.js index 883e94cb89..90dbf561ef 100644 --- a/awx/ui/client/lib/components/form/action.directive.js +++ b/awx/ui/client/lib/components/form/action.directive.js @@ -38,14 +38,14 @@ function atFormActionController ($state) { vm.setCancelDefaults = () => { scope.text = 'CANCEL'; scope.fill = 'Hollow'; - scope.color = 'white'; + scope.color = 'default'; scope.action = () => $state.go('^'); }; vm.setSaveDefaults = () => { scope.text = 'SAVE'; scope.fill = ''; - scope.color = 'green'; + scope.color = 'success'; scope.action = () => form.submit(); }; } diff --git a/awx/ui/client/lib/components/input/_index.less b/awx/ui/client/lib/components/input/_index.less index bc04b24246..166e7018db 100644 --- a/awx/ui/client/lib/components/input/_index.less +++ b/awx/ui/client/lib/components/input/_index.less @@ -1,17 +1,17 @@ .at-Input { - .at-mixin-Placeholder(@at-gray-dark-3x); + .at-mixin-Placeholder(@at-color-input-placeholder); - height: @at-input-height; - background: @at-white; + height: @at-height-input; + background: @at-color-input-background; border-radius: @at-border-radius; - color: @at-gray-dark-5x; + color: @at-color-input-text; &, &:active { - border-color: @at-gray-dark-2x; + border-color: @at-color-input-border; } &:focus { - border-color: @at-blue; + border-color: @at-color-input-focus; } } @@ -21,43 +21,43 @@ & > label { & > input[type=checkbox] { - height: @at-input-height; + height: @at-height-input; margin: 0; padding: 0; } & > p { margin: 0; - padding: 0 0 0 @at-space-6x; + padding: 0 0 0 @at-padding-panel; line-height: @at-line-height-tall; } } } .at-InputContainer { - margin-top: @at-space-6x; + margin-top: @at-margin-panel; } .at-Input-button { - min-width: @at-input-button-width; display: block; - height: @at-input-height; + height: @at-height-button; + line-height: 1; &, &:active, &:hover, &:focus { - color: @at-gray-dark-3x; - border-color: @at-gray-dark-2x; - background-color: @at-white; + color: @at-color-button-text-default; + border-color: @at-color-input-border; + background-color: @at-color-default; cursor: pointer; } } .at-Input--focus { - border-color: @at-blue; + border-color: @at-color-input-focus; } .at-Input--rejected { &, &:focus { - border-color: @at-red; + border-color: @at-color-input-error; } } @@ -66,7 +66,6 @@ height: 100%; width: 100%; left: 0; - right: @at-input-button-width; z-index: -2; opacity: 0; } @@ -77,15 +76,15 @@ .at-InputGroup { padding: 0; - margin: @at-space-6x 0 0 0; + margin: @at-margin-panel 0 0 0; } .at-InputGroup-border { position: absolute; - width: @at-inset-width; + width: 5px; height: 100%; - background: @at-gray-dark; - left: -@at-inset-width; + background: @at-color-panel-border; + left: -5px; } .at-InputGroup-button { @@ -93,19 +92,21 @@ & > button { height: 100%; + border-right: none; + color: @at-color-button-text-default; } } .at-InputGroup-title { - .at-mixin-Heading(@at-font-size-2x); - margin: 0 0 0 @at-space-5x; + .at-mixin-Heading(@at-font-size-panel-inset-heading); + margin: 0 0 0 @at-margin-panel-inset; } .at-InputGroup-divider { clear: both; margin: 0; padding: 0; - height: @at-space-6x; + height: @at-height-divider; } .at-InputLabel { @@ -114,17 +115,17 @@ } .at-InputLabel-name { - color: @at-gray-dark-4x; - font-size: @at-font-size-2x; - font-weight: @at-font-weight; + color: @at-color-form-label; + font-size: @at-font-size-form-label; + font-weight: @at-font-weight-body; text-transform: uppercase; } .at-InputLabel-hint { - margin-left: @at-space-4x; - color: @at-gray-dark-3x; - font-size: @at-font-size; - font-weight: @at-font-weight; + margin-left: @at-margin-form-label-hint; + color: @at-color-input-hint; + font-size: @at-font-size-help-text; + font-weight: @at-font-weight-body; line-height: @at-line-height-short; } @@ -137,15 +138,15 @@ margin-bottom: 0; & > input[type=checkbox] { - margin: 0 @at-space 0 0; + margin: 0 3px 0 0; position: relative; - top: @at-space; + top: 3px } & > p { - font-size: @at-font-size; - color: @at-gray-dark-4x; - font-weight: @at-font-weight; + font-size: @at-font-size-help-text; + color: @at-color-form-label; + font-weight: @at-font-weight-body; display: inline; margin: 0; padding: 0; @@ -153,16 +154,16 @@ } .at-InputMessage--rejected { - font-size: @at-font-size; - color: @at-red; - margin: @at-space-3x 0 0 0; + font-size: @at-font-size-help-text; + color: @at-color-error; + margin: @at-margin-input-message 0 0 0; padding: 0; } .at-InputLabel-required { - color: @at-red; - font-weight: @at-font-weight-2x; - font-size: @at-font-size-2x; + color: @at-color-error; + font-weight: @at-font-weight-heading; + font-size: @at-font-size-form-label; margin: 0; } @@ -171,13 +172,13 @@ width: 100%; & > i { - font-size: @at-font-size; + font-size: @at-font-size-button; position: absolute; z-index: 3; pointer-events: none; - top: @at-space-4x; - right: @at-space-4x; - color: @at-gray-dark-2x; + top: @at-height-input / 3; + right: @at-height-input / 3; + color: @at-color-icon; } } @@ -188,7 +189,7 @@ } .at-InputSelect-select { - height: @at-input-height; + height: @at-height-input; cursor: pointer; position: absolute; z-index: 1; diff --git a/awx/ui/client/lib/components/input/group.directive.js b/awx/ui/client/lib/components/input/group.directive.js index 5ffb8029b1..550cd1c0ef 100644 --- a/awx/ui/client/lib/components/input/group.directive.js +++ b/awx/ui/client/lib/components/input/group.directive.js @@ -49,7 +49,6 @@ function AtInputGroupController ($scope, $compile) { vm.insert(group); state._group = group; - vm.compile(group); }; vm.createComponentConfigs = inputs => { @@ -138,20 +137,22 @@ function AtInputGroupController ($scope, $compile) { vm.createComponent = (input, index) => { let tabindex = Number(scope.tab) + index; let col = input._expand ? 12 : scope.col; - - return angular.element( + let component = angular.element( `<${input._component} col="${col}" tab="${tabindex}" state="${state._reference}._group[${index}]"> ` ); + + $compile(component)(scope.$parent) + + return component; }; vm.createDivider = () => { - return angular.element(''); - }; + let divider = angular.element(''); + $compile(divider[0])(scope.$parent); - vm.compile = group => { - group.forEach(component => $compile(component._element[0])(scope.$parent)); + return divider; }; vm.clear = () => { diff --git a/awx/ui/client/lib/components/input/lookup.partial.html b/awx/ui/client/lib/components/input/lookup.partial.html index d5f0ca89b7..05239176ca 100644 --- a/awx/ui/client/lib/components/input/lookup.partial.html +++ b/awx/ui/client/lib/components/input/lookup.partial.html @@ -4,7 +4,7 @@
-
- + diff --git a/awx/ui/client/lib/components/index.js b/awx/ui/client/lib/components/index.js index 3f24c7376b..a227872c69 100644 --- a/awx/ui/client/lib/components/index.js +++ b/awx/ui/client/lib/components/index.js @@ -10,6 +10,7 @@ import inputMessage from './input/message.directive'; import inputNumber from './input/number.directive'; import inputSelect from './input/select.directive'; import inputSecret from './input/secret.directive'; +import inputSearch from './input/search.directive'; import inputText from './input/text.directive'; import inputTextarea from './input/textarea.directive'; import inputTextareaSecret from './input/textarea-secret.directive'; @@ -20,6 +21,7 @@ import panelBody from './panel/body.directive'; import popover from './popover/popover.directive'; import tab from './tabs/tab.directive'; import tabGroup from './tabs/group.directive'; +import table from './table/table.directive'; import BaseInputController from './input/base.controller'; @@ -37,6 +39,7 @@ angular .directive('atInputNumber', inputNumber) .directive('atInputSecret', inputSecret) .directive('atInputSelect', inputSelect) + .directive('atInputSearch', inputSearch) .directive('atInputText', inputText) .directive('atInputTextarea', inputTextarea) .directive('atInputTextareaSecret', inputTextareaSecret) @@ -47,6 +50,7 @@ angular .directive('atPopover', popover) .directive('atTab', tab) .directive('atTabGroup', tabGroup) + .directive('atTable', table) .service('BaseInputController', BaseInputController); diff --git a/awx/ui/client/lib/components/input/_index.less b/awx/ui/client/lib/components/input/_index.less index 166e7018db..9d52ea1c03 100644 --- a/awx/ui/client/lib/components/input/_index.less +++ b/awx/ui/client/lib/components/input/_index.less @@ -13,6 +13,10 @@ &:focus { border-color: @at-color-input-focus; } + + &[disabled] { + background: @at-color-input-disabled; + } } .at-InputCheckbox { @@ -94,6 +98,7 @@ height: 100%; border-right: none; color: @at-color-button-text-default; + min-width: @at-input-button-width; } } @@ -167,6 +172,42 @@ margin: 0; } +.at-InputSearch-group--left { + padding-right: @at-margin-item-column; +} + +.at-InputSearch-group--right { + padding-left: 0; +} + +.at-InputSearch-well { + margin: @at-margin-top-search-key 0 0 0; + padding: @at-padding-well; +} + +.at-InputSearch-well { + margin: @at-margin-top-search-key 0 0 0; + padding: @at-padding-well; +} + +.at-InputSearch-toggle { + width: 100%; + + &, &:focus, &:visited, &:active { + background: @at-color-default; + cursor: pointer; + } +} + +.at-InputSearch-toggle--active { + &, &:hover, &:focus, &:visited, &:active { + border: @at-color-search-key-active; + background: @at-color-search-key-active; + color: @at-color-default; + cursor: pointer; + } +} + .at-InputSelect { position: relative; width: 100%; @@ -178,7 +219,7 @@ pointer-events: none; top: @at-height-input / 3; right: @at-height-input / 3; - color: @at-color-icon; + color: @at-color-input-icon; } } diff --git a/awx/ui/client/lib/components/input/lookup.directive.js b/awx/ui/client/lib/components/input/lookup.directive.js index 950edeca39..801e4b55e8 100644 --- a/awx/ui/client/lib/components/input/lookup.directive.js +++ b/awx/ui/client/lib/components/input/lookup.directive.js @@ -2,6 +2,13 @@ function atInputLookupLink (scope, element, attrs, controllers) { let formController = controllers[0]; let inputController = controllers[1]; + scope.ns = 'lookup'; + scope[scope.ns] = { + modal: {}, + search: {}, + table: {} + }; + if (scope.tab === '1') { element.find('input')[0].focus(); } @@ -12,36 +19,25 @@ function atInputLookupLink (scope, element, attrs, controllers) { function AtInputLookupController (baseInputController) { let vm = this || {}; - vm.lookup = {}; + let scope; + let modal; + let search; + let table; - vm.init = (scope, element, form) => { - baseInputController.call(vm, 'input', scope, element, form); + vm.init = (_scope_, element, form) => { + baseInputController.call(vm, 'input', _scope_, element, form); - vm.lookup.modal = { - title: 'Select Organization', - buttons: [ - { - type: 'cancel' - }, - { - type: 'select' - } - ] - }; + scope = _scope_; - vm.lookup.search = { - placeholder: 'test' - }; - - vm.lookup.table = { - - }; + modal = scope.lookup.modal; + search = scope.lookup.search; + table = scope.lookup.table; vm.check(); }; vm.search = () => { - vm.modal.show('test'); + modal.show(`Select ${scope.state.label}`); }; } diff --git a/awx/ui/client/lib/components/input/lookup.partial.html b/awx/ui/client/lib/components/input/lookup.partial.html index 05239176ca..dc168d9d77 100644 --- a/awx/ui/client/lib/components/input/lookup.partial.html +++ b/awx/ui/client/lib/components/input/lookup.partial.html @@ -23,8 +23,8 @@ - - - + + + diff --git a/awx/ui/client/lib/components/input/search.directive.js b/awx/ui/client/lib/components/input/search.directive.js new file mode 100644 index 0000000000..d75d49e39e --- /dev/null +++ b/awx/ui/client/lib/components/input/search.directive.js @@ -0,0 +1,54 @@ +const DEFAULT_PLACEHOLDER = 'SEARCH'; + +function atInputSearchLink (scope, element, attrs, controllers) { + let inputController = controllers[0]; + let property = `scope.${scope.ns}.search`; + + let done = scope.$watch(property, () => { + inputController.init(scope, element); + done(); + }); +} + +function AtInputSearchController (baseInputController) { + let vm = this || {}; + + let toggleButton; + let input; + + vm.init = (scope, element) => { + toggleButton = element.find('.at-InputSearch-toggle')[0]; + input = element.find('.at-Input')[0]; + + vm.placeholder = DEFAULT_PLACEHOLDER; + vm.search = scope[scope.ns].search; + // baseInputController.call(vm, 'input', scope, element, form); + + //vm.check(); + }; + + vm.toggle = () => { + input.focus(); + vm.isToggleActive = !vm.isToggleActive; + }; +} + +AtInputSearchController.$inject = ['BaseInputController']; + +function atInputSearch (pathService) { + return { + restrict: 'E', + transclude: true, + replace: true, + require: ['atInputSearch'], + templateUrl: pathService.getPartialPath('components/input/search'), + controller: AtInputSearchController, + controllerAs: 'vm', + link: atInputSearchLink, + scope: true + }; +} + +atInputSearch.$inject = ['PathService']; + +export default atInputSearch; diff --git a/awx/ui/client/lib/components/input/search.partial.html b/awx/ui/client/lib/components/input/search.partial.html new file mode 100644 index 0000000000..d95b75adb3 --- /dev/null +++ b/awx/ui/client/lib/components/input/search.partial.html @@ -0,0 +1,31 @@ +
+
+
+
+
+ + + + +
+
+
+
+ +
+
+
+
+
+

Some info here

+
+
+
+
diff --git a/awx/ui/client/lib/components/modal/_index.less b/awx/ui/client/lib/components/modal/_index.less index 11e962e98b..ba5ac620ec 100644 --- a/awx/ui/client/lib/components/modal/_index.less +++ b/awx/ui/client/lib/components/modal/_index.less @@ -1,10 +1,28 @@ +.at-Modal-body { + font-size: @at-font-size; + padding: 0; +} + +.at-Modal-dismiss { + .at-mixin-ButtonIcon(); + font-size: @at-font-size-modal-dismiss; + color: @at-color-icon-dismiss; + text-align: right; +} + +.at-Modal-heading { + margin: 0; + overflow: visible; + + & > .at-Modal-dismiss { + margin: 0; + } +} + .at-Modal-title { margin: 0; padding: 0; - .at-mixin-Heading(@at-font-size-3x); + .at-mixin-Heading(@at-font-size-modal-heading); } -.at-Modal-body { - font-size: @at-font-size; -} diff --git a/awx/ui/client/lib/components/modal/modal.directive.js b/awx/ui/client/lib/components/modal/modal.directive.js index 10f18a0afc..b5072affa6 100644 --- a/awx/ui/client/lib/components/modal/modal.directive.js +++ b/awx/ui/client/lib/components/modal/modal.directive.js @@ -1,29 +1,39 @@ const DEFAULT_ANIMATION_DURATION = 150; -function atModalLink (scope, el, attr, controllers) { +function atModalLink (scope, el, attrs, controllers) { let modalController = controllers[0]; let container = el[0]; + let property = `scope.${scope.ns}.modal`; - modalController.init(scope, container); + let done = scope.$watch(property, () => { + modalController.init(scope, container); + done(); + }); } -function AtModalController () { +function AtModalController (eventService) { let vm = this; - let scope; let container; + let listeners; - vm.init = (_scope_, _container_) => { - scope = _scope_; + vm.init = (scope, _container_) => { container = _container_; - scope.state.show = vm.show; - scope.state.hide = vm.hide; + vm.modal = scope[scope.ns].modal; + vm.modal.show = vm.show; + vm.modal.hide = vm.hide; }; vm.show = (title, message) => { - scope.title = title; - scope.message = message; + vm.modal.title = title; + vm.modal.message = message; + + event.stopPropagation(); + + listeners = eventService.addListeners([ + [window, 'click', vm.clickToHide] + ]); container.style.display = 'block'; container.style.opacity = 1; @@ -32,14 +42,34 @@ function AtModalController () { vm.hide = () => { container.style.opacity = 0; + eventService.remove(listeners); + setTimeout(() => { container.style.display = 'none'; - scope.message = ''; - scope.title = ''; + vm.modal.message = ''; + vm.modal.title = ''; }, DEFAULT_ANIMATION_DURATION); }; + + vm.clickToHide = event => { + if (vm.clickIsOutsideContainer(event)) { + console.log('outside'); + } else { + console.log('inside'); + } + }; + + vm.clickIsOutsideContainer = e => { + let pos = container.getBoundingClientRect(); + let ex = e.clientX; + let ey = e.clientY; + + console.log(e, pos); + }; } +AtModalController.$inject = ['EventService']; + function atModal (pathService) { return { restrict: 'E', @@ -50,9 +80,7 @@ function atModal (pathService) { controller: AtModalController, controllerAs: 'vm', link: atModalLink, - scope: { - state: '=' - } + scope: true }; } diff --git a/awx/ui/client/lib/components/modal/modal.partial.html b/awx/ui/client/lib/components/modal/modal.partial.html index 9d96d1ff2a..1547b1d857 100644 --- a/awx/ui/client/lib/components/modal/modal.partial.html +++ b/awx/ui/client/lib/components/modal/modal.partial.html @@ -1,20 +1,31 @@