From 767991fc2b5c0696859adf4156de1f617ddf58fe Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 28 Mar 2018 11:18:00 -0400 Subject: [PATCH] Complete removal of InitialPlaybookRun --- .../lib/components/components.strings.js | 4 +++ .../launchTemplateButton.component.js | 12 +++++---- .../launchTemplateButton.partial.html | 4 ++- .../initiateplaybookrun.factory.js | 26 ------------------- awx/ui/client/src/job-submission/main.js | 2 -- .../organizations-job-templates.controller.js | 8 ++---- .../linkout/organizations-linkout.route.js | 1 - .../list-generator/list-generator.factory.js | 4 +-- awx/ui/client/src/templates/templates.list.js | 8 ++---- 9 files changed, 19 insertions(+), 50 deletions(-) delete mode 100644 awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js diff --git a/awx/ui/client/lib/components/components.strings.js b/awx/ui/client/lib/components/components.strings.js index 513098dc76..015fd5d387 100644 --- a/awx/ui/client/lib/components/components.strings.js +++ b/awx/ui/client/lib/components/components.strings.js @@ -87,6 +87,10 @@ function ComponentsStrings (BaseString) { FAILED: t.s('Failed') }; + ns.launchTemplate = { + DEFAULT: t.s('Start a job using this template') + }; + ns.list = { DEFAULT_EMPTY_LIST: t.s('Please add items to this list.') }; diff --git a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js index 4081f29bff..d4c9403823 100644 --- a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js +++ b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js @@ -6,22 +6,24 @@ const atLaunchTemplate = { template: '<' }, controller: ['JobTemplateModel', 'WorkflowJobTemplateModel', 'PromptService', '$state', - 'ProcessErrors', '$scope', 'TemplatesStrings', 'Alert', atLaunchTemplateCtrl], + 'ComponentsStrings', 'ProcessErrors', '$scope', 'TemplatesStrings', 'Alert', + atLaunchTemplateCtrl], controllerAs: 'vm' }; function atLaunchTemplateCtrl ( JobTemplate, WorkflowTemplate, PromptService, $state, - ProcessErrors, $scope, strings, Alert + componentsStrings, ProcessErrors, $scope, templatesStrings, Alert ) { const vm = this; const jobTemplate = new JobTemplate(); const workflowTemplate = new WorkflowTemplate(); + vm.strings = componentsStrings; const createErrorHandler = (path, action) => ({ data, status }) => { - const hdr = strings.get('error.HEADER'); - const msg = strings.get('error.CALL', { path, action, status }); + const hdr = templatesStrings.get('error.HEADER'); + const msg = templatesStrings.get('error.CALL', { path, action, status }); ProcessErrors($scope, data, status, null, { hdr, msg }); }; @@ -111,7 +113,7 @@ function atLaunchTemplateCtrl ( } }); } else { - Alert(strings.get('error.UNKNOWN'), strings.get('alert.UNKNOWN_LAUNCH')); + Alert(templatesStrings.get('error.UNKNOWN'), templatesStrings.get('alert.UNKNOWN_LAUNCH')); } }; diff --git a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html index 5be2373264..9ac0fc2e1b 100644 --- a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html +++ b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.partial.html @@ -1,6 +1,8 @@
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js deleted file mode 100644 index 01e04a25bc..0000000000 --- a/awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js +++ /dev/null @@ -1,26 +0,0 @@ -export default - function InitiatePlaybookRun($compile) { - - // This factory drops the submit-job directive into the dom which - // either launches the job (when no user input is needed) or shows - // the user a job sumbission modal with varying steps based on what - // is being prompted/what passwords are needed. - - return function (params) { - var scope = params.scope.$new(), - id = params.id, - relaunch = params.relaunch || false, - job_type = params.job_type, - host_type = params.host_type || ""; - scope.job_template_id = id; - - var el = $compile( "" )( scope ); - $('#content-container').remove('submit-job').append( el ); - }; - } - -InitiatePlaybookRun.$inject = - [ '$compile' - ]; diff --git a/awx/ui/client/src/job-submission/main.js b/awx/ui/client/src/job-submission/main.js index f0a38c6874..563942818b 100644 --- a/awx/ui/client/src/job-submission/main.js +++ b/awx/ui/client/src/job-submission/main.js @@ -4,7 +4,6 @@ * All Rights Reserved *************************************************/ -import InitiatePlaybookRun from './job-submission-factories/initiateplaybookrun.factory'; import LaunchJob from './job-submission-factories/launchjob.factory'; import GetSurveyQuestions from './job-submission-factories/getsurveyquestions.factory'; import AdhocRun from './job-submission-factories/adhoc-run.factory.js'; @@ -21,7 +20,6 @@ import awPasswordMax from './job-submission-directives/aw-password-max.directive export default angular.module('jobSubmission', []) - .factory('InitiatePlaybookRun', InitiatePlaybookRun) .factory('LaunchJob', LaunchJob) .factory('GetSurveyQuestions', GetSurveyQuestions) .factory('AdhocRun', AdhocRun) diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js index 3caeb4425b..2d5e0eab40 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js @@ -6,11 +6,11 @@ export default ['$scope', '$rootScope', '$stateParams', 'Rest', 'ProcessErrors', - 'GetBasePath', 'InitiatePlaybookRun', 'Wait', + 'GetBasePath', 'Wait', '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', 'QuerySet', function($scope, $rootScope, $stateParams, Rest, ProcessErrors, - GetBasePath, InitiatePlaybookRun, Wait, + GetBasePath, Wait, $state, OrgJobTemplateList, Dataset, qs) { var list = OrgJobTemplateList, @@ -73,10 +73,6 @@ export default ['$scope', '$rootScope', $state.go('templates.editJobTemplate', { job_template_id: id }); }; - $scope.submitJob = function(id) { - InitiatePlaybookRun({ scope: $scope, id: id, job_type: 'job_template' }); - }; - $scope.scheduleJob = function(id) { $state.go('jobTemplateSchedules', { id: id }); }; 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 14ece5f287..43165dbf9d 100644 --- a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js +++ b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js @@ -272,7 +272,6 @@ export default [{ list.basePath = "job_templates"; list.fields.smart_status.ngInclude = "'/static/partials/organizations-job-template-smart-status.html'"; list.fields.name.ngHref = '#/templates/job_template/{{template.id}}'; - list.fieldActions.submit.ngClick = 'submitJob(template.id)'; list.fieldActions.schedule.ngClick = 'scheduleJob(template.id)'; list.fieldActions.copy.ngClick = 'copyTemplate(template.id)'; list.fieldActions.edit.ngClick = "editJobTemplate(template.id)"; diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index eeeb80d2f4..2df8eec05a 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -397,9 +397,7 @@ export default ['$compile', 'Attr', 'Icon', innerTable += `Pending Delete`; } // Plug in Dropdown Component - if (field_action === 'submit' && list.fieldActions[field_action].relaunch === true) { - innerTable += ``; - } else if (field_action === 'submit' && list.fieldActions[field_action].launch === true) { + if (field_action === 'submit') { innerTable += ``; } else { fAction = list.fieldActions[field_action]; diff --git a/awx/ui/client/src/templates/templates.list.js b/awx/ui/client/src/templates/templates.list.js index fba0d21ad3..17534209f2 100644 --- a/awx/ui/client/src/templates/templates.list.js +++ b/awx/ui/client/src/templates/templates.list.js @@ -77,12 +77,8 @@ export default ['i18n', function(i18n) { columnClass: 'col-lg-2 col-md-3 col-sm-4 col-xs-3', submit: { - label: i18n._('Launch'), - mode: 'all', - ngClick: 'submitJob(template)', - awToolTip: i18n._('Start a job using this template'), - dataPlacement: 'top', - ngShow: 'template.summary_fields.user_capabilities.start' + // The submit key lets the list generator know that we want to use the + // at-launch-template directive }, schedule: { label: i18n._('Schedule'),