mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
WIP integration with smart-search
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
* @description This form is for adding/editing a Job
|
* @description This form is for adding/editing a Job
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @issue PLEASE KILL ME I NEED TO DIE
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('JobFormDefinition', [])
|
angular.module('JobFormDefinition', [])
|
||||||
.value('JobForm', {
|
.value('JobForm', {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default
|
|||||||
addTitle: '',
|
addTitle: '',
|
||||||
editTitle: '',
|
editTitle: '',
|
||||||
name: 'workflow_maker',
|
name: 'workflow_maker',
|
||||||
base: 'job_templates',
|
basePath: 'job_templates',
|
||||||
tabs: false,
|
tabs: false,
|
||||||
cancelButton: false,
|
cancelButton: false,
|
||||||
showHeader: false,
|
showHeader: false,
|
||||||
@@ -48,7 +48,9 @@ export default
|
|||||||
type: 'lookup',
|
type: 'lookup',
|
||||||
sourceModel: 'inventory',
|
sourceModel: 'inventory',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
ngClick: 'lookUpInventory()',
|
list: 'OrganizationList',
|
||||||
|
basePath: 'organization',
|
||||||
|
//ngClick: 'lookUpInventory()',
|
||||||
requiredErrorMsg: "Please select an Inventory.",
|
requiredErrorMsg: "Please select an Inventory.",
|
||||||
column: 1,
|
column: 1,
|
||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
@@ -56,10 +58,10 @@ export default
|
|||||||
dataTitle: 'Inventory',
|
dataTitle: 'Inventory',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body",
|
dataContainer: "body",
|
||||||
ngShow: "selectedTemplate.ask_inventory_on_launch",
|
//ngShow: "selectedTemplate.ask_inventory_on_launch",
|
||||||
awRequiredWhen: {
|
// awRequiredWhen: {
|
||||||
reqExpression: 'selectedTemplate.ask_inventory_on_launch'
|
// reqExpression: 'selectedTemplate.ask_inventory_on_launch'
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
job_type: {
|
job_type: {
|
||||||
label: 'Job Type',
|
label: 'Job Type',
|
||||||
|
|||||||
@@ -480,7 +480,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.openWorkflowMaker = function() {
|
$scope.openWorkflowMaker = function() {
|
||||||
$scope.$broadcast("showWorkflowMaker");
|
$state.go('.workflowMaker');
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.formSave = function () {
|
$scope.formSave = function () {
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ export default {
|
|||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: "TEMPLATES"
|
label: "TEMPLATES"
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
socket: {
|
||||||
|
"groups": {
|
||||||
|
"jobs": ["status_changed"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
params: {
|
params: {
|
||||||
unified_job_templates_search: {
|
unified_job_templates_search: {
|
||||||
value: {
|
value: {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
|
import { templateUrl } from '../shared/template-url/template-url.factory';
|
||||||
|
|
||||||
import jobTemplateService from './job-template.service';
|
import jobTemplateService from './job-template.service';
|
||||||
|
|
||||||
import surveyMaker from './survey-maker/main';
|
import surveyMaker from './survey-maker/main';
|
||||||
@@ -25,8 +27,9 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
])
|
])
|
||||||
.service('JobTemplateService', jobTemplateService)
|
.service('JobTemplateService', jobTemplateService)
|
||||||
.config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider',
|
.config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider',
|
||||||
function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider ) {
|
function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) {
|
||||||
let stateTree, addJobTemplate, editJobTemplate, addWorkflow, editWorkflow,
|
let stateTree, addJobTemplate, editJobTemplate, addWorkflow, editWorkflow,
|
||||||
|
workflowMaker, inventoryLookup, credentialLookup,
|
||||||
stateDefinitions = stateDefinitionsProvider.$get(),
|
stateDefinitions = stateDefinitionsProvider.$get(),
|
||||||
stateExtender = $stateExtenderProvider.$get();
|
stateExtender = $stateExtenderProvider.$get();
|
||||||
|
|
||||||
@@ -72,6 +75,103 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
workflowMaker = stateExtender.buildDefinition({
|
||||||
|
name: 'templates.editWorkflowJobTemplate.workflowMaker',
|
||||||
|
url: '/workflow-maker',
|
||||||
|
views: {
|
||||||
|
'modal': {
|
||||||
|
template: ` <workflow-maker ng-if="includeWorkflowMaker" tree-data="workflowTree"></workflow-maker>`
|
||||||
|
},
|
||||||
|
// 'jobsTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
|
// templateProvider: function(JobTemplateList, generateList) {
|
||||||
|
// let html = generateList.build({
|
||||||
|
// list: JobTemplateList,
|
||||||
|
// mode: 'edit'
|
||||||
|
// });
|
||||||
|
// return html;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'inventorySyncList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
|
// templateProvider: function(InventoryList, generateList) {
|
||||||
|
// let html = generateList.build({
|
||||||
|
// list: InventoryList,
|
||||||
|
// mode: 'edit'
|
||||||
|
// });
|
||||||
|
// return html;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// 'projectList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
|
// templateProvider: function(ProjectList, generateList) {
|
||||||
|
// let html = generateList.build({
|
||||||
|
// list: ProjectList,
|
||||||
|
// mode: 'edit'
|
||||||
|
// });
|
||||||
|
// return html;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
'workflowForm@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
|
templateProvider: function(WorkflowMakerForm, GenerateForm) {
|
||||||
|
let form = WorkflowMakerForm();
|
||||||
|
let html = GenerateForm.buildHTML(form, {
|
||||||
|
mode: 'add',
|
||||||
|
related: false,
|
||||||
|
});
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
inventoryLookup = stateExtender.buildDefinition({
|
||||||
|
searchPrefix: 'inventory',
|
||||||
|
//squashSearchUrl: true, @issue enable
|
||||||
|
name: 'templates.editWorkflowJobTemplate.workflowMaker.inventory',
|
||||||
|
url: '/inventory',
|
||||||
|
data: {
|
||||||
|
lookup: true
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
inventory_search: {
|
||||||
|
value: { page_size: '5'}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
views: {
|
||||||
|
'modal@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
|
templateProvider: function(ListDefinition, generateList) {
|
||||||
|
let list_html = generateList.build({
|
||||||
|
mode: 'lookup',
|
||||||
|
list: ListDefinition,
|
||||||
|
input_type: 'radio'
|
||||||
|
});
|
||||||
|
return `<lookup-modal>${list_html}</lookup-modal>`;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
// ListDefinition: [InventoryList, function(list) {
|
||||||
|
// list.iterator = field.sourceModel;
|
||||||
|
// return list;
|
||||||
|
// }],
|
||||||
|
Dataset: ['InventoryList', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||||
|
(list, qs, $stateParams, GetBasePath) => {
|
||||||
|
let path = GetBasePath(list.name) || GetBasePath(list.basePath);
|
||||||
|
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
onExit: function($state) {
|
||||||
|
if ($state.transition) {
|
||||||
|
$('#form-modal').modal('hide');
|
||||||
|
$('.modal-backdrop').remove();
|
||||||
|
$('body').removeClass('modal-open');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
addJobTemplate,
|
addJobTemplate,
|
||||||
editJobTemplate,
|
editJobTemplate,
|
||||||
@@ -82,8 +182,9 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
states: _.reduce(generated, (result, definition) => {
|
states: _.reduce(generated, (result, definition) => {
|
||||||
return result.concat(definition.states);
|
return result.concat(definition.states);
|
||||||
}, [
|
}, [
|
||||||
stateExtender.buildDefinition(jobTemplatesListRoute)
|
stateExtender.buildDefinition(jobTemplatesListRoute),
|
||||||
|
workflowMaker,
|
||||||
|
//inventoryLookup
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export default ['CreateDialog', 'Wait', '$q', function(CreateDialog, Wait, $q){
|
|||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
});
|
});
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
debugger;
|
||||||
CreateDialog({
|
CreateDialog({
|
||||||
id: 'workflow-modal-dialog',
|
id: 'workflow-modal-dialog',
|
||||||
scope: params.scope,
|
scope: params.scope,
|
||||||
|
|||||||
@@ -4,15 +4,14 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default
|
export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateList', 'ProjectList',
|
||||||
[ '$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateList', 'ProjectList',
|
'GetBasePath', 'Wait', 'JobTemplateService',
|
||||||
'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait', 'JobTemplateService',
|
|
||||||
'ProcessErrors', 'InventorySourcesList', 'CreateSelect2', 'WorkflowMakerForm',
|
'ProcessErrors', 'InventorySourcesList', 'CreateSelect2', 'WorkflowMakerForm',
|
||||||
'GenerateForm', 'LookUpInit', 'InventoryList', 'CredentialList', '$q', '$timeout',
|
'GenerateForm', 'InventoryList', 'CredentialList', '$q', '$timeout',
|
||||||
function($scope, WorkflowHelpService, GenerateList, JobTemplateList, ProjectList,
|
function($scope, WorkflowHelpService, GenerateList, JobTemplateList, ProjectList,
|
||||||
GetBasePath, SearchInit, PaginateInit, Wait, JobTemplateService,
|
GetBasePath, Wait, JobTemplateService,
|
||||||
ProcessErrors, InventorySourcesList, CreateSelect2, WorkflowMakerForm,
|
ProcessErrors, InventorySourcesList, CreateSelect2, WorkflowMakerForm,
|
||||||
GenerateForm, LookUpInit, InventoryList, CredentialList, $q, $timeout) {
|
GenerateForm, InventoryList, CredentialList, $q, $timeout) {
|
||||||
|
|
||||||
let form = WorkflowMakerForm(),
|
let form = WorkflowMakerForm(),
|
||||||
generator = GenerateForm;
|
generator = GenerateForm;
|
||||||
@@ -26,16 +25,13 @@ export default
|
|||||||
// Set the intial edge type to success
|
// Set the intial edge type to success
|
||||||
$scope.edgeType = "success";
|
$scope.edgeType = "success";
|
||||||
|
|
||||||
$scope.job_type_options = [
|
$scope.job_type_options = [{
|
||||||
{
|
|
||||||
label: "Run",
|
label: "Run",
|
||||||
value: "run"
|
value: "run"
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
label: "Check",
|
label: "Check",
|
||||||
value: "check"
|
value: "check"
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
|
|
||||||
let job_template_url = GetBasePath('job_templates');
|
let job_template_url = GetBasePath('job_templates');
|
||||||
// TODO: we won't be able to rely on this in the future for security purposes. Will need to come up
|
// TODO: we won't be able to rely on this in the future for security purposes. Will need to come up
|
||||||
@@ -45,64 +41,70 @@ export default
|
|||||||
//http://localhost:3000/api/v1/job_templates/?not__credential__vault_password=ASK¬__credential__password=ASK
|
//http://localhost:3000/api/v1/job_templates/?not__credential__vault_password=ASK¬__credential__password=ASK
|
||||||
|
|
||||||
// Set up the lists for the add/edit node form
|
// Set up the lists for the add/edit node form
|
||||||
let jobTemplatesList = _.cloneDeep(JobTemplateList);
|
// let jobTemplatesList = _.cloneDeep(JobTemplateList);
|
||||||
delete jobTemplatesList.fields.type;
|
// delete jobTemplatesList.fields.type;
|
||||||
delete jobTemplatesList.fields.description;
|
// delete jobTemplatesList.fields.description;
|
||||||
delete jobTemplatesList.fields.smart_status;
|
// delete jobTemplatesList.fields.smart_status;
|
||||||
delete jobTemplatesList.fields.labels;
|
// delete jobTemplatesList.fields.labels;
|
||||||
jobTemplatesList.fields.name.columnClass = "col-md-11";
|
// jobTemplatesList.fields.name.columnClass = "col-md-11";
|
||||||
jobTemplatesList.name = "workflow_job_templates";
|
// jobTemplatesList.name = "workflow_job_templates";
|
||||||
|
|
||||||
let project_url = GetBasePath('projects');
|
// let project_url = GetBasePath('projects');
|
||||||
|
|
||||||
let projectList = _.cloneDeep(ProjectList);
|
// let projectList = _.cloneDeep(ProjectList);
|
||||||
delete projectList.fields.status;
|
// delete projectList.fields.status;
|
||||||
delete projectList.fields.scm_type;
|
// delete projectList.fields.scm_type;
|
||||||
delete projectList.fields.last_updated;
|
// delete projectList.fields.last_updated;
|
||||||
projectList.fields.name.columnClass = "col-md-11";
|
// projectList.fields.name.columnClass = "col-md-11";
|
||||||
projectList.name = "workflow_projects";
|
// projectList.name = "workflow_projects";
|
||||||
|
|
||||||
let inventory_sources_url = GetBasePath('inventory_sources');
|
//let inventory_sources_url = GetBasePath('inventory_sources');
|
||||||
|
|
||||||
let inventorySourcesList = _.cloneDeep(InventorySourcesList);
|
//let inventorySourcesList = _.cloneDeep(InventorySourcesList);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
$scope.$watchCollection('workflow_job_templates', function () {
|
$scope.treeDataMaster = angular.copy($scope.treeData.data);
|
||||||
if($scope.selectedTemplate) {
|
WorkflowHelpService.openDialog({
|
||||||
|
scope: $scope
|
||||||
|
})
|
||||||
|
.then(function() {
|
||||||
|
|
||||||
|
//$scope.$broadcast("refreshWorkflowChart");
|
||||||
|
|
||||||
|
});
|
||||||
|
$scope.$watchCollection('workflow_job_templates', function() {
|
||||||
|
if ($scope.selectedTemplate) {
|
||||||
// Loop across the inventories and see if one of them should be "checked"
|
// Loop across the inventories and see if one of them should be "checked"
|
||||||
$scope.workflow_job_templates.forEach(function(row, i) {
|
$scope.workflow_job_templates.forEach(function(row, i) {
|
||||||
if (row.id === $scope.selectedTemplate.id) {
|
if (row.id === $scope.selectedTemplate.id) {
|
||||||
$scope.workflow_job_templates[i].checked = 1;
|
$scope.workflow_job_templates[i].checked = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.workflow_job_templates[i].checked = 0;
|
$scope.workflow_job_templates[i].checked = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watchCollection('workflow_projects', function () {
|
$scope.$watchCollection('workflow_projects', function() {
|
||||||
if($scope.selectedTemplate) {
|
if ($scope.selectedTemplate) {
|
||||||
// Loop across the inventories and see if one of them should be "checked"
|
// Loop across the inventories and see if one of them should be "checked"
|
||||||
$scope.workflow_projects.forEach(function(row, i) {
|
$scope.workflow_projects.forEach(function(row, i) {
|
||||||
if (row.id === $scope.selectedTemplate.id) {
|
if (row.id === $scope.selectedTemplate.id) {
|
||||||
$scope.workflow_projects[i].checked = 1;
|
$scope.workflow_projects[i].checked = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.workflow_projects[i].checked = 0;
|
$scope.workflow_projects[i].checked = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watchCollection('workflow_inventory_sources', function () {
|
$scope.$watchCollection('workflow_inventory_sources', function() {
|
||||||
if($scope.selectedTemplate) {
|
if ($scope.selectedTemplate) {
|
||||||
// Loop across the inventories and see if one of them should be "checked"
|
// Loop across the inventories and see if one of them should be "checked"
|
||||||
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
||||||
if (row.id === $scope.selectedTemplate.id) {
|
if (row.id === $scope.selectedTemplate.id) {
|
||||||
$scope.workflow_inventory_sources[i].checked = 1;
|
$scope.workflow_inventory_sources[i].checked = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.workflow_inventory_sources[i].checked = 0;
|
$scope.workflow_inventory_sources[i].checked = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -110,10 +112,9 @@ export default
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watchGroup(['selectedTemplate', 'edgeType'], function() {
|
$scope.$watchGroup(['selectedTemplate', 'edgeType'], function() {
|
||||||
if($scope.selectedTemplate && $scope.edgeType) {
|
if ($scope.selectedTemplate && $scope.edgeType) {
|
||||||
$scope.workflowMakerFormConfig.formIsValid = true;
|
$scope.workflowMakerFormConfig.formIsValid = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.workflowMakerFormConfig.formIsValid = false;
|
$scope.workflowMakerFormConfig.formIsValid = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -148,64 +149,6 @@ export default
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadJobTemplates() {
|
|
||||||
SearchInit({
|
|
||||||
scope: $scope,
|
|
||||||
set: jobTemplatesList.name,
|
|
||||||
list: jobTemplatesList,
|
|
||||||
url: job_template_url
|
|
||||||
});
|
|
||||||
|
|
||||||
PaginateInit({
|
|
||||||
scope: $scope,
|
|
||||||
list: jobTemplatesList,
|
|
||||||
url: job_template_url,
|
|
||||||
mode: 'lookup',
|
|
||||||
pageSize: 5
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.search(JobTemplateList.iterator);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadProjects() {
|
|
||||||
SearchInit({
|
|
||||||
scope: $scope,
|
|
||||||
set: projectList.name,
|
|
||||||
list: projectList,
|
|
||||||
url: project_url
|
|
||||||
});
|
|
||||||
|
|
||||||
PaginateInit({
|
|
||||||
scope: $scope,
|
|
||||||
list: projectList,
|
|
||||||
url: project_url,
|
|
||||||
mode: 'lookup',
|
|
||||||
pageSize: 5
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.search(ProjectList.iterator);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function loadInventorySources() {
|
|
||||||
SearchInit({
|
|
||||||
scope: $scope,
|
|
||||||
set: inventorySourcesList.name,
|
|
||||||
list: inventorySourcesList,
|
|
||||||
url: inventory_sources_url
|
|
||||||
});
|
|
||||||
|
|
||||||
PaginateInit({
|
|
||||||
scope: $scope,
|
|
||||||
list: inventorySourcesList,
|
|
||||||
url: inventory_sources_url,
|
|
||||||
mode: 'lookup',
|
|
||||||
pageSize: 5
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.search(InventorySourcesList.iterator);
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.closeWorkflowMaker = function() {
|
$scope.closeWorkflowMaker = function() {
|
||||||
// Revert the data to the master which was created when the dialog was opened
|
// Revert the data to the master which was created when the dialog was opened
|
||||||
$scope.treeData.data = angular.copy($scope.treeDataMaster);
|
$scope.treeData.data = angular.copy($scope.treeDataMaster);
|
||||||
@@ -220,7 +163,7 @@ export default
|
|||||||
|
|
||||||
$scope.startAddNode = function(parent, betweenTwoNodes) {
|
$scope.startAddNode = function(parent, betweenTwoNodes) {
|
||||||
|
|
||||||
if($scope.placeholderNode || $scope.nodeBeingEdited) {
|
if ($scope.placeholderNode || $scope.nodeBeingEdited) {
|
||||||
$scope.cancelNodeForm();
|
$scope.cancelNodeForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,30 +180,23 @@ export default
|
|||||||
|
|
||||||
$scope.treeData.nextIndex++;
|
$scope.treeData.nextIndex++;
|
||||||
|
|
||||||
loadJobTemplates();
|
|
||||||
loadProjects();
|
|
||||||
loadInventorySources();
|
|
||||||
|
|
||||||
let siblingConnectionTypes = WorkflowHelpService.getSiblingConnectionTypes({
|
let siblingConnectionTypes = WorkflowHelpService.getSiblingConnectionTypes({
|
||||||
tree: $scope.treeData.data,
|
tree: $scope.treeData.data,
|
||||||
parentId: betweenTwoNodes ? parent.source.id : parent.id
|
parentId: betweenTwoNodes ? parent.source.id : parent.id
|
||||||
});
|
});
|
||||||
|
|
||||||
if(parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
|
if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
|
||||||
// We don't want to give the user the option to select
|
// We don't want to give the user the option to select
|
||||||
// a type as this node will always be executed
|
// a type as this node will always be executed
|
||||||
$scope.edgeType = "always";
|
$scope.edgeType = "always";
|
||||||
$scope.showTypeOptions = false;
|
$scope.showTypeOptions = false;
|
||||||
}
|
} else {
|
||||||
else {
|
if ((_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) && _.includes(siblingConnectionTypes, "always")) {
|
||||||
if((_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) && _.includes(siblingConnectionTypes, "always")) {
|
|
||||||
// This is a problem...
|
// This is a problem...
|
||||||
}
|
} else if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
|
||||||
else if(_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
|
|
||||||
$scope.edgeTypeRestriction = "successFailure";
|
$scope.edgeTypeRestriction = "successFailure";
|
||||||
$scope.edgeType = "success";
|
$scope.edgeType = "success";
|
||||||
}
|
} else if (_.includes(siblingConnectionTypes, "always")) {
|
||||||
else if(_.includes(siblingConnectionTypes, "always")) {
|
|
||||||
$scope.edgeTypeRestriction = "always";
|
$scope.edgeTypeRestriction = "always";
|
||||||
$scope.edgeType = "always";
|
$scope.edgeType = "always";
|
||||||
}
|
}
|
||||||
@@ -273,12 +209,12 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.confirmNodeForm = function() {
|
$scope.confirmNodeForm = function() {
|
||||||
if($scope.workflowMakerFormConfig.nodeMode === "add") {
|
if ($scope.workflowMakerFormConfig.nodeMode === "add") {
|
||||||
if($scope.selectedTemplate && $scope.edgeType) {
|
if ($scope.selectedTemplate && $scope.edgeType) {
|
||||||
|
|
||||||
$scope.placeholderNode.unifiedJobTemplate = $scope.selectedTemplate;
|
$scope.placeholderNode.unifiedJobTemplate = $scope.selectedTemplate;
|
||||||
$scope.placeholderNode.edgeType = $scope.edgeType;
|
$scope.placeholderNode.edgeType = $scope.edgeType;
|
||||||
if($scope.placeholderNode.unifiedJobTemplate.type === 'job_template') {
|
if ($scope.placeholderNode.unifiedJobTemplate.type === 'job_template') {
|
||||||
$scope.placeholderNode.promptValues = {
|
$scope.placeholderNode.promptValues = {
|
||||||
credential: {
|
credential: {
|
||||||
id: $scope.credential,
|
id: $scope.credential,
|
||||||
@@ -304,13 +240,12 @@ export default
|
|||||||
$scope.treeData.data.totalNodes++;
|
$scope.treeData.data.totalNodes++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else if ($scope.workflowMakerFormConfig.nodeMode === "edit") {
|
||||||
else if($scope.workflowMakerFormConfig.nodeMode === "edit") {
|
if ($scope.selectedTemplate && $scope.edgeType) {
|
||||||
if($scope.selectedTemplate && $scope.edgeType) {
|
|
||||||
$scope.nodeBeingEdited.unifiedJobTemplate = $scope.selectedTemplate;
|
$scope.nodeBeingEdited.unifiedJobTemplate = $scope.selectedTemplate;
|
||||||
$scope.nodeBeingEdited.edgeType = $scope.edgeType;
|
$scope.nodeBeingEdited.edgeType = $scope.edgeType;
|
||||||
|
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.type === 'job_template') {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.type === 'job_template') {
|
||||||
$scope.nodeBeingEdited.promptValues = {
|
$scope.nodeBeingEdited.promptValues = {
|
||||||
credential: {
|
credential: {
|
||||||
id: $scope.credential,
|
id: $scope.credential,
|
||||||
@@ -339,14 +274,13 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.cancelNodeForm = function() {
|
$scope.cancelNodeForm = function() {
|
||||||
if($scope.workflowMakerFormConfig.nodeMode === "add") {
|
if ($scope.workflowMakerFormConfig.nodeMode === "add") {
|
||||||
// Remove the placeholder node from the tree
|
// Remove the placeholder node from the tree
|
||||||
WorkflowHelpService.removeNodeFromTree({
|
WorkflowHelpService.removeNodeFromTree({
|
||||||
tree: $scope.treeData.data,
|
tree: $scope.treeData.data,
|
||||||
nodeToBeDeleted: $scope.placeholderNode
|
nodeToBeDeleted: $scope.placeholderNode
|
||||||
});
|
});
|
||||||
}
|
} else if ($scope.workflowMakerFormConfig.nodeMode === "edit") {
|
||||||
else if($scope.workflowMakerFormConfig.nodeMode === "edit") {
|
|
||||||
$scope.nodeBeingEdited.isActiveEdit = false;
|
$scope.nodeBeingEdited.isActiveEdit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,8 +294,8 @@ export default
|
|||||||
|
|
||||||
$scope.startEditNode = function(nodeToEdit) {
|
$scope.startEditNode = function(nodeToEdit) {
|
||||||
|
|
||||||
if(!$scope.nodeBeingEdited || ($scope.nodeBeingEdited && $scope.nodeBeingEdited.id !== nodeToEdit.id)) {
|
if (!$scope.nodeBeingEdited || ($scope.nodeBeingEdited && $scope.nodeBeingEdited.id !== nodeToEdit.id)) {
|
||||||
if($scope.placeholderNode || $scope.nodeBeingEdited) {
|
if ($scope.placeholderNode || $scope.nodeBeingEdited) {
|
||||||
$scope.cancelNodeForm();
|
$scope.cancelNodeForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,53 +316,46 @@ export default
|
|||||||
let finishConfiguringEdit = function() {
|
let finishConfiguringEdit = function() {
|
||||||
|
|
||||||
// build any prompt values
|
// build any prompt values
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_credential_on_launch) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_credential_on_launch) {
|
||||||
if($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.credential) {
|
if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.credential) {
|
||||||
$scope.credential_name = $scope.nodeBeingEdited.promptValues.credential.name;
|
$scope.credential_name = $scope.nodeBeingEdited.promptValues.credential.name;
|
||||||
$scope.credentiial = $scope.nodeBeingEdited.promptValues.credential.id;
|
$scope.credentiial = $scope.nodeBeingEdited.promptValues.credential.id;
|
||||||
}
|
} else if ($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential) {
|
||||||
else if($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential) {
|
|
||||||
$scope.credential_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name : null;
|
$scope.credential_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name : null;
|
||||||
$scope.credential = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id : null;
|
$scope.credential = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id : null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.credential_name = null;
|
$scope.credential_name = null;
|
||||||
$scope.credential = null;
|
$scope.credential = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_inventory_on_launch) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_inventory_on_launch) {
|
||||||
if($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.inventory) {
|
if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.inventory) {
|
||||||
$scope.inventory_name = $scope.nodeBeingEdited.promptValues.inventory.name;
|
$scope.inventory_name = $scope.nodeBeingEdited.promptValues.inventory.name;
|
||||||
$scope.inventory = $scope.nodeBeingEdited.promptValues.inventory.id;
|
$scope.inventory = $scope.nodeBeingEdited.promptValues.inventory.id;
|
||||||
}
|
} else if ($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory) {
|
||||||
else if($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory) {
|
|
||||||
$scope.inventory_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name : null;
|
$scope.inventory_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name : null;
|
||||||
$scope.inventory = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id : null;
|
$scope.inventory = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id : null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.inventory_name = null;
|
$scope.inventory_name = null;
|
||||||
$scope.inventory = null;
|
$scope.inventory = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_job_type_on_launch) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_job_type_on_launch) {
|
||||||
if($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.job_type) {
|
if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.job_type) {
|
||||||
$scope.job_type = {
|
$scope.job_type = {
|
||||||
value: $scope.nodeBeingEdited.promptValues.job_type
|
value: $scope.nodeBeingEdited.promptValues.job_type
|
||||||
};
|
};
|
||||||
}
|
} else if ($scope.nodeBeingEdited.originalNodeObj.job_type) {
|
||||||
else if($scope.nodeBeingEdited.originalNodeObj.job_type) {
|
|
||||||
$scope.job_type = {
|
$scope.job_type = {
|
||||||
value: $scope.nodeBeingEdited.originalNodeObj.job_type
|
value: $scope.nodeBeingEdited.originalNodeObj.job_type
|
||||||
};
|
};
|
||||||
}
|
} else if ($scope.nodeBeingEdited.unifiedJobTemplate.job_type) {
|
||||||
else if($scope.nodeBeingEdited.unifiedJobTemplate.job_type) {
|
|
||||||
$scope.job_type = {
|
$scope.job_type = {
|
||||||
value: $scope.nodeBeingEdited.unifiedJobTemplate.job_type
|
value: $scope.nodeBeingEdited.unifiedJobTemplate.job_type
|
||||||
};
|
};
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.job_type = {
|
$scope.job_type = {
|
||||||
value: null
|
value: null
|
||||||
};
|
};
|
||||||
@@ -443,56 +370,47 @@ export default
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_limit_on_launch) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_limit_on_launch) {
|
||||||
if($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.limit === 'string') {
|
if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.limit === 'string') {
|
||||||
$scope.limit = $scope.nodeBeingEdited.promptValues.limit;
|
$scope.limit = $scope.nodeBeingEdited.promptValues.limit;
|
||||||
}
|
} else if (typeof $scope.nodeBeingEdited.originalNodeObj.limit === 'string') {
|
||||||
else if(typeof $scope.nodeBeingEdited.originalNodeObj.limit === 'string') {
|
|
||||||
$scope.limit = $scope.nodeBeingEdited.originalNodeObj.limit;
|
$scope.limit = $scope.nodeBeingEdited.originalNodeObj.limit;
|
||||||
}
|
} else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.limit === 'string') {
|
||||||
else if(typeof $scope.nodeBeingEdited.unifiedJobTemplate.limit === 'string') {
|
|
||||||
$scope.limit = $scope.nodeBeingEdited.unifiedJobTemplate.limit;
|
$scope.limit = $scope.nodeBeingEdited.unifiedJobTemplate.limit;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.limit = null;
|
$scope.limit = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_skip_tags_on_launch) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_skip_tags_on_launch) {
|
||||||
if($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.skip_tags === 'string') {
|
if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.skip_tags === 'string') {
|
||||||
$scope.skip_tags = $scope.nodeBeingEdited.promptValues.skip_tags;
|
$scope.skip_tags = $scope.nodeBeingEdited.promptValues.skip_tags;
|
||||||
}
|
} else if (typeof $scope.nodeBeingEdited.originalNodeObj.skip_tags === 'string') {
|
||||||
else if(typeof $scope.nodeBeingEdited.originalNodeObj.skip_tags === 'string') {
|
|
||||||
$scope.skip_tags = $scope.nodeBeingEdited.originalNodeObj.skip_tags;
|
$scope.skip_tags = $scope.nodeBeingEdited.originalNodeObj.skip_tags;
|
||||||
}
|
} else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags === 'string') {
|
||||||
else if(typeof $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags === 'string') {
|
|
||||||
$scope.skip_tags = $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags;
|
$scope.skip_tags = $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.skip_tags = null;
|
$scope.skip_tags = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_tags_on_launch) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_tags_on_launch) {
|
||||||
if($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.job_tags === 'string') {
|
if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.job_tags === 'string') {
|
||||||
$scope.job_tags = $scope.nodeBeingEdited.promptValues.job_tags;
|
$scope.job_tags = $scope.nodeBeingEdited.promptValues.job_tags;
|
||||||
}
|
} else if (typeof $scope.nodeBeingEdited.originalNodeObj.job_tags === 'string') {
|
||||||
else if(typeof $scope.nodeBeingEdited.originalNodeObj.job_tags === 'string') {
|
|
||||||
$scope.job_tags = $scope.nodeBeingEdited.originalNodeObj.job_tags;
|
$scope.job_tags = $scope.nodeBeingEdited.originalNodeObj.job_tags;
|
||||||
}
|
} else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.job_tags === 'string') {
|
||||||
else if(typeof $scope.nodeBeingEdited.unifiedJobTemplate.job_tags === 'string') {
|
|
||||||
$scope.job_tags = $scope.nodeBeingEdited.unifiedJobTemplate.job_tags;
|
$scope.job_tags = $scope.nodeBeingEdited.unifiedJobTemplate.job_tags;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.job_tags = null;
|
$scope.job_tags = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.type === "job_template") {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.type === "job_template") {
|
||||||
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.selectedTemplate = $scope.nodeBeingEdited.unifiedJobTemplate;
|
$scope.selectedTemplate = $scope.nodeBeingEdited.unifiedJobTemplate;
|
||||||
|
|
||||||
switch($scope.nodeBeingEdited.unifiedJobTemplate.type) {
|
switch ($scope.nodeBeingEdited.unifiedJobTemplate.type) {
|
||||||
case "job_template":
|
case "job_template":
|
||||||
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
||||||
break;
|
break;
|
||||||
@@ -504,10 +422,6 @@ export default
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadJobTemplates();
|
|
||||||
loadProjects();
|
|
||||||
loadInventorySources();
|
|
||||||
|
|
||||||
$scope.edgeType = $scope.nodeBeingEdited.edgeType;
|
$scope.edgeType = $scope.nodeBeingEdited.edgeType;
|
||||||
$scope.showTypeOptions = (parent && parent.isStartNode) ? false : true;
|
$scope.showTypeOptions = (parent && parent.isStartNode) ? false : true;
|
||||||
|
|
||||||
@@ -517,12 +431,12 @@ export default
|
|||||||
// Determine whether or not we need to go out and GET this nodes unified job template
|
// Determine whether or not we need to go out and GET this nodes unified job template
|
||||||
// in order to determine whether or not prompt fields are needed
|
// in order to determine whether or not prompt fields are needed
|
||||||
|
|
||||||
if(!$scope.nodeBeingEdited.isNew && !$scope.nodeBeingEdited.edited && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type === 'job') {
|
if (!$scope.nodeBeingEdited.isNew && !$scope.nodeBeingEdited.edited && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type === 'job') {
|
||||||
// This is a node that we got back from the api with an incomplete
|
// This is a node that we got back from the api with an incomplete
|
||||||
// unified job template so we're going to pull down the whole object
|
// unified job template so we're going to pull down the whole object
|
||||||
|
|
||||||
JobTemplateService.getUnifiedJobTemplate($scope.nodeBeingEdited.unifiedJobTemplate.id)
|
JobTemplateService.getUnifiedJobTemplate($scope.nodeBeingEdited.unifiedJobTemplate.id)
|
||||||
.then(function(data){
|
.then(function(data) {
|
||||||
|
|
||||||
$scope.nodeBeingEdited.unifiedJobTemplate = _.clone(data.data.results[0]);
|
$scope.nodeBeingEdited.unifiedJobTemplate = _.clone(data.data.results[0]);
|
||||||
|
|
||||||
@@ -530,19 +444,19 @@ export default
|
|||||||
let retrievingCredential = false;
|
let retrievingCredential = false;
|
||||||
let retrievingInventory = false;
|
let retrievingInventory = false;
|
||||||
|
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_credential_on_launch && $scope.nodeBeingEdited.originalNodeObj.credential) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_credential_on_launch && $scope.nodeBeingEdited.originalNodeObj.credential) {
|
||||||
defers.push(JobTemplateService.getCredential($scope.nodeBeingEdited.originalNodeObj.credential));
|
defers.push(JobTemplateService.getCredential($scope.nodeBeingEdited.originalNodeObj.credential));
|
||||||
retrievingCredential = true;
|
retrievingCredential = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.nodeBeingEdited.unifiedJobTemplate.ask_inventory_on_launch && $scope.nodeBeingEdited.originalNodeObj.inventory) {
|
if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_inventory_on_launch && $scope.nodeBeingEdited.originalNodeObj.inventory) {
|
||||||
defers.push(JobTemplateService.getInventory($scope.nodeBeingEdited.originalNodeObj.inventory));
|
defers.push(JobTemplateService.getInventory($scope.nodeBeingEdited.originalNodeObj.inventory));
|
||||||
retrievingInventory = true;
|
retrievingInventory = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$q.all(defers)
|
$q.all(defers)
|
||||||
.then(function(responses) {
|
.then(function(responses) {
|
||||||
if(retrievingCredential) {
|
if (retrievingCredential) {
|
||||||
$scope.credential = responses[0].data.id;
|
$scope.credential = responses[0].data.id;
|
||||||
$scope.credential_name = responses[0].data.name;
|
$scope.credential_name = responses[0].data.name;
|
||||||
$scope.nodeBeingEdited.promptValues.credential = {
|
$scope.nodeBeingEdited.promptValues.credential = {
|
||||||
@@ -550,7 +464,7 @@ export default
|
|||||||
id: responses[0].data.id
|
id: responses[0].data.id
|
||||||
};
|
};
|
||||||
|
|
||||||
if(retrievingInventory) {
|
if (retrievingInventory) {
|
||||||
$scope.inventory = responses[1].data.id;
|
$scope.inventory = responses[1].data.id;
|
||||||
$scope.inventory_name = responses[1].data.name;
|
$scope.inventory_name = responses[1].data.name;
|
||||||
$scope.nodeBeingEdited.promptValues.inventory = {
|
$scope.nodeBeingEdited.promptValues.inventory = {
|
||||||
@@ -558,8 +472,7 @@ export default
|
|||||||
id: responses[1].data.id
|
id: responses[1].data.id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
} else if (retrievingInventory) {
|
||||||
else if(retrievingInventory) {
|
|
||||||
$scope.inventory = responses[0].data.id;
|
$scope.inventory = responses[0].data.id;
|
||||||
$scope.inventory_name = responses[0].data.name;
|
$scope.inventory_name = responses[0].data.name;
|
||||||
$scope.nodeBeingEdited.promptValues.inventory = {
|
$scope.nodeBeingEdited.promptValues.inventory = {
|
||||||
@@ -578,8 +491,7 @@ export default
|
|||||||
'status: ' + error.status
|
'status: ' + error.status
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
finishConfiguringEdit();
|
finishConfiguringEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,7 +516,7 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.confirmDeleteNode = function() {
|
$scope.confirmDeleteNode = function() {
|
||||||
if($scope.nodeToBeDeleted) {
|
if ($scope.nodeToBeDeleted) {
|
||||||
|
|
||||||
// TODO: turn this into a promise so that we can handle errors
|
// TODO: turn this into a promise so that we can handle errors
|
||||||
|
|
||||||
@@ -613,11 +525,11 @@ export default
|
|||||||
nodeToBeDeleted: $scope.nodeToBeDeleted
|
nodeToBeDeleted: $scope.nodeToBeDeleted
|
||||||
});
|
});
|
||||||
|
|
||||||
if($scope.nodeToBeDeleted.isNew !== true) {
|
if ($scope.nodeToBeDeleted.isNew !== true) {
|
||||||
$scope.treeData.data.deletedNodes.push($scope.nodeToBeDeleted.nodeId);
|
$scope.treeData.data.deletedNodes.push($scope.nodeToBeDeleted.nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.nodeToBeDeleted.isActiveEdit) {
|
if ($scope.nodeToBeDeleted.isActiveEdit) {
|
||||||
resetNodeForm();
|
resetNodeForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,7 +543,7 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggleFormTab = function(tab) {
|
$scope.toggleFormTab = function(tab) {
|
||||||
if($scope.workflowMakerFormConfig.activeTab !== tab) {
|
if ($scope.workflowMakerFormConfig.activeTab !== tab) {
|
||||||
$scope.workflowMakerFormConfig.activeTab = tab;
|
$scope.workflowMakerFormConfig.activeTab = tab;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -649,29 +561,27 @@ export default
|
|||||||
$scope.workflow_job_templates.forEach(function(row, i) {
|
$scope.workflow_job_templates.forEach(function(row, i) {
|
||||||
if (row.id === id) {
|
if (row.id === id) {
|
||||||
$scope.selectedTemplate = angular.copy(row);
|
$scope.selectedTemplate = angular.copy(row);
|
||||||
if($scope.selectedTemplate.ask_credential_on_launch) {
|
if ($scope.selectedTemplate.ask_credential_on_launch) {
|
||||||
if($scope.selectedTemplate.summary_fields.credential) {
|
if ($scope.selectedTemplate.summary_fields.credential) {
|
||||||
$scope.credential_name = $scope.selectedTemplate.summary_fields.credential.name ? $scope.selectedTemplate.summary_fields.credential.name : null;
|
$scope.credential_name = $scope.selectedTemplate.summary_fields.credential.name ? $scope.selectedTemplate.summary_fields.credential.name : null;
|
||||||
$scope.credential = $scope.selectedTemplate.summary_fields.credential.id ? $scope.selectedTemplate.summary_fields.credential.id : null;
|
$scope.credential = $scope.selectedTemplate.summary_fields.credential.id ? $scope.selectedTemplate.summary_fields.credential.id : null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.credential_name = null;
|
$scope.credential_name = null;
|
||||||
$scope.credential = null;
|
$scope.credential = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.selectedTemplate.ask_inventory_on_launch) {
|
if ($scope.selectedTemplate.ask_inventory_on_launch) {
|
||||||
if($scope.selectedTemplate.summary_fields.inventory) {
|
if ($scope.selectedTemplate.summary_fields.inventory) {
|
||||||
$scope.inventory_name = $scope.selectedTemplate.summary_fields.inventory.name ? $scope.selectedTemplate.summary_fields.inventory.name : null;
|
$scope.inventory_name = $scope.selectedTemplate.summary_fields.inventory.name ? $scope.selectedTemplate.summary_fields.inventory.name : null;
|
||||||
$scope.inventory = $scope.selectedTemplate.summary_fields.inventory.id ? $scope.selectedTemplate.summary_fields.inventory.id : null;
|
$scope.inventory = $scope.selectedTemplate.summary_fields.inventory.id ? $scope.selectedTemplate.summary_fields.inventory.id : null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.inventory_name = null;
|
$scope.inventory_name = null;
|
||||||
$scope.inventory = null;
|
$scope.inventory = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.selectedTemplate.ask_job_type_on_launch) {
|
if ($scope.selectedTemplate.ask_job_type_on_launch) {
|
||||||
$scope.job_type = {
|
$scope.job_type = {
|
||||||
value: $scope.selectedTemplate.job_type ? $scope.selectedTemplate.job_type : null
|
value: $scope.selectedTemplate.job_type ? $scope.selectedTemplate.job_type : null
|
||||||
};
|
};
|
||||||
@@ -683,15 +593,15 @@ export default
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.selectedTemplate.ask_limit_on_launch) {
|
if ($scope.selectedTemplate.ask_limit_on_launch) {
|
||||||
$scope.limit = $scope.selectedTemplate.limit ? $scope.selectedTemplate.limit : null;
|
$scope.limit = $scope.selectedTemplate.limit ? $scope.selectedTemplate.limit : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.selectedTemplate.ask_skip_tags_on_launch) {
|
if ($scope.selectedTemplate.ask_skip_tags_on_launch) {
|
||||||
$scope.skip_tags = $scope.selectedTemplate.skip_tags ? $scope.selectedTemplate.skip_tags : null;
|
$scope.skip_tags = $scope.selectedTemplate.skip_tags ? $scope.selectedTemplate.skip_tags : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.selectedTemplate.ask_tags_on_launch) {
|
if ($scope.selectedTemplate.ask_tags_on_launch) {
|
||||||
$scope.job_tags = $scope.selectedTemplate.job_tags ? $scope.selectedTemplate.job_tags : null;
|
$scope.job_tags = $scope.selectedTemplate.job_tags ? $scope.selectedTemplate.job_tags : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,66 +659,7 @@ export default
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on('showWorkflowMaker', function(){
|
|
||||||
$scope.treeDataMaster = angular.copy($scope.treeData.data);
|
|
||||||
WorkflowHelpService.openDialog({
|
|
||||||
scope: $scope
|
|
||||||
})
|
|
||||||
.then(function(){
|
|
||||||
|
|
||||||
$scope.$broadcast("refreshWorkflowChart");
|
|
||||||
|
|
||||||
generator.inject(form, {
|
|
||||||
mode: 'add',
|
|
||||||
related: false,
|
|
||||||
scope: $scope,
|
|
||||||
id: 'workflow-maker-form'
|
|
||||||
});
|
|
||||||
|
|
||||||
LookUpInit({
|
|
||||||
scope: $scope,
|
|
||||||
form: form,
|
|
||||||
list: InventoryList,
|
|
||||||
field: 'inventory',
|
|
||||||
input_type: "radio"
|
|
||||||
});
|
|
||||||
|
|
||||||
LookUpInit({
|
|
||||||
url: GetBasePath('credentials') + '?kind=ssh',
|
|
||||||
scope: $scope,
|
|
||||||
form: form,
|
|
||||||
current_item: null,
|
|
||||||
list: CredentialList,
|
|
||||||
field: 'credential',
|
|
||||||
hdr: 'Select Machine Credential',
|
|
||||||
input_type: "radio"
|
|
||||||
});
|
|
||||||
|
|
||||||
GenerateList.inject(jobTemplatesList, {
|
|
||||||
mode: 'lookup',
|
|
||||||
id: 'workflow-jobs-list',
|
|
||||||
scope: $scope,
|
|
||||||
input_type: 'radio'
|
|
||||||
});
|
|
||||||
|
|
||||||
GenerateList.inject(projectList, {
|
|
||||||
mode: 'lookup',
|
|
||||||
id: 'workflow-project-sync-list',
|
|
||||||
scope: $scope,
|
|
||||||
input_type: 'radio'
|
|
||||||
});
|
|
||||||
|
|
||||||
GenerateList.inject(inventorySourcesList, {
|
|
||||||
mode: 'lookup',
|
|
||||||
id: 'workflow-inventory-sync-list',
|
|
||||||
scope: $scope,
|
|
||||||
input_type: 'radio'
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default [ 'templateUrl',
|
|||||||
},
|
},
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: templateUrl('job-templates/workflow-maker/workflow-maker'),
|
templateUrl: templateUrl('job-templates/workflow-maker/workflow-maker'),
|
||||||
controller: workflowMakerController
|
controller: workflowMakerController,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -60,21 +60,23 @@
|
|||||||
<span class="badge List-titleBadge" ng-bind="treeData.data.totalNodes"></span>
|
<span class="badge List-titleBadge" ng-bind="treeData.data.totalNodes"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--
|
||||||
<workflow-chart tree-data="treeData.data" add-node="startAddNode(parent, betweenTwoNodes)" edit-node="startEditNode(nodeToEdit)" delete-node="startDeleteNode(nodeToDelete)" class="WorkflowMaker-chart"></workflow-chart>
|
<workflow-chart tree-data="treeData.data" add-node="startAddNode(parent, betweenTwoNodes)" edit-node="startEditNode(nodeToEdit)" delete-node="startDeleteNode(nodeToDelete)" class="WorkflowMaker-chart"></workflow-chart>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
<div class="WorkflowMaker-contentRight">
|
<div class="WorkflowMaker-contentRight">
|
||||||
<div class="WorkflowMaker-formTitle">{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited && nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "ADD A TEMPLATE"}}</div>
|
<div class="WorkflowMaker-formTitle">{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited && nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "ADD A TEMPLATE"}}</div>
|
||||||
<div class="WorkflowMaker-formHelp" ng-show="workflowMakerFormConfig.nodeMode === 'idle'">Please hover over a template and click the Add button.</div>
|
<div class="WorkflowMaker-formHelp" ng-show="workflowMakerFormConfig.nodeMode === 'idle'">Please hover over a template and click the Add button.</div>
|
||||||
<div class="WorkflowMaker-form" ng-show="workflowMakerFormConfig.nodeMode === 'add' || workflowMakerFormConfig.nodeMode === 'edit'">
|
<div class="WorkflowMaker-form" > <!-- ng-show="workflowMakerFormConfig.nodeMode === 'add' || workflowMakerFormConfig.nodeMode === 'edit'" -->
|
||||||
<div class="Form-tabHolder">
|
<div class="Form-tabHolder">
|
||||||
<div class="Form-tab" ng-class="{'is-selected': workflowMakerFormConfig.activeTab === 'jobs'}" ng-click="toggleFormTab('jobs')">JOBS</div>
|
<div class="Form-tab" ng-class="{'is-selected': workflowMakerFormConfig.activeTab === 'jobs'}" ng-click="toggleFormTab('jobs')">JOBS</div>
|
||||||
<div class="Form-tab" ng-class="{'is-selected': workflowMakerFormConfig.activeTab === 'project_sync'}" ng-click="toggleFormTab('project_sync')">PROJECT SYNC</div>
|
<div class="Form-tab" ng-class="{'is-selected': workflowMakerFormConfig.activeTab === 'project_sync'}" ng-click="toggleFormTab('project_sync')">PROJECT SYNC</div>
|
||||||
<div class="Form-tab" ng-class="{'is-selected': workflowMakerFormConfig.activeTab === 'inventory_sync'}" ng-click="toggleFormTab('inventory_sync')">INVENTORY SYNC</div>
|
<div class="Form-tab" ng-class="{'is-selected': workflowMakerFormConfig.activeTab === 'inventory_sync'}" ng-click="toggleFormTab('inventory_sync')">INVENTORY SYNC</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="WorkflowMaker-formLists">
|
<div class="WorkflowMaker-formLists">
|
||||||
<div id="workflow-jobs-list" ng-show="workflowMakerFormConfig.activeTab === 'jobs'"></div>
|
<div id="workflow-jobs-list" ui-view="jobsTemplateList"></div> <!-- ng-show="workflowMakerFormConfig.activeTab === 'jobs'" -->
|
||||||
<div id="workflow-project-sync-list" ng-show="workflowMakerFormConfig.activeTab === 'project_sync'"></div>
|
<div id="workflow-project-sync-list" ng-show="workflowMakerFormConfig.activeTab === 'project_sync'" ui-view="projectSyncList"></div>
|
||||||
<div id="workflow-inventory-sync-list" ng-show="workflowMakerFormConfig.activeTab === 'inventory_sync'"></div>
|
<div id="workflow-inventory-sync-list" ng-show="workflowMakerFormConfig.activeTab === 'inventory_sync'" ui-view="inventorySyncList"></div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="showTypeOptions" class="WorkflowMaker-formElement">
|
<div ng-show="showTypeOptions" class="WorkflowMaker-formElement">
|
||||||
<label class="Form-inputLabelContainer">
|
<label class="Form-inputLabelContainer">
|
||||||
@@ -95,7 +97,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="workflow-maker-form"></div>
|
<div id="workflow-maker-form" ui-view="workflowForm"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
// html = GenerateForm.buildHTML(JobVarsPromptForm, { mode: 'edit', modal: true, scope: scope });
|
// html = GenerateForm.buildHTML(JobVarsPromptForm, { mode: 'edit', modal: true, scope: scope });
|
||||||
|
|
||||||
this.mode = options.mode;
|
this.mode = options.mode;
|
||||||
this.modal = (options.modal) ? true : false;
|
//this.modal = (options.modal) ? true : false;
|
||||||
this.setForm(form);
|
this.setForm(form);
|
||||||
return this.build(options);
|
return this.build(options);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user