Implemented generic prompt modal for launching and saving launch configurations. Added UI support for prompting on job template schedules.

This commit is contained in:
mabashian
2018-01-31 15:28:52 -05:00
parent e43879d44e
commit e57d200d6e
55 changed files with 2814 additions and 607 deletions
+21
View File
@@ -0,0 +1,21 @@
let Base;
function JobModel (method, resource, config) {
Base.call(this, 'jobs');
this.Constructor = JobModel;
return this.create(method, resource, config);
}
function JobModelLoader (BaseModel) {
Base = BaseModel;
return JobModel;
}
JobModelLoader.$inject = [
'BaseModel'
];
export default JobModelLoader;
+76 -2
View File
@@ -1,5 +1,69 @@
let Base;
let WorkflowJobTemplateNode;
let $http;
function optionsLaunch (id) {
const req = {
method: 'OPTIONS',
url: `${this.path}${id}/launch/`
};
return $http(req);
}
function getLaunch (id) {
const req = {
method: 'GET',
url: `${this.path}${id}/launch/`
};
return $http(req)
.then(res => {
this.model.launch.GET = res.data;
return res;
});
}
function postLaunch (params) {
const req = {
method: 'POST',
url: `${this.path}${params.id}/launch/`
};
if (params.launchData) {
req.data = params.launchData;
}
return $http(req);
}
function getSurveyQuestions (id) {
const req = {
method: 'GET',
url: `${this.path}${id}/survey_spec/`
};
return $http(req);
}
function canLaunchWithoutPrompt () {
const launchData = this.model.launch.GET;
return (
launchData.can_start_without_user_input &&
!launchData.ask_inventory_on_launch &&
!launchData.ask_credential_on_launch &&
!launchData.ask_verbosity_on_launch &&
!launchData.ask_job_type_on_launch &&
!launchData.ask_limit_on_launch &&
!launchData.ask_tags_on_launch &&
!launchData.ask_skip_tags_on_launch &&
!launchData.ask_variables_on_launch &&
!launchData.ask_diff_mode_on_launch &&
!launchData.survey_enabled
);
}
function setDependentResources (id) {
this.dependentResources = [
@@ -17,20 +81,30 @@ function JobTemplateModel (method, resource, config) {
this.Constructor = JobTemplateModel;
this.setDependentResources = setDependentResources.bind(this);
this.optionsLaunch = optionsLaunch.bind(this);
this.getLaunch = getLaunch.bind(this);
this.postLaunch = postLaunch.bind(this);
this.getSurveyQuestions = getSurveyQuestions.bind(this);
this.canLaunchWithoutPrompt = canLaunchWithoutPrompt.bind(this);
this.model.launch = {};
return this.create(method, resource, config);
}
function JobTemplateModelLoader (BaseModel, WorkflowJobTemplateNodeModel) {
function JobTemplateModelLoader (BaseModel, WorkflowJobTemplateNodeModel, _$http_) {
Base = BaseModel;
WorkflowJobTemplateNode = WorkflowJobTemplateNodeModel;
$http = _$http_;
return JobTemplateModel;
}
JobTemplateModelLoader.$inject = [
'BaseModel',
'WorkflowJobTemplateNodeModel'
'WorkflowJobTemplateNodeModel',
'$http',
'$state'
];
export default JobTemplateModelLoader;
+21
View File
@@ -0,0 +1,21 @@
let Base;
function WorkflowJobModel (method, resource, config) {
Base.call(this, 'workflow_jobs');
this.Constructor = WorkflowJobModel;
return this.create(method, resource, config);
}
function WorkflowJobModelLoader (BaseModel) {
Base = BaseModel;
return WorkflowJobModel;
}
WorkflowJobModelLoader.$inject = [
'BaseModel'
];
export default WorkflowJobModelLoader;
+6 -1
View File
@@ -12,6 +12,8 @@ import WorkflowJobTemplateNode from '~models/WorkflowJobTemplateNode';
import InventorySource from '~models/InventorySource';
import Inventory from '~models/Inventory';
import InventoryScript from '~models/InventoryScript';
import Job from '~models/Job';
import WorkflowJob from '~models/WorkflowJob';
import WorkflowJobTemplate from '~models/WorkflowJobTemplate';
import ModelsStrings from '~models/models.strings';
@@ -37,6 +39,9 @@ angular
.service('InventoryScriptModel', InventoryScript)
.service('WorkflowJobTemplateModel', WorkflowJobTemplate)
.service('ModelsStrings', ModelsStrings)
.service('UnifiedJobTemplateModel', UnifiedJobTemplate);
.service('UnifiedJobTemplateModel', UnifiedJobTemplate)
.service('JobModel', Job)
.service('WorkflowJobModel', WorkflowJob)
.service('WorkflowJobTemplateModel', WorkflowJobTemplate);
export default MODULE_NAME;