Complete removal of InitialPlaybookRun

This commit is contained in:
mabashian 2018-03-28 11:18:00 -04:00
parent 4740f90dc7
commit 767991fc2b
9 changed files with 19 additions and 50 deletions

View File

@ -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.')
};

View File

@ -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'));
}
};

View File

@ -1,6 +1,8 @@
<div class="at-LaunchTemplate">
<button class="at-LaunchTemplate--button"
ng-click="vm.startLaunchTemplate()">
ng-click="vm.startLaunchTemplate()"
aw-tool-tip="{{:: vm.strings.get('launchTemplate.DEFAULT') }}"
data-placement="top">
<i class="icon-launch"></i>
</button>
<prompt prompt-data="vm.promptData" on-finish="vm.launchTemplateWithPrompts()"></launch>

View File

@ -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( "<submit-job data-submit-job-id=" + id + " submit-job-type=" + job_type + " data-submit-job-relaunch=" + relaunch +
" relaunch-host-type=" + host_type +
"></submit-job>" )( scope );
$('#content-container').remove('submit-job').append( el );
};
}
InitiatePlaybookRun.$inject =
[ '$compile'
];

View File

@ -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)

View File

@ -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 });
};

View File

@ -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)";

View File

@ -397,9 +397,7 @@ export default ['$compile', 'Attr', 'Icon',
innerTable += `<a ng-if='${list.iterator}.pending_deletion'>Pending Delete</a>`;
}
// Plug in Dropdown Component
if (field_action === 'submit' && list.fieldActions[field_action].relaunch === true) {
innerTable += `<at-relaunch job="${list.iterator}"></at-relaunch>`;
} else if (field_action === 'submit' && list.fieldActions[field_action].launch === true) {
if (field_action === 'submit') {
innerTable += `<at-launch-template template="${list.iterator}" ng-if="${list.iterator}.summary_fields.user_capabilities.start"></at-launch-template>`;
} else {
fAction = list.fieldActions[field_action];

View File

@ -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'),