From 5a940ff06a31e41c08b5075daf92a51a9450ca70 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Wed, 9 Nov 2016 15:15:24 -0500 Subject: [PATCH] Fixed jshint errors and fixed bug where edge types were not being properly limited based on sibling edge types --- awx/ui/client/src/app.js | 6 +- awx/ui/client/src/controllers/Users.js | 4 +- awx/ui/client/src/forms/Inventories.js | 2 +- awx/ui/client/src/forms/WorkflowMaker.js | 9 +- awx/ui/client/src/helpers/JobDetail.js | 6 +- awx/ui/client/src/helpers/Schedules.js | 1 - awx/ui/client/src/helpers/teams.js | 6 +- awx/ui/client/src/i18n.js | 9 +- .../manage/groups/groups-add.controller.js | 4 +- .../manage/groups/groups-list.controller.js | 4 +- .../job-template-edit.controller.js | 5 +- awx/ui/client/src/job-templates/main.js | 4 + .../workflow-maker.controller.js | 26 ++-- .../client/src/license/license.controller.js | 82 ++++++------ .../authenticationServices/pendo.service.js | 8 +- .../authenticationServices/pendo/ng-pendo.js | 4 +- .../linkout/addUsers/addUsers.controller.js | 10 +- .../client/src/organizations/linkout/main.js | 1 - .../linkout/organizations-linkout.route.js | 1 - .../src/portal-mode/portal-mode.route.js | 4 +- .../src/scheduler/schedulerList.controller.js | 3 +- awx/ui/client/src/shared/form-generator.js | 9 +- .../shared/lookup/lookup-modal.directive.js | 2 +- awx/ui/client/src/shared/main.js | 1 - .../shared/paginate/paginate.controller.js | 4 +- .../shared/smart-search/queryset.service.js | 4 +- .../src/shared/socket/socket.service.js | 4 +- .../src/shared/stateDefinitions.factory.js | 2 - .../workflow-results.controller.js | 126 +++++++++--------- .../workflow-results.route.js | 3 +- .../workflow-results.service.js | 2 +- 31 files changed, 173 insertions(+), 183 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 5db5cb5638..0019ddf172 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -33,7 +33,6 @@ if ($basePath) { // Modules import './helpers'; -import * as forms from './forms'; import './lists'; import './widgets'; import './filters'; @@ -219,9 +218,8 @@ var tower = angular.module('Tower', [ .config(['$urlRouterProvider', '$breadcrumbProvider', 'QuerySetProvider', '$urlMatcherFactoryProvider', 'stateDefinitionsProvider', '$stateProvider', '$stateExtenderProvider', function($urlRouterProvider, $breadcrumbProvider, QuerySet, - $urlMatcherFactoryProvider, stateDefinitionsProvider, $stateProvider, $stateExtenderProvider) { - let $stateExtender = $stateExtenderProvider.$get(), - stateDefinitions = stateDefinitionsProvider.$get(); + $urlMatcherFactoryProvider, stateDefinitionsProvider, $stateProvider) { + let stateDefinitions = stateDefinitionsProvider.$get(); $urlMatcherFactoryProvider.strictMode(false); $breadcrumbProvider.setOptions({ templateUrl: urlPrefix + 'partials/breadcrumb.html' diff --git a/awx/ui/client/src/controllers/Users.js b/awx/ui/client/src/controllers/Users.js index 3a7f1b86a8..61ffb69d2e 100644 --- a/awx/ui/client/src/controllers/Users.js +++ b/awx/ui/client/src/controllers/Users.js @@ -114,7 +114,7 @@ UsersList.$inject = ['$scope', '$rootScope', '$stateParams', export function UsersAdd($scope, $rootScope, $stateParams, UserForm, GenerateForm, Rest, Alert, ProcessErrors, ReturnToCaller, ClearScope, - GetBasePath, ResetForm, Wait, CreateSelect2, $state, i18n) { + GetBasePath, ResetForm, Wait, CreateSelect2, $state, $location) { ClearScope(); @@ -201,7 +201,7 @@ export function UsersAdd($scope, $rootScope, $stateParams, UserForm, UsersAdd.$inject = ['$scope', '$rootScope', '$stateParams', 'UserForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'GetBasePath', - 'ResetForm', 'Wait', 'CreateSelect2', '$state', 'i18n' + 'ResetForm', 'Wait', 'CreateSelect2', '$state', '$location' ]; export function UsersEdit($scope, $rootScope, $location, diff --git a/awx/ui/client/src/forms/Inventories.js b/awx/ui/client/src/forms/Inventories.js index 06038da005..49692f476e 100644 --- a/awx/ui/client/src/forms/Inventories.js +++ b/awx/ui/client/src/forms/Inventories.js @@ -132,7 +132,7 @@ angular.module('InventoryFormDefinition', ['ScanJobsListDefinition']) } }, - relatedSets: function(urls) { + relatedSets: function() { return { permissions: { awToolTip: i18n._('Please save before assigning permissions'), diff --git a/awx/ui/client/src/forms/WorkflowMaker.js b/awx/ui/client/src/forms/WorkflowMaker.js index 378fe19557..d7cf84ade9 100644 --- a/awx/ui/client/src/forms/WorkflowMaker.js +++ b/awx/ui/client/src/forms/WorkflowMaker.js @@ -31,15 +31,18 @@ export default options: [ { label: 'On Success', - value: 'success' + value: 'success', + ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "successFailure"' }, { label: 'On Failure', - value: 'failure' + value: 'failure', + ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "successFailure"' }, { label: 'Always', - value: 'always' + value: 'always', + ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "always"' } ], awRequiredWhen: { diff --git a/awx/ui/client/src/helpers/JobDetail.js b/awx/ui/client/src/helpers/JobDetail.js index b96c8c3d37..0cda454f2e 100644 --- a/awx/ui/client/src/helpers/JobDetail.js +++ b/awx/ui/client/src/helpers/JobDetail.js @@ -1039,7 +1039,6 @@ export default //plays = JSON.parse(JSON.stringify(scope.jobData.plays)), plays = scope.jobData.plays, filteredListX = [], - filteredListA = [], filteredListB = [], key, keys; @@ -1113,7 +1112,6 @@ export default var scope = params.scope, result = [], filteredListX = [], - filteredListA = [], filteredListB = [], idx, key, keys, newKeys, tasks, t; @@ -1196,11 +1194,9 @@ export default return function(params) { var scope = params.scope, result = [], - filteredListA = [], filteredListB = [], idx = 0, hostResults, - key, keys; if (scope.activePlay && scope.activeTask && scope.jobData.plays[scope.activePlay] && @@ -1232,7 +1228,7 @@ export default // else { // filteredListB = filteredListA; // } - + keys = Object.keys(filteredListB); keys.sort(function compare(a, b) { if (filteredListB[a].name === filteredListB[b].name) { diff --git a/awx/ui/client/src/helpers/Schedules.js b/awx/ui/client/src/helpers/Schedules.js index 198d204975..b56d966e4f 100644 --- a/awx/ui/client/src/helpers/Schedules.js +++ b/awx/ui/client/src/helpers/Schedules.js @@ -381,7 +381,6 @@ export default return function(params) { var scope = params.scope, id = params.id, - callback = params.callback, url = GetBasePath('schedules') + id +'/'; // Perform the update diff --git a/awx/ui/client/src/helpers/teams.js b/awx/ui/client/src/helpers/teams.js index 2ff67079ca..d729a8996e 100644 --- a/awx/ui/client/src/helpers/teams.js +++ b/awx/ui/client/src/helpers/teams.js @@ -22,8 +22,7 @@ export default return function (params) { var scope = params.scope, - set = params.set, - iterator = params.iterator; + set = params.set; // Listeners to perform lookups after main inventory list loads @@ -86,8 +85,7 @@ export default scope.lookUpOrganization = function () { var list = OrganizationList, listGenerator = GenerateList, - listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select Organization' }), - defaultUrl = '/api/v1/organizations/'; + listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select Organization' }); listScope.selectAction = function () { var i, found = false; diff --git a/awx/ui/client/src/i18n.js b/awx/ui/client/src/i18n.js index c5e5b782de..78f2150153 100644 --- a/awx/ui/client/src/i18n.js +++ b/awx/ui/client/src/i18n.js @@ -45,8 +45,8 @@ export function format(f) { var args = arguments; var len = args.length; var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; + if (x === '%%') {return '%';} + if (i >= len) {return x;} switch (x) { case '%s': return String(args[i++]); case '%d': return Number(args[i++]); @@ -57,6 +57,7 @@ export function format(f) { } catch (_) { return '[Circular]'; } + break; default: return x; } @@ -78,12 +79,12 @@ export default return function() { var langInfo = $window.navigator.language || $window.navigator.userLanguage; - var langUrl = langInfo.replace('-', '_'); + //var langUrl = langInfo.replace('-', '_'); //gettextCatalog.debug = true; gettextCatalog.setCurrentLanguage(langInfo); // TODO: the line below is commented out temporarily until // the .po files are received from the i18n team, in order to avoid - // 404 file not found console errors in dev + // 404 file not found console errors in dev // gettextCatalog.loadRemote('/static/languages/' + langUrl + '.json'); }; }]) diff --git a/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js index 97da922561..031cf03f8a 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js @@ -8,8 +8,8 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList 'GroupManageService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'rbacUiControlService', 'ToJSON', function($state, $stateParams, $scope, GroupForm, CredentialList, ParseTypeChange, GenerateForm, inventoryData, GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, rbacUiControlService, ToJSON) { - var generator = GenerateForm, - form = GroupForm(); + + let form = GroupForm(); init(); function init() { diff --git a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js index 1c9559e76e..7385e2f09b 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js @@ -6,10 +6,10 @@ export default ['$scope', '$rootScope', '$state', '$stateParams', 'InventoryGroups', 'generateList', 'InventoryUpdate', 'GroupManageService', 'GroupsCancelUpdate', 'ViewUpdateStatus', 'rbacUiControlService', 'GetBasePath', - 'InventoryManageService', 'groupsUrl', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'groupsDataset', + 'InventoryManageService', 'groupsUrl', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'groupsDataset', 'Find', function($scope, $rootScope, $state, $stateParams, InventoryGroups, generateList, InventoryUpdate, GroupManageService, GroupsCancelUpdate, ViewUpdateStatus, rbacUiControlService, GetBasePath, - InventoryManageService, groupsUrl, GetSyncStatusMsg, GetHostsStatusMsg, groupsDataset){ + InventoryManageService, groupsUrl, GetSyncStatusMsg, GetHostsStatusMsg, groupsDataset, Find){ let list = InventoryGroups; diff --git a/awx/ui/client/src/job-templates/edit-job-template/job-template-edit.controller.js b/awx/ui/client/src/job-templates/edit-job-template/job-template-edit.controller.js index 95d7a8272a..71554b411c 100644 --- a/awx/ui/client/src/job-templates/edit-job-template/job-template-edit.controller.js +++ b/awx/ui/client/src/job-templates/edit-job-template/job-template-edit.controller.js @@ -187,7 +187,6 @@ export default Rest.setUrl(GetBasePath('projects') + $scope.project + '/'); Rest.get() .success(function (data) { - console.log(data) var msg; switch (data.status) { case 'failed': @@ -252,7 +251,7 @@ export default if ($scope.cloudCredentialReadyRemove) { $scope.cloudCredentialReadyRemove(); } - $scope.cloudCredentialReadyRemove = $scope.$on('cloudCredentialReady', function (e, name) { + $scope.cloudCredentialReadyRemove = $scope.$on('cloudCredentialReady', function () { $scope.$emit('jobTemplateLoadFinished'); }); @@ -261,7 +260,7 @@ export default if ($scope.jobTemplateLoadedRemove) { $scope.jobTemplateLoadedRemove(); } - $scope.jobTemplateLoadedRemove = $scope.$on('jobTemplateLoaded', function (e, related_cloud_credential, masterObject, relatedSets) { + $scope.jobTemplateLoadedRemove = $scope.$on('jobTemplateLoaded', function (e, related_cloud_credential, masterObject) { var dft; master = masterObject; diff --git a/awx/ui/client/src/job-templates/main.js b/awx/ui/client/src/job-templates/main.js index 6b6659dd7c..e404e4d19e 100644 --- a/awx/ui/client/src/job-templates/main.js +++ b/awx/ui/client/src/job-templates/main.js @@ -297,6 +297,10 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp $scope[key] = value; }); }); + + $scope.$on('setEdgeType', function(e, edgeType) { + $scope.edgeType = edgeType; + }); } ] } diff --git a/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.controller.js b/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.controller.js index 268be60b39..e571a32952 100644 --- a/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.controller.js +++ b/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.controller.js @@ -21,9 +21,6 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis formIsValid: false }; - // Set the intial edge type to success - $scope.edgeType = "success"; - $scope.job_type_options = [{ label: "Run", value: "run" @@ -35,14 +32,6 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis function init() { $scope.treeDataMaster = angular.copy($scope.treeData.data); $scope.$broadcast("refreshWorkflowChart"); - - $scope.$watchGroup(['selectedTemplate', 'edgeType'], function() { - if ($scope.selectedTemplate && $scope.edgeType) { - $scope.workflowMakerFormConfig.formIsValid = true; - } else { - $scope.workflowMakerFormConfig.formIsValid = false; - } - }); } function resetNodeForm() { @@ -55,7 +44,6 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis delete $scope.placeholderNode; delete $scope.betweenTwoNodes; $scope.nodeBeingEdited = null; - $scope.edgeType = "success"; $scope.edgeTypeRestriction = null; $scope.workflowMakerFormConfig.activeTab = "jobs"; } @@ -104,25 +92,29 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis parentId: betweenTwoNodes ? parent.source.id : parent.id }); + // Set the default to success + let edgeType = "success"; + if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) { // We don't want to give the user the option to select // a type as this node will always be executed - $scope.edgeType = "always"; + edgeType = "always"; $scope.showTypeOptions = false; } else { if ((_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) && _.includes(siblingConnectionTypes, "always")) { // This is a problem... } else if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) { $scope.edgeTypeRestriction = "successFailure"; - $scope.edgeType = "success"; + edgeType = "success"; } else if (_.includes(siblingConnectionTypes, "always")) { $scope.edgeTypeRestriction = "always"; - $scope.edgeType = "always"; + edgeType = "always"; } $scope.showTypeOptions = true; } + $scope.$broadcast("setEdgeType", edgeType); $scope.$broadcast("refreshWorkflowChart"); }; @@ -343,9 +335,11 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis break; } - formValues.edgeType = $scope.nodeBeingEdited.edgeType; + //formValues.edgeType = $scope.nodeBeingEdited.edgeType; $scope.showTypeOptions = (parent && parent.isStartNode) ? false : true; + $scope.$broadcast('setEdgeType', $scope.nodeBeingEdited.edgeType); + $scope.$broadcast('templateSelected', { presetValues: formValues, activeTab: $scope.workflowMakerFormConfig.activeTab diff --git a/awx/ui/client/src/license/license.controller.js b/awx/ui/client/src/license/license.controller.js index 8b0cae9269..682f1cfb01 100644 --- a/awx/ui/client/src/license/license.controller.js +++ b/awx/ui/client/src/license/license.controller.js @@ -13,6 +13,48 @@ export default function( Wait, $state, $scope, $rootScope, $location, GetBasePath, Rest, ProcessErrors, CheckLicense, moment, $window, ConfigService, FeaturesService, pendoService, i18n){ + + var calcDaysRemaining = function(seconds){ + // calculate the number of days remaining on the license + var duration = moment.duration(seconds, 'seconds').asDays(); + duration = Math.floor(duration); + if(duration < 0 ){ + duration = 0; + } + duration = (duration!==1) ? `${duration} Days` : `${duration} Day`; + return duration; + }; + + + var calcExpiresOn = function(days){ + // calculate the expiration date of the license + days = parseInt(days); + return moment().add(days, 'days').calendar(); + }; + + var reset = function(){ + document.getElementById('License-form').reset(); + }; + + var init = function(){ + // license/license.partial.html compares fileName + $scope.fileName = N_("No file selected."); + $scope.title = $rootScope.licenseMissing ? ("Tower " + i18n._("License")) : i18n._("License Management"); + Wait('start'); + ConfigService.getConfig().then(function(config){ + $scope.license = config; + $scope.license.version = config.version.split('-')[0]; + $scope.time = {}; + $scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining); + $scope.time.expiresOn = calcExpiresOn($scope.time.remaining); + $scope.valid = CheckLicense.valid($scope.license.license_info); + $scope.compliant = $scope.license.license_info.compliant; + Wait('stop'); + }); + }; + + init(); + $scope.getKey = function(event){ // Mimic HTML5 spec, show filename $scope.fileName = event.target.files[0].name; @@ -73,43 +115,5 @@ export default }); }); }; - var calcDaysRemaining = function(seconds){ - // calculate the number of days remaining on the license - var duration = moment.duration(seconds, 'seconds').asDays(); - duration = Math.floor(duration); - if(duration < 0 ){ - duration = 0; - } - duration = (duration!==1) ? `${duration} Days` : `${duration} Day`; - return duration; - }; - - - var calcExpiresOn = function(days){ - // calculate the expiration date of the license - days = parseInt(days); - return moment().add(days, 'days').calendar(); - }; - - var init = function(){ - // license/license.partial.html compares fileName - $scope.fileName = N_("No file selected."); - $scope.title = $rootScope.licenseMissing ? ("Tower " + i18n._("License")) : i18n._("License Management"); - Wait('start'); - ConfigService.getConfig().then(function(config){ - $scope.license = config; - $scope.license.version = config.version.split('-')[0]; - $scope.time = {}; - $scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining); - $scope.time.expiresOn = calcExpiresOn($scope.time.remaining); - $scope.valid = CheckLicense.valid($scope.license.license_info); - $scope.compliant = $scope.license.license_info.compliant; - Wait('stop'); - }); - }; - var reset = function(){ - document.getElementById('License-form').reset(); - }; - init(); } - ]; +]; diff --git a/awx/ui/client/src/login/authenticationServices/pendo.service.js b/awx/ui/client/src/login/authenticationServices/pendo.service.js index 10cdbd33d8..ebcad0f03f 100644 --- a/awx/ui/client/src/login/authenticationServices/pendo.service.js +++ b/awx/ui/client/src/login/authenticationServices/pendo.service.js @@ -94,10 +94,10 @@ export default }, issuePendoIdentity: function () { - var config, - options, + var options, c = ConfigService.get(), - config = c.license_info; + config = c.license_info; + config.analytics_status = c.analytics_status; config.version = c.version; config.ansible_version = c.ansible_version; @@ -114,7 +114,7 @@ export default }); } else { - $log.debug('Pendo is turned off.') + $log.debug('Pendo is turned off.'); } } }; diff --git a/awx/ui/client/src/login/authenticationServices/pendo/ng-pendo.js b/awx/ui/client/src/login/authenticationServices/pendo/ng-pendo.js index 3d6e86ae02..d0e79872e1 100644 --- a/awx/ui/client/src/login/authenticationServices/pendo/ng-pendo.js +++ b/awx/ui/client/src/login/authenticationServices/pendo/ng-pendo.js @@ -1,3 +1,5 @@ +/* jshint ignore:start */ + /* * pendo.io Angular Module * @@ -25,7 +27,7 @@ setTimeout(waitFn, delay); } }; - + angular.module('pendolytics', []) .provider('$pendolytics', function() { diff --git a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js index ac87ca6788..b42d143b00 100644 --- a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js +++ b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js @@ -11,15 +11,11 @@ * Controller for handling permissions adding */ -export default ['$scope', '$rootScope', 'ProcessErrors', 'generateList', 'GetBasePath', +export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'templateUrl', '$state', 'Rest', '$q', 'Wait', -function($scope, $rootScope, ProcessErrors, generateList, GetBasePath, +function($scope, $rootScope, ProcessErrors, GetBasePath, SelectionInit, templateUrl, $state, Rest, $q, Wait) { $scope.$on("linkLists", function() { - var generator = generateList, - //list = AddUserList, - id = "addUsersList", - mode = "add"; if ($state.current.name.split(".")[1] === "users") { $scope.addType = "Users"; @@ -36,7 +32,7 @@ function($scope, $rootScope, ProcessErrors, generateList, GetBasePath, $scope.add_users = $scope.$parent.add_user_dataset.results; $scope.selectedItems = []; - $scope.$on('selectedOrDeselected', (item)=>{ + $scope.$on('selectedOrDeselected', ()=>{ throw {name: 'NotYetImplemented'}; }); } diff --git a/awx/ui/client/src/organizations/linkout/main.js b/awx/ui/client/src/organizations/linkout/main.js index 0701b87b96..e6d31a156c 100644 --- a/awx/ui/client/src/organizations/linkout/main.js +++ b/awx/ui/client/src/organizations/linkout/main.js @@ -1,4 +1,3 @@ -import routes from './organizations-linkout.route'; import AddUsers from './addUsers/main'; export default angular.module('organizationsLinkout', [AddUsers.name]); diff --git a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js index 207ab2d8ec..c22b3c1049 100644 --- a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js +++ b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js @@ -4,7 +4,6 @@ * All Rights Reserved *************************************************/ -import { templateUrl } from '../../shared/template-url/template-url.factory'; import OrganizationsAdmins from './controllers/organizations-admins.controller'; import OrganizationsInventories from './controllers/organizations-inventories.controller'; import OrganizationsJobTemplates from './controllers/organizations-job-templates.controller'; diff --git a/awx/ui/client/src/portal-mode/portal-mode.route.js b/awx/ui/client/src/portal-mode/portal-mode.route.js index e9924394c6..715387f3fb 100644 --- a/awx/ui/client/src/portal-mode/portal-mode.route.js +++ b/awx/ui/client/src/portal-mode/portal-mode.route.js @@ -34,8 +34,8 @@ export default { views: { 'list@': { templateUrl: templateUrl('portal-mode/portal-mode-layout'), - controller: ['$scope', '$rootScope', '$state', '$stateParams', 'GetBasePath', 'QuerySet', 'jobsDataset', - function($scope, $rootScope, $state, $stateParams, GetBasePath, qs, Dataset) { + controller: ['$scope', '$rootScope', '$state', '$stateParams', 'GetBasePath', 'QuerySet', + function($scope, $rootScope, $state, $stateParams, GetBasePath, qs) { let path; init(); diff --git a/awx/ui/client/src/scheduler/schedulerList.controller.js b/awx/ui/client/src/scheduler/schedulerList.controller.js index 4400eef5c4..b532c6d6dd 100644 --- a/awx/ui/client/src/scheduler/schedulerList.controller.js +++ b/awx/ui/client/src/scheduler/schedulerList.controller.js @@ -90,9 +90,8 @@ export default [ }); }; - base = $location.path().replace(/^\//, '').split('/')[0]; - console.log(base) + if (base === 'management_jobs') { $scope.base = base = 'system_job_templates'; } diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index aff321c247..888f92e349 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -142,10 +142,10 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat .factory('GenerateForm', ['$rootScope', '$location', '$compile', 'generateList', 'Attr', 'Icon', 'Column', 'NavigationLink', 'HelpCollapse', 'DropDown', 'Empty', 'SelectIcon', - 'Store', 'ActionButton', '$log', 'i18n', '$timeout', + 'Store', 'ActionButton', '$log', 'i18n', function ($rootScope, $location, $compile, GenerateList, Attr, Icon, Column, NavigationLink, HelpCollapse, - DropDown, Empty, SelectIcon, Store, ActionButton, $log, i18n, $timeout) { + DropDown, Empty, SelectIcon, Store, ActionButton, $log, i18n) { return { setForm: function (form) { this.form = form; }, @@ -1079,6 +1079,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat html += (field.ngChange) ? this.attr(field, 'ngChange') : ""; html += (field.readonly) ? "disabled " : ""; html += (field.required) ? "required " : ""; + html += (field.ngshow) ? "ng-show=\"" + field.ngShow + "\" " : ""; if(field.awRequiredWhen) { html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : ""; html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : ""; @@ -1233,8 +1234,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat // Generate HTML. Do NOT call this function directly. Called by inject(). Returns an HTML // string to be injected into the current view. // - var btn, button, fld, field, html = '', i, section, group, - tab, sectionShow, offset, width,ngDisabled, itm; + var btn, button, fld, field, html = '', section, group, + sectionShow, offset, width,ngDisabled, itm; // title and exit button if(!(this.form.showHeader !== undefined && this.form.showHeader === false)) { diff --git a/awx/ui/client/src/shared/lookup/lookup-modal.directive.js b/awx/ui/client/src/shared/lookup/lookup-modal.directive.js index ba1b400f0f..588573bb27 100644 --- a/awx/ui/client/src/shared/lookup/lookup-modal.directive.js +++ b/awx/ui/client/src/shared/lookup/lookup-modal.directive.js @@ -1,4 +1,4 @@ -export default ['templateUrl', '$compile', function(templateUrl, $compile) { +export default ['templateUrl', function(templateUrl) { return { restrict: 'E', replace: true, diff --git a/awx/ui/client/src/shared/main.js b/awx/ui/client/src/shared/main.js index 78bc5d19f9..8db9dd8172 100644 --- a/awx/ui/client/src/shared/main.js +++ b/awx/ui/client/src/shared/main.js @@ -10,7 +10,6 @@ import lookupModal from './lookup/main'; import smartSearch from './smart-search/main'; import paginate from './paginate/main'; import columnSort from './column-sort/main'; -import title from './title.directive'; import lodashAsPromised from './lodash-as-promised'; import stringFilters from './string-filters/main'; import truncatedText from './truncated-text.directive'; diff --git a/awx/ui/client/src/shared/paginate/paginate.controller.js b/awx/ui/client/src/shared/paginate/paginate.controller.js index b8d0a4ecf5..f0276bdebd 100644 --- a/awx/ui/client/src/shared/paginate/paginate.controller.js +++ b/awx/ui/client/src/shared/paginate/paginate.controller.js @@ -50,9 +50,9 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q } function calcDataRange() { - if ($scope.current() == 1 && $scope.dataset.count < parseInt(pageSize)) { + if ($scope.current() === 1 && $scope.dataset.count < parseInt(pageSize)) { return `1 - ${$scope.dataset.count}`; - } else if ($scope.current() == 1) { + } else if ($scope.current() === 1) { return `1 - ${pageSize}`; } else { let floor = (($scope.current() - 1) * parseInt(pageSize)) + 1; diff --git a/awx/ui/client/src/shared/smart-search/queryset.service.js b/awx/ui/client/src/shared/smart-search/queryset.service.js index 12057c1a90..1296a1394b 100644 --- a/awx/ui/client/src/shared/smart-search/queryset.service.js +++ b/awx/ui/client/src/shared/smart-search/queryset.service.js @@ -1,5 +1,5 @@ -export default ['$q', 'Rest', 'ProcessErrors', '$rootScope', 'Wait', 'DjangoSearchModel', '$cacheFactory', 'GetBasePath', - function($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearchModel, $cacheFactory, GetBasePath) { +export default ['$q', 'Rest', 'ProcessErrors', '$rootScope', 'Wait', 'DjangoSearchModel', '$cacheFactory', + function($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearchModel, $cacheFactory) { return { // kick off building a model for a specific endpoint // this is usually a list's basePath diff --git a/awx/ui/client/src/shared/socket/socket.service.js b/awx/ui/client/src/shared/socket/socket.service.js index 1af67cb6ef..64933f8fbd 100644 --- a/awx/ui/client/src/shared/socket/socket.service.js +++ b/awx/ui/client/src/shared/socket/socket.service.js @@ -50,13 +50,13 @@ export default $log.debug('Websocket Error Logged: ' + error); //log errors }; - self.socket.onconnecting = function (event) { + self.socket.onconnecting = function () { self.checkStatus(); $log.debug('Websocket reconnecting'); needsResubscribing = true; }; - self.socket.onclose = function (event) { + self.socket.onclose = function () { self.checkStatus(); $log.debug(`Websocket disconnected`); }; diff --git a/awx/ui/client/src/shared/stateDefinitions.factory.js b/awx/ui/client/src/shared/stateDefinitions.factory.js index d3c5806698..b76c5b5a36 100644 --- a/awx/ui/client/src/shared/stateDefinitions.factory.js +++ b/awx/ui/client/src/shared/stateDefinitions.factory.js @@ -9,8 +9,6 @@ * generateLookupNodes - Attaches to a form node. Builds an abstract '*.lookup' node with field-specific 'lookup.*' children e.g. {name: 'projects.add.lookup.organizations', ...} */ -import { templateUrl } from './template-url/template-url.factory'; - export default ['$injector', '$stateExtender', '$log', function($injector, $stateExtender, $log) { return { /** diff --git a/awx/ui/client/src/workflow-results/workflow-results.controller.js b/awx/ui/client/src/workflow-results/workflow-results.controller.js index 3b96f6e0d2..d3f6eb4da9 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.controller.js +++ b/awx/ui/client/src/workflow-results/workflow-results.controller.js @@ -13,7 +13,7 @@ export default ['workflowData', workflowNodes, $scope, ParseTypeChange, - ParseVariableString, + ParseVariableString ) { var getTowerLinks = function() { var getTowerLink = function(key) { @@ -48,10 +48,10 @@ export default ['workflowData', $scope.verbosity_label = getTowerLabel('verbosity'); }; - var getTotalHostCount = function(count) { - return Object - .keys(count).reduce((acc, i) => acc += count[i], 0); - }; + // var getTotalHostCount = function(count) { + // return Object + // .keys(count).reduce((acc, i) => acc += count[i], 0); + // }; // put initially resolved request data on scope $scope.workflow = workflowData; @@ -101,60 +101,60 @@ export default ['workflowData', // This is where the async updates to the UI actually happen. // Flow is event queue munging in the service -> $scope setting in here - var processEvent = function(event) { - // put the event in the queue - eventQueue.populate(event).then(mungedEvent => { - // make changes to ui based on the event returned from the queue - if (mungedEvent.changes) { - mungedEvent.changes.forEach(change => { - // we've got a change we need to make to the UI! - // update the necessary scope and make the change - if (change === 'startTime' && !$scope.workflow.start) { - $scope.workflow.start = mungedEvent.startTime; - } - - if (change === 'count' && !$scope.countFinished) { - // for all events that affect the host count, - // update the status bar as well as the host - // count badge - $scope.count = mungedEvent.count; - $scope.hostCount = getTotalHostCount(mungedEvent - .count); - } - - if (change === 'playCount') { - $scope.playCount = mungedEvent.playCount; - } - - if (change === 'taskCount') { - $scope.taskCount = mungedEvent.taskCount; - } - - if (change === 'finishedTime' && !$scope.workflow.finished) { - $scope.workflow.finished = mungedEvent.finishedTime; - } - - if (change === 'countFinished') { - // the playbook_on_stats event actually lets - // us know that we don't need to iteratively - // look at event to update the host counts - // any more. - $scope.countFinished = true; - } - - if(change === 'stdout'){ - angular - .element(".JobResultsStdOut-stdoutContainer") - .append($compile(mungedEvent - .stdout)($scope)); - } - }); - } - - // the changes have been processed in the ui, mark it in the queue - eventQueue.markProcessed(event); - }); - }; + // var processEvent = function(event) { + // // put the event in the queue + // eventQueue.populate(event).then(mungedEvent => { + // // make changes to ui based on the event returned from the queue + // if (mungedEvent.changes) { + // mungedEvent.changes.forEach(change => { + // // we've got a change we need to make to the UI! + // // update the necessary scope and make the change + // if (change === 'startTime' && !$scope.workflow.start) { + // $scope.workflow.start = mungedEvent.startTime; + // } + // + // if (change === 'count' && !$scope.countFinished) { + // // for all events that affect the host count, + // // update the status bar as well as the host + // // count badge + // $scope.count = mungedEvent.count; + // $scope.hostCount = getTotalHostCount(mungedEvent + // .count); + // } + // + // if (change === 'playCount') { + // $scope.playCount = mungedEvent.playCount; + // } + // + // if (change === 'taskCount') { + // $scope.taskCount = mungedEvent.taskCount; + // } + // + // if (change === 'finishedTime' && !$scope.workflow.finished) { + // $scope.workflow.finished = mungedEvent.finishedTime; + // } + // + // if (change === 'countFinished') { + // // the playbook_on_stats event actually lets + // // us know that we don't need to iteratively + // // look at event to update the host counts + // // any more. + // $scope.countFinished = true; + // } + // + // if(change === 'stdout'){ + // angular + // .element(".JobResultsStdOut-stdoutContainer") + // .append($compile(mungedEvent + // .stdout)($scope)); + // } + // }); + // } + // + // // the changes have been processed in the ui, mark it in the queue + // eventQueue.markProcessed(event); + // }); + // }; // PULL! grab completed event data and process each event // TODO: implement retry logic in case one of these requests fails @@ -174,10 +174,10 @@ export default ['workflowData', // }; // getEvents($scope.job.related.job_events); - // Processing of job_events messages from the websocket - $scope.$on(`ws-job_events-${$scope.workflow.id}`, function(e, data) { - processEvent(data); - }); + // // Processing of job_events messages from the websocket + // $scope.$on(`ws-job_events-${$scope.workflow.id}`, function(e, data) { + // processEvent(data); + // }); // Processing of job-status messages from the websocket $scope.$on(`ws-jobs`, function(e, data) { diff --git a/awx/ui/client/src/workflow-results/workflow-results.route.js b/awx/ui/client/src/workflow-results/workflow-results.route.js index 8ccf016a4a..4d15d50777 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.route.js +++ b/awx/ui/client/src/workflow-results/workflow-results.route.js @@ -59,7 +59,8 @@ export default { defer.resolve(data.results); }) .error(function() { - defer.resolve(data); + // TODO: handle this + //defer.resolve(data); }); return defer.promise; }], diff --git a/awx/ui/client/src/workflow-results/workflow-results.service.js b/awx/ui/client/src/workflow-results/workflow-results.service.js index 5eb1dee19a..cf7ba70af8 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.service.js +++ b/awx/ui/client/src/workflow-results/workflow-results.service.js @@ -18,7 +18,7 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr `, action: function() { Wait('start'); - Rest.setUrl(job.url); + Rest.setUrl(workflow.url); Rest.destroy() .success(function() { Wait('stop');