Merge pull request #6715 from mabashian/remove-clearscope

Removed ClearScope service in favor of logic in stateChangeStart
This commit is contained in:
Michael Abashian
2017-06-27 10:07:40 -04:00
committed by GitHub
31 changed files with 81 additions and 155 deletions

View File

@@ -203,12 +203,12 @@ var tower = angular.module('Tower', [
]) ])
.run(['$stateExtender', '$q', '$compile', '$cookies', '$rootScope', '$log', '$stateParams', .run(['$stateExtender', '$q', '$compile', '$cookies', '$rootScope', '$log', '$stateParams',
'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer',
'ClearScope', 'LoadConfig', 'Store', 'pendoService', 'Prompt', 'Rest', 'LoadConfig', 'Store', 'pendoService', 'Prompt', 'Rest',
'Wait', 'ProcessErrors', '$state', 'GetBasePath', 'ConfigService', 'Wait', 'ProcessErrors', '$state', 'GetBasePath', 'ConfigService',
'FeaturesService', '$filter', 'SocketService', 'FeaturesService', '$filter', 'SocketService',
function($stateExtender, $q, $compile, $cookies, $rootScope, $log, $stateParams, function($stateExtender, $q, $compile, $cookies, $rootScope, $log, $stateParams,
CheckLicense, $location, Authorization, LoadBasePaths, Timer, CheckLicense, $location, Authorization, LoadBasePaths, Timer,
ClearScope, LoadConfig, Store, pendoService, Prompt, Rest, Wait, LoadConfig, Store, pendoService, Prompt, Rest, Wait,
ProcessErrors, $state, GetBasePath, ConfigService, FeaturesService, ProcessErrors, $state, GetBasePath, ConfigService, FeaturesService,
$filter, SocketService) { $filter, SocketService) {
@@ -305,6 +305,28 @@ var tower = angular.module('Tower', [
window.clearInterval($rootScope.jobStdOutInterval); 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 // On each navigation request, check that the user is logged in
if (!/^\/(login|logout)/.test($location.path())) { if (!/^\/(login|logout)/.test($location.path())) {
// capture most recent URL, excluding login/logout // capture most recent URL, excluding login/logout

View File

@@ -5,7 +5,7 @@
*************************************************/ *************************************************/
export default [ 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', 'ConfigurationService', 'ConfigurationUtils', 'CreateDialog', 'CreateSelect2', 'i18n', 'ParseTypeChange', 'ProcessErrors', 'Store',
'Wait', 'configDataResolve', 'ToJSON', 'Wait', 'configDataResolve', 'ToJSON',
//Form definitions //Form definitions
@@ -24,7 +24,7 @@ export default [
'ConfigurationJobsForm', 'ConfigurationJobsForm',
'ConfigurationUiForm', 'ConfigurationUiForm',
function( function(
$scope, $rootScope, $state, $stateParams, $timeout, $q, Alert, ClearScope, $scope, $rootScope, $state, $stateParams, $timeout, $q, Alert,
ConfigurationService, ConfigurationUtils, CreateDialog, CreateSelect2, i18n, ParseTypeChange, ProcessErrors, Store, ConfigurationService, ConfigurationUtils, CreateDialog, CreateSelect2, i18n, ParseTypeChange, ProcessErrors, Store,
Wait, configDataResolve, ToJSON, Wait, configDataResolve, ToJSON,
//Form definitions //Form definitions

View File

@@ -4,14 +4,12 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ClearScope', export default ['$scope', 'Rest', 'CredentialList', 'Prompt',
'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'i18n', '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, ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset,
i18n) { i18n) {
ClearScope();
var list = CredentialList, var list = CredentialList,
defaultUrl = GetBasePath('credentials'); defaultUrl = GetBasePath('credentials');

View File

@@ -5,11 +5,9 @@
*************************************************/ *************************************************/
export default ['$scope', '$rootScope','Wait', export default ['$scope', '$rootScope','Wait',
'ClearScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'graphData', 'Rest', 'GetBasePath', 'ProcessErrors', 'graphData',
function($scope, $rootScope, Wait, function($scope, $rootScope, Wait,
ClearScope, Rest, GetBasePath, ProcessErrors, graphData) { Rest, GetBasePath, ProcessErrors, graphData) {
ClearScope('home');
var dataCount = 0; var dataCount = 0;

View File

@@ -11,11 +11,9 @@
*/ */
function adhocController($q, $scope, $stateParams, function adhocController($q, $scope, $stateParams,
$state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm, $state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm,
GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices, GenerateForm, Rest, ProcessErrors, GetBasePath, GetChoices,
KindChange, Wait, ParseTypeChange) { KindChange, Wait, ParseTypeChange) {
ClearScope();
// this is done so that we can access private functions for testing, but // 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 // we don't want to populate the "public" scope with these internal
// functions // functions
@@ -302,6 +300,6 @@ function adhocController($q, $scope, $stateParams,
export default ['$q', '$scope', '$stateParams', export default ['$q', '$scope', '$stateParams',
'$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2', '$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2',
'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'GetBasePath',
'GetChoices', 'KindChange', 'Wait', 'ParseTypeChange', 'GetChoices', 'KindChange', 'Wait', 'ParseTypeChange',
adhocController]; adhocController];

View File

@@ -12,13 +12,11 @@
function SmartInventoryAdd($scope, $location, function SmartInventoryAdd($scope, $location,
GenerateForm, smartInventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors, GenerateForm, smartInventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors,
ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, GetBasePath, ParseTypeChange, Wait, ToJSON,
$state, canAdd) { $state, canAdd) {
$scope.canAdd = canAdd; $scope.canAdd = canAdd;
ClearScope();
// Inject dynamic view // Inject dynamic view
var defaultUrl = GetBasePath('inventory'), var defaultUrl = GetBasePath('inventory'),
form = smartInventoryForm; form = smartInventoryForm;
@@ -90,6 +88,6 @@ function SmartInventoryAdd($scope, $location,
export default ['$scope', '$location', export default ['$scope', '$location',
'GenerateForm', 'smartInventoryForm', 'rbacUiControlService', 'Rest', 'Alert', 'GenerateForm', 'smartInventoryForm', 'rbacUiControlService', 'Rest', 'Alert',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', 'ProcessErrors', 'GetBasePath', 'ParseTypeChange',
'Wait', 'ToJSON', '$state', 'canAdd', SmartInventoryAdd 'Wait', 'ToJSON', '$state', 'canAdd', SmartInventoryAdd
]; ];

View File

@@ -6,7 +6,7 @@
function SmartInventoryEdit($scope, $location, function SmartInventoryEdit($scope, $location,
$stateParams, InventoryForm, Rest, ProcessErrors, $stateParams, InventoryForm, Rest, ProcessErrors,
ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, GetBasePath, ParseTypeChange, Wait, ToJSON,
ParseVariableString, $state, OrgAdminLookup, resourceData, $rootScope) { ParseVariableString, $state, OrgAdminLookup, resourceData, $rootScope) {
// Inject dynamic view // Inject dynamic view
@@ -14,12 +14,9 @@ function SmartInventoryEdit($scope, $location,
form = InventoryForm, form = InventoryForm,
inventory_id = $stateParams.smartinventory_id, inventory_id = $stateParams.smartinventory_id,
inventoryData = resourceData.data; inventoryData = resourceData.data;
ClearScope();
init(); init();
function init() { function init() {
ClearScope();
form.formLabelSize = null; form.formLabelSize = null;
form.formFieldSize = null; form.formFieldSize = null;
$scope.inventory_id = inventory_id; $scope.inventory_id = inventory_id;
@@ -97,7 +94,7 @@ function SmartInventoryEdit($scope, $location,
export default [ '$scope', '$location', export default [ '$scope', '$location',
'$stateParams', 'InventoryForm', 'Rest', '$stateParams', 'InventoryForm', 'Rest',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
'ToJSON', 'ParseVariableString', 'ToJSON', 'ParseVariableString',
'$state', 'OrgAdminLookup', 'resourceData', '$rootScope', SmartInventoryEdit '$state', 'OrgAdminLookup', 'resourceData', '$rootScope', SmartInventoryEdit
]; ];

View File

@@ -12,13 +12,11 @@
function InventoriesAdd($scope, $location, function InventoriesAdd($scope, $location,
GenerateForm, InventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors, GenerateForm, InventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors,
ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, GetBasePath, ParseTypeChange, Wait, ToJSON,
$state, canAdd, CreateSelect2, InstanceGroupsService) { $state, canAdd, CreateSelect2, InstanceGroupsService) {
$scope.canAdd = canAdd; $scope.canAdd = canAdd;
ClearScope();
// Inject dynamic view // Inject dynamic view
var defaultUrl = GetBasePath('inventory'), var defaultUrl = GetBasePath('inventory'),
form = InventoryForm; form = InventoryForm;
@@ -96,6 +94,6 @@ function InventoriesAdd($scope, $location,
export default ['$scope', '$location', export default ['$scope', '$location',
'GenerateForm', 'InventoryForm', 'rbacUiControlService', 'Rest', 'Alert', 'GenerateForm', 'InventoryForm', 'rbacUiControlService', 'Rest', 'Alert',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', 'ProcessErrors', 'GetBasePath', 'ParseTypeChange',
'Wait', 'ToJSON', '$state','canAdd', 'CreateSelect2', 'InstanceGroupsService', InventoriesAdd 'Wait', 'ToJSON', '$state','canAdd', 'CreateSelect2', 'InstanceGroupsService', InventoriesAdd
]; ];

View File

@@ -12,7 +12,7 @@
function InventoriesEdit($scope, $location, function InventoriesEdit($scope, $location,
$stateParams, InventoryForm, Rest, ProcessErrors, $stateParams, InventoryForm, Rest, ProcessErrors,
ClearScope, GetBasePath, ParseTypeChange, Wait, ToJSON, GetBasePath, ParseTypeChange, Wait, ToJSON,
ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData, CreateSelect2, InstanceGroupsService, InstanceGroupsData) { ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData, CreateSelect2, InstanceGroupsService, InstanceGroupsData) {
// Inject dynamic view // Inject dynamic view
@@ -111,7 +111,7 @@ function InventoriesEdit($scope, $location,
export default ['$scope', '$location', export default ['$scope', '$location',
'$stateParams', 'InventoryForm', 'Rest', '$stateParams', 'InventoryForm', 'Rest',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
'ToJSON', 'ParseVariableString', 'ToJSON', 'ParseVariableString',
'$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', InventoriesEdit, '$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', InventoriesEdit,
]; ];

View File

@@ -11,14 +11,12 @@
*/ */
export default ['$state', '$rootScope', '$scope', '$stateParams', export default ['$state', '$rootScope', '$scope', '$stateParams',
'ClearScope', 'Find', 'DeleteJob', 'RelaunchJob', 'Find', 'DeleteJob', 'RelaunchJob',
'GetBasePath', 'Dataset', 'QuerySet', 'ListDefinition', '$interpolate', 'GetBasePath', 'Dataset', 'QuerySet', 'ListDefinition', '$interpolate',
function($state, $rootScope, $scope, $stateParams, function($state, $rootScope, $scope, $stateParams,
ClearScope, Find, DeleteJob, RelaunchJob, Find, DeleteJob, RelaunchJob,
GetBasePath, Dataset, qs, ListDefinition, $interpolate) { GetBasePath, Dataset, qs, ListDefinition, $interpolate) {
ClearScope();
var list = ListDefinition; var list = ListDefinition;
init(); init();

View File

@@ -8,9 +8,8 @@ import authenticationController from './loginModal.controller';
/* jshint unused: vars */ /* jshint unused: vars */
export default export default
[ 'templateUrl', [ 'templateUrl',
'ClearScope',
'Wait', 'Wait',
function(templateUrl, ClearScope, Wait) { function(templateUrl, Wait) {
return { return {
restrict: 'E', restrict: 'E',
scope: true, scope: true,
@@ -19,7 +18,6 @@ export default
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
var setLoginFocus = function () { var setLoginFocus = function () {
// Need to clear out any open dialog windows that might be open when this modal opens. // Need to clear out any open dialog windows that might be open when this modal opens.
ClearScope();
$('#login-username').focus(); $('#login-username').focus();
}; };

View File

@@ -6,9 +6,9 @@
export default ['$scope', '$rootScope', '$location', '$stateParams', export default ['$scope', '$rootScope', '$location', '$stateParams',
'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', 'CreateSelect2', '$state','InstanceGroupsService', 'ProcessErrors', 'GetBasePath', 'Wait', 'CreateSelect2', '$state','InstanceGroupsService',
function($scope, $rootScope, $location, $stateParams, OrganizationForm, 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.setUrl(GetBasePath('organizations'));
Rest.options() Rest.options()
@@ -19,8 +19,6 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
} }
}); });
ClearScope();
var form = OrganizationForm(), var form = OrganizationForm(),
base = $location.path().replace(/^\//, '').split('/')[0]; base = $location.path().replace(/^\//, '').split('/')[0];
init(); init();

View File

@@ -5,14 +5,12 @@
*************************************************/ *************************************************/
export default ['$scope', '$location', '$stateParams', export default ['$scope', '$location', '$stateParams',
'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt', 'ClearScope', 'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt',
'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', 'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData',
function($scope, $location, $stateParams, function($scope, $location, $stateParams,
OrganizationForm, Rest, ProcessErrors, Prompt, ClearScope, OrganizationForm, Rest, ProcessErrors, Prompt,
GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData) { GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData) {
ClearScope();
let form = OrganizationForm(), let form = OrganizationForm(),
defaultUrl = GetBasePath('organizations'), defaultUrl = GetBasePath('organizations'),
base = $location.path().replace(/^\//, '').split('/')[0], base = $location.path().replace(/^\//, '').split('/')[0],

View File

@@ -6,14 +6,12 @@
export default ['$stateParams', '$scope', '$rootScope', export default ['$stateParams', '$scope', '$rootScope',
'Rest', 'OrganizationList', 'Prompt', 'ClearScope', 'Rest', 'OrganizationList', 'Prompt',
'ProcessErrors', 'GetBasePath', 'Wait', '$state', 'rbacUiControlService', '$filter', 'Dataset', 'i18n', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', 'rbacUiControlService', '$filter', 'Dataset', 'i18n',
function($stateParams, $scope, $rootScope, function($stateParams, $scope, $rootScope,
Rest, OrganizationList, Prompt, ClearScope, Rest, OrganizationList, Prompt,
ProcessErrors, GetBasePath, Wait, $state, rbacUiControlService, $filter, Dataset, i18n) { ProcessErrors, GetBasePath, Wait, $state, rbacUiControlService, $filter, Dataset, i18n) {
ClearScope();
var defaultUrl = GetBasePath('organizations'), var defaultUrl = GetBasePath('organizations'),
list = OrganizationList; list = OrganizationList;

View File

@@ -5,17 +5,15 @@
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt', 'ClearScope', 'Alert', 'ProcessErrors', 'GenerateForm', 'Prompt',
'GetBasePath', 'GetProjectPath', 'Authorization', 'GetChoices', 'Empty', 'GetBasePath', 'GetProjectPath', 'Authorization', 'GetChoices', 'Empty',
'Wait', 'ProjectUpdate', '$state', 'CreateSelect2', 'ToggleNotification', 'Wait', 'ProjectUpdate', '$state', 'CreateSelect2', 'ToggleNotification',
'i18n', 'CredentialTypes', 'i18n', 'CredentialTypes',
function($scope, $rootScope, $stateParams, ProjectsForm, Rest, Alert, function($scope, $rootScope, $stateParams, ProjectsForm, Rest, Alert,
ProcessErrors, GenerateForm, Prompt, ClearScope, GetBasePath, ProcessErrors, GenerateForm, Prompt, GetBasePath,
GetProjectPath, Authorization, GetChoices, Empty, Wait, ProjectUpdate, GetProjectPath, Authorization, GetChoices, Empty, Wait, ProjectUpdate,
$state, CreateSelect2, ToggleNotification, i18n, CredentialTypes) { $state, CreateSelect2, ToggleNotification, i18n, CredentialTypes) {
ClearScope('htmlTemplate');
var form = ProjectsForm(), var form = ProjectsForm(),
defaultUrl = GetBasePath('projects') + $stateParams.project_id + '/', defaultUrl = GetBasePath('projects') + $stateParams.project_id + '/',
master = {}, master = {},

View File

@@ -13,16 +13,14 @@
export default [ export default [
'$scope', '$location', '$stateParams', 'ScheduleList', 'Rest', '$scope', '$location', '$stateParams', 'ScheduleList', 'Rest',
'ClearScope', 'rbacUiControlService', 'rbacUiControlService',
'ToggleSchedule', 'DeleteSchedule', '$q', '$state', 'Dataset', 'ParentObject', 'UnifiedJobsOptions', 'ToggleSchedule', 'DeleteSchedule', '$q', '$state', 'Dataset', 'ParentObject', 'UnifiedJobsOptions',
function($scope, $location, $stateParams, function($scope, $location, $stateParams,
ScheduleList, Rest, ClearScope, ScheduleList, Rest,
rbacUiControlService, rbacUiControlService,
ToggleSchedule, DeleteSchedule, ToggleSchedule, DeleteSchedule,
$q, $state, Dataset, ParentObject, UnifiedJobsOptions) { $q, $state, Dataset, ParentObject, UnifiedJobsOptions) {
ClearScope();
var base, scheduleEndpoint, var base, scheduleEndpoint,
list = ScheduleList; list = ScheduleList;

View File

@@ -20,43 +20,6 @@
export default export default
angular.module('Utilities', ['RestServices', 'Utilities']) 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 * @ngdoc method
* @name shared.function:Utilities#Empty * @name shared.function:Utilities#Empty

View File

@@ -11,11 +11,9 @@
*/ */
export function JobStdoutController ($rootScope, $scope, $state, $stateParams, 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) { ParseTypeChange, ParseVariableString, RelaunchJob, DeleteJob, Wait, i18n) {
ClearScope();
var job_id = $stateParams.id, var job_id = $stateParams.id,
jobType = $state.current.data.jobType; jobType = $state.current.data.jobType;
@@ -279,6 +277,6 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
} }
JobStdoutController.$inject = [ '$rootScope', '$scope', '$state', JobStdoutController.$inject = [ '$rootScope', '$scope', '$state',
'$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors', '$stateParams', 'GetBasePath', 'Rest', 'ProcessErrors',
'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange', 'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange',
'ParseVariableString', 'RelaunchJob', 'DeleteJob', 'Wait', 'i18n']; 'ParseVariableString', 'RelaunchJob', 'DeleteJob', 'Wait', 'i18n'];

View File

@@ -5,12 +5,9 @@
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', 'TeamForm', 'GenerateForm', 'Rest', 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, function($scope, $rootScope, TeamForm, GenerateForm, Rest, Alert,
ProcessErrors, ClearScope, GetBasePath, Wait, $state) { ProcessErrors, GetBasePath, Wait, $state) {
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//$scope.
Rest.setUrl(GetBasePath('teams')); Rest.setUrl(GetBasePath('teams'));
Rest.options() Rest.options()

View File

@@ -5,10 +5,9 @@
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest', export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', '$state', 'ProcessErrors', 'GetBasePath', 'Wait', '$state',
function($scope, $rootScope, $stateParams, TeamForm, Rest, ProcessErrors, function($scope, $rootScope, $stateParams, TeamForm, Rest, ProcessErrors,
ClearScope, GetBasePath, Wait, $state) { GetBasePath, Wait, $state) {
ClearScope();
var form = TeamForm, var form = TeamForm,
id = $stateParams.team_id, id = $stateParams.team_id,

View File

@@ -4,14 +4,12 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', 'Rest', 'TeamList', 'Prompt', 'ClearScope', export default ['$scope', 'Rest', 'TeamList', 'Prompt',
'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter',
'rbacUiControlService', 'Dataset', 'rbacUiControlService', 'Dataset',
function($scope, Rest, TeamList, Prompt, ClearScope, ProcessErrors, function($scope, Rest, TeamList, Prompt, ProcessErrors,
GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset) { GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset) {
ClearScope();
var list = TeamList, var list = TeamList,
defaultUrl = GetBasePath('teams'); defaultUrl = GetBasePath('teams');

View File

@@ -7,13 +7,13 @@
export default export default
[ '$filter', '$scope', [ '$filter', '$scope',
'$stateParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert', '$stateParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait', 'ProcessErrors', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'Wait',
'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state', 'Empty', 'ToJSON', 'CallbackHelpInit', 'GetChoices', '$state',
'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService', 'MultiCredentialService', 'CreateSelect2', '$q', 'i18n', 'Inventory', 'Project', 'InstanceGroupsService', 'MultiCredentialService',
function( function(
$filter, $scope, $filter, $scope,
$stateParams, JobTemplateForm, GenerateForm, Rest, Alert, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
ProcessErrors, ClearScope, GetBasePath, md5Setup, ParseTypeChange, Wait, ProcessErrors, GetBasePath, md5Setup, ParseTypeChange, Wait,
Empty, ToJSON, CallbackHelpInit, GetChoices, Empty, ToJSON, CallbackHelpInit, GetChoices,
$state, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService, MultiCredentialService $state, CreateSelect2, $q, i18n, Inventory, Project, InstanceGroupsService, MultiCredentialService
) { ) {
@@ -27,7 +27,6 @@
} }
}); });
ClearScope();
// Inject dynamic view // Inject dynamic view
let defaultUrl = GetBasePath('job_templates'), let defaultUrl = GetBasePath('job_templates'),
form = JobTemplateForm(), form = JobTemplateForm(),

View File

@@ -13,7 +13,7 @@
export default export default
[ '$filter', '$scope', '$rootScope', [ '$filter', '$scope', '$rootScope',
'$location', '$stateParams', 'JobTemplateForm', 'GenerateForm', '$location', '$stateParams', 'JobTemplateForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'md5Setup', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'md5Setup',
'ParseTypeChange', 'Wait', 'ParseTypeChange', 'Wait',
'Empty', 'Prompt', 'ToJSON', 'GetChoices', 'CallbackHelpInit', 'Empty', 'Prompt', 'ToJSON', 'GetChoices', 'CallbackHelpInit',
'InitiatePlaybookRun' , 'initSurvey', '$state', 'CreateSelect2', 'InitiatePlaybookRun' , 'initSurvey', '$state', 'CreateSelect2',
@@ -21,14 +21,12 @@ export default
function( function(
$filter, $scope, $rootScope, $filter, $scope, $rootScope,
$location, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert, $location, $stateParams, JobTemplateForm, GenerateForm, Rest, Alert,
ProcessErrors, ClearScope, GetBasePath, md5Setup, ProcessErrors, GetBasePath, md5Setup,
ParseTypeChange, Wait, ParseTypeChange, Wait,
Empty, Prompt, ToJSON, GetChoices, CallbackHelpInit, InitiatePlaybookRun, SurveyControllerInit, $state, Empty, Prompt, ToJSON, GetChoices, CallbackHelpInit, InitiatePlaybookRun, SurveyControllerInit, $state,
CreateSelect2, ToggleNotification, $q, InstanceGroupsService, InstanceGroupsData, MultiCredentialService CreateSelect2, ToggleNotification, $q, InstanceGroupsService, InstanceGroupsData, MultiCredentialService
) { ) {
ClearScope();
$scope.$watch('job_template_obj.summary_fields.user_capabilities.edit', function(val) { $scope.$watch('job_template_obj.summary_fields.user_capabilities.edit', function(val) {
if (val === false) { if (val === false) {
$scope.canAddJobTemplate = false; $scope.canAddJobTemplate = false;

View File

@@ -5,17 +5,16 @@
*************************************************/ *************************************************/
export default ['$scope', '$rootScope', export default ['$scope', '$rootScope',
'Alert','TemplateList', 'Prompt', 'ClearScope', 'ProcessErrors', 'Alert','TemplateList', 'Prompt', 'ProcessErrors',
'GetBasePath', 'InitiatePlaybookRun', 'Wait', '$state', '$filter', 'GetBasePath', 'InitiatePlaybookRun', 'Wait', '$state', '$filter',
'Dataset', 'rbacUiControlService', 'TemplatesService','QuerySet', 'Dataset', 'rbacUiControlService', 'TemplatesService','QuerySet',
'TemplateCopyService', 'TemplateCopyService',
function( function(
$scope, $rootScope, Alert, $scope, $rootScope, Alert,
TemplateList, Prompt, ClearScope, ProcessErrors, GetBasePath, TemplateList, Prompt, ProcessErrors, GetBasePath,
InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, TemplatesService, InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, TemplatesService,
qs, TemplateCopyService qs, TemplateCopyService
) { ) {
ClearScope();
var list = TemplateList; var list = TemplateList;
@@ -77,7 +76,7 @@ export default ['$scope', '$rootScope',
$scope[list.name] = $scope[`${list.iterator}_dataset`].results; $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
}); });
}); });
$scope.editJobTemplate = function(template) { $scope.editJobTemplate = function(template) {
if(template) { if(template) {
if(template.type && (template.type === 'Job Template' || template.type === 'job_template')) { if(template.type && (template.type === 'Job Template' || template.type === 'job_template')) {

View File

@@ -6,10 +6,10 @@
export default [ export default [
'$scope', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors', '$scope', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors',
'ClearScope', 'Wait', '$state', 'CreateSelect2', 'TemplatesService', 'Wait', '$state', 'CreateSelect2', 'TemplatesService',
'ToJSON', 'ParseTypeChange', '$q', 'Rest', 'GetBasePath', 'ToJSON', 'ParseTypeChange', '$q', 'Rest', 'GetBasePath',
function($scope, WorkflowForm, GenerateForm, Alert, ProcessErrors, function($scope, WorkflowForm, GenerateForm, Alert, ProcessErrors,
ClearScope, Wait, $state, CreateSelect2, TemplatesService, ToJSON, Wait, $state, CreateSelect2, TemplatesService, ToJSON,
ParseTypeChange, $q, Rest, GetBasePath) { ParseTypeChange, $q, Rest, GetBasePath) {
Rest.setUrl(GetBasePath('workflow_job_templates')); Rest.setUrl(GetBasePath('workflow_job_templates'));
@@ -21,7 +21,6 @@ export default [
} }
}); });
ClearScope();
// Inject dynamic view // Inject dynamic view
let form = WorkflowForm(), let form = WorkflowForm(),
generator = GenerateForm; generator = GenerateForm;

View File

@@ -6,15 +6,14 @@
export default [ export default [
'$scope', '$stateParams', 'WorkflowForm', 'GenerateForm', 'Alert', '$scope', '$stateParams', 'WorkflowForm', 'GenerateForm', 'Alert',
'ProcessErrors', 'ClearScope', 'GetBasePath', '$q', 'ParseTypeChange', 'ProcessErrors', 'GetBasePath', '$q', 'ParseTypeChange',
'Wait', 'Empty', 'ToJSON', 'initSurvey', '$state', 'CreateSelect2', 'Wait', 'Empty', 'ToJSON', 'initSurvey', '$state', 'CreateSelect2',
'ParseVariableString', 'TemplatesService', 'Rest', 'ToggleNotification', 'ParseVariableString', 'TemplatesService', 'Rest', 'ToggleNotification',
'OrgAdminLookup', 'OrgAdminLookup',
function($scope, $stateParams, WorkflowForm, GenerateForm, Alert, function($scope, $stateParams, WorkflowForm, GenerateForm, Alert,
ProcessErrors, ClearScope, GetBasePath, $q, ParseTypeChange, Wait, Empty, ProcessErrors, GetBasePath, $q, ParseTypeChange, Wait, Empty,
ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString, ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString,
TemplatesService, Rest, ToggleNotification, OrgAdminLookup) { TemplatesService, Rest, ToggleNotification, OrgAdminLookup) {
ClearScope();
$scope.$watch('workflow_job_template_obj.summary_fields.user_capabilities.edit', function(val) { $scope.$watch('workflow_job_template_obj.summary_fields.user_capabilities.edit', function(val) {
if (val === false) { if (val === false) {

View File

@@ -13,12 +13,11 @@ const user_type_options = [
]; ];
export default ['$scope', '$rootScope', 'UserForm', 'GenerateForm', 'Rest', export default ['$scope', '$rootScope', 'UserForm', 'GenerateForm', 'Rest',
'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'GetBasePath',
'Wait', 'CreateSelect2', '$state', '$location', 'i18n', 'Wait', 'CreateSelect2', '$state', '$location', 'i18n',
function($scope, $rootScope, UserForm, GenerateForm, Rest, Alert, function($scope, $rootScope, UserForm, GenerateForm, Rest, Alert,
ProcessErrors, ReturnToCaller, ClearScope, GetBasePath, Wait, CreateSelect2, ProcessErrors, ReturnToCaller, GetBasePath, Wait, CreateSelect2,
$state, $location, i18n) { $state, $location, i18n) {
ClearScope();
var defaultUrl = GetBasePath('organizations'), var defaultUrl = GetBasePath('organizations'),
form = UserForm; form = UserForm;

View File

@@ -13,15 +13,14 @@ const user_type_options = [
]; ];
export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest', export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest',
'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', 'CreateSelect2', 'ProcessErrors', 'GetBasePath', 'Wait', 'CreateSelect2',
'$state', 'i18n', '$state', 'i18n',
function($scope, $rootScope, $stateParams, UserForm, Rest, ProcessErrors, 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++) { for (var i = 0; i < user_type_options.length; i++) {
user_type_options[i].label = i18n._(user_type_options[i].label); user_type_options[i].label = i18n._(user_type_options[i].label);
} }
ClearScope();
var form = UserForm, var form = UserForm,
master = {}, master = {},

View File

@@ -13,9 +13,9 @@ const user_type_options = [
]; ];
export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt', export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt',
'ClearScope', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter',
'rbacUiControlService', 'Dataset', 'i18n', 'rbacUiControlService', 'Dataset', 'i18n',
function($scope, $rootScope, Rest, UserList, Prompt, ClearScope, function($scope, $rootScope, Rest, UserList, Prompt,
ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService,
Dataset, i18n) { Dataset, i18n) {
@@ -23,8 +23,6 @@ export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt',
user_type_options[i].label = i18n._(user_type_options[i].label); user_type_options[i].label = i18n._(user_type_options[i].label);
} }
ClearScope();
var list = UserList, var list = UserList,
defaultUrl = GetBasePath('users'); defaultUrl = GetBasePath('users');

View File

@@ -6,7 +6,6 @@ describe('Controller: TemplatesList', () => {
rootScope, rootScope,
state, state,
TemplatesListController, TemplatesListController,
ClearScope,
GetChoices, GetChoices,
Alert, Alert,
Prompt, Prompt,
@@ -53,7 +52,6 @@ describe('Controller: TemplatesList', () => {
} }
}; };
ClearScope = jasmine.createSpy('ClearScope');
GetChoices = jasmine.createSpy('GetChoices'); GetChoices = jasmine.createSpy('GetChoices');
Alert = jasmine.createSpy('Alert'); Alert = jasmine.createSpy('Alert');
Prompt = jasmine.createSpy('Prompt').and.callFake(function(args) { Prompt = jasmine.createSpy('Prompt').and.callFake(function(args) {
@@ -61,7 +59,6 @@ describe('Controller: TemplatesList', () => {
}); });
InitiatePlaybookRun = jasmine.createSpy('InitiatePlaybookRun'); InitiatePlaybookRun = jasmine.createSpy('InitiatePlaybookRun');
$provide.value('ClearScope', ClearScope);
$provide.value('GetChoices', GetChoices); $provide.value('GetChoices', GetChoices);
$provide.value('Alert', Alert); $provide.value('Alert', Alert);
$provide.value('Prompt', Prompt); $provide.value('Prompt', Prompt);
@@ -69,12 +66,11 @@ describe('Controller: TemplatesList', () => {
$provide.value('InitiatePlaybookRun', InitiatePlaybookRun); $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(); scope = $rootScope.$new();
rootScope = $rootScope; rootScope = $rootScope;
q = $q; q = $q;
state = _state_; state = _state_;
ClearScope = _ClearScope_;
GetChoices = _GetChoices_; GetChoices = _GetChoices_;
Alert = _Alert_; Alert = _Alert_;
Prompt = _Prompt_; Prompt = _Prompt_;
@@ -92,7 +88,6 @@ describe('Controller: TemplatesList', () => {
$scope: scope, $scope: scope,
$rootScope: rootScope, $rootScope: rootScope,
$state: state, $state: state,
ClearScope: ClearScope,
GetChoices: GetChoices, GetChoices: GetChoices,
Alert: Alert, Alert: Alert,
Prompt: Prompt, Prompt: Prompt,

View File

@@ -5,7 +5,6 @@ describe('Controller: WorkflowAdd', () => {
let scope, let scope,
state, state,
WorkflowAdd, WorkflowAdd,
ClearScope,
Alert, Alert,
GenerateForm, GenerateForm,
TemplatesService, TemplatesService,
@@ -45,7 +44,6 @@ describe('Controller: WorkflowAdd', () => {
} }
}; };
ClearScope = jasmine.createSpy('ClearScope');
Alert = jasmine.createSpy('Alert'); Alert = jasmine.createSpy('Alert');
ProcessErrors = jasmine.createSpy('ProcessErrors'); ProcessErrors = jasmine.createSpy('ProcessErrors');
CreateSelect2 = jasmine.createSpy('CreateSelect2'); CreateSelect2 = jasmine.createSpy('CreateSelect2');
@@ -53,7 +51,6 @@ describe('Controller: WorkflowAdd', () => {
ParseTypeChange = jasmine.createSpy('ParseTypeChange'); ParseTypeChange = jasmine.createSpy('ParseTypeChange');
ToJSON = jasmine.createSpy('ToJSON'); ToJSON = jasmine.createSpy('ToJSON');
$provide.value('ClearScope', ClearScope);
$provide.value('Alert', Alert); $provide.value('Alert', Alert);
$provide.value('GenerateForm', GenerateForm); $provide.value('GenerateForm', GenerateForm);
$provide.value('state', state); $provide.value('state', state);
@@ -64,11 +61,10 @@ describe('Controller: WorkflowAdd', () => {
$provide.value('ToJSON', ToJSON); $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(); scope = $rootScope.$new();
state = _state_; state = _state_;
q = $q; q = $q;
ClearScope = _ClearScope_;
Alert = _Alert_; Alert = _Alert_;
GenerateForm = _GenerateForm_; GenerateForm = _GenerateForm_;
httpBackend = $httpBackend; httpBackend = $httpBackend;
@@ -94,7 +90,6 @@ describe('Controller: WorkflowAdd', () => {
WorkflowAdd = $controller('WorkflowAdd', { WorkflowAdd = $controller('WorkflowAdd', {
$scope: scope, $scope: scope,
$state: state, $state: state,
ClearScope: ClearScope,
Alert: Alert, Alert: Alert,
GenerateForm: GenerateForm, GenerateForm: GenerateForm,
TemplatesService: TemplatesService, 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', ()=>{ it('should get/set the label options and select2-ify the input', ()=>{
// Resolve TemplatesService.getLabelsForJobTemplate // Resolve TemplatesService.getLabelsForJobTemplate
getLabelsDeferred.resolve({ getLabelsDeferred.resolve({