mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 21:37:42 -02:30
More integration work - getting to the point where you can add nodes to the workflow after integrating with smart search.
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
ClearScope, GetBasePath, $q, ParseTypeChange, Wait, Empty,
|
ClearScope, GetBasePath, $q, ParseTypeChange, Wait, Empty,
|
||||||
ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString,
|
ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString,
|
||||||
JobTemplateService, OrganizationList, Rest
|
JobTemplateService, OrganizationList, Rest
|
||||||
) {
|
) {window.state = $state;
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
|
|||||||
@@ -76,10 +76,17 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
workflowMaker = {
|
workflowMaker = {
|
||||||
name: 'templates.editWorkflowJobTemplate.workflowMaker',
|
name: 'templates.editWorkflowJobTemplate.workflowMaker',
|
||||||
url: '/workflow-maker',
|
url: '/workflow-maker',
|
||||||
|
// ncyBreadcrumb: {
|
||||||
|
// label: 'WORKFLOW MAKER'
|
||||||
|
// },
|
||||||
|
data: {
|
||||||
|
formChildState: true
|
||||||
|
},
|
||||||
params: {
|
params: {
|
||||||
template_search: {
|
job_template_search: {
|
||||||
value: {
|
value: {
|
||||||
page_size: '5'
|
page_size: '5',
|
||||||
|
type: 'job_template'
|
||||||
},
|
},
|
||||||
squash: true,
|
squash: true,
|
||||||
dynamic: true
|
dynamic: true
|
||||||
@@ -104,26 +111,18 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
template: ` <workflow-maker ng-if="includeWorkflowMaker" tree-data="workflowTree"></workflow-maker>`
|
template: ` <workflow-maker ng-if="includeWorkflowMaker" tree-data="workflowTree"></workflow-maker>`
|
||||||
},
|
},
|
||||||
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
templateProvider: function(JobTemplateList, generateList) {
|
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
|
||||||
let list = _.cloneDeep(JobTemplateList);
|
//debugger;
|
||||||
delete list.fields.type;
|
|
||||||
delete list.fields.description;
|
|
||||||
delete list.fields.smart_status;
|
|
||||||
delete list.fields.labels;
|
|
||||||
delete list.fieldActions;
|
|
||||||
list.fields.name.columnClass = "col-md-11";
|
|
||||||
let html = generateList.build({
|
let html = generateList.build({
|
||||||
list: list,
|
list: WorkflowMakerJobTemplateList,
|
||||||
input_type: 'radio',
|
input_type: 'radio',
|
||||||
mode: 'lookup'
|
mode: 'lookup'
|
||||||
});
|
});
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
// $scope encapsulated in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
// $scope encapsulated in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
||||||
controller: ['$scope', 'JobTemplateList', 'JobTemplateDataset', '$log',
|
controller: ['$scope', 'WorkflowMakerJobTemplateList', 'JobTemplateDataset',
|
||||||
function($scope, list, Dataset, $log) {
|
function($scope, list, Dataset) {
|
||||||
// name of this tab
|
|
||||||
let tab = 'jobs';
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
@@ -133,14 +132,25 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||||
}
|
}
|
||||||
|
|
||||||
// resets any selected list items, if this tab is not active
|
$scope.toggle_job_template = function(id) {
|
||||||
$scope.$on('resetWorkflowList', function(e, active) {
|
|
||||||
// e.targetScope is a reference to the outer scope if you need to manipulate it!
|
|
||||||
|
|
||||||
// a reference to the currently-selected radio is stored in $scope.selection[list.iterator]
|
$scope.job_templates.forEach(function(row, i) {
|
||||||
// clear it out!
|
if (row.id === id) {
|
||||||
if (active !== tab) {
|
$scope.job_templates[i].checked = 1;
|
||||||
$scope.selection[list.iterator] = null;
|
$scope.selection[list.iterator] = {
|
||||||
|
id: row.id,
|
||||||
|
name: row.name
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$emit('templateSelected', row);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$on('clearOtherTemplateLists', function(e, tab) {
|
||||||
|
if(tab !== 'jobs') {
|
||||||
|
// Clear out any selected job
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -160,7 +170,6 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
// encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
// encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
||||||
controller: ['$scope', 'InventorySourcesList', 'InventorySourcesDataset',
|
controller: ['$scope', 'InventorySourcesList', 'InventorySourcesDataset',
|
||||||
function($scope, list, Dataset) {
|
function($scope, list, Dataset) {
|
||||||
let tab = 'inventory_sync';
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
@@ -171,35 +180,42 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// resets any selected list items, if this tab is not active
|
$scope.toggle_inventory_source = function(id) {
|
||||||
$scope.$on('resetWorkflowList', function(e, active) {
|
|
||||||
// e.targetScope is a reference to the outer scope if you need to manipulate it!
|
$scope.inventory_sources.forEach(function(row, i) {
|
||||||
|
if (row.id === id) {
|
||||||
|
$scope.inventory_sources[i].checked = 1;
|
||||||
|
$scope.selection[list.iterator] = {
|
||||||
|
id: row.id,
|
||||||
|
name: row.name
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$emit('templateSelected', row);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$on('clearOtherTemplateLists', function(e, tab) {
|
||||||
|
if(tab !== 'project_sync') {
|
||||||
|
|
||||||
if (active !== tab) {
|
|
||||||
$scope.selection[list.iterator] = null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'projectSyncList@templates.editWorkflowJobTemplate.workflowMaker': {
|
'projectSyncList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
templateProvider: function(ProjectList, generateList) {
|
templateProvider: function(WorkflowProjectList, generateList) {
|
||||||
let list = _.cloneDeep(ProjectList);
|
|
||||||
delete list.fields.status;
|
|
||||||
delete list.fields.scm_type;
|
|
||||||
delete list.fields.last_updated;
|
|
||||||
list.fields.name.columnClass = "col-md-11";
|
|
||||||
let html = generateList.build({
|
let html = generateList.build({
|
||||||
list: list,
|
list: WorkflowProjectList,
|
||||||
input_type: 'radio',
|
input_type: 'radio',
|
||||||
mode: 'lookup'
|
mode: 'lookup'
|
||||||
});
|
});
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
// encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
// encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
||||||
controller: ['$scope', 'ProjectList', 'ProjectDataset',
|
controller: ['$scope', 'WorkflowProjectList', 'ProjectDataset',
|
||||||
function($scope, list, Dataset) {
|
function($scope, list, Dataset) {
|
||||||
let tab = 'project_sync';
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
@@ -209,12 +225,26 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||||
|
|
||||||
}
|
}
|
||||||
// resets any selected list items, if this tab is not active
|
|
||||||
$scope.$on('resetWorkflowList', function(e, active) {
|
|
||||||
// e.targetScope is a reference to the outer scope if you need to manipulate it!
|
|
||||||
|
|
||||||
if (active !== tab) {
|
$scope.toggle_project = function(id) {
|
||||||
$scope.selection[list.iterator] = null;
|
|
||||||
|
$scope.projects.forEach(function(row, i) {
|
||||||
|
if (row.id === id) {
|
||||||
|
$scope.projects[i].checked = 1;
|
||||||
|
$scope.selection[list.iterator] = {
|
||||||
|
id: row.id,
|
||||||
|
name: row.name
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$emit('templateSelected', row);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$on('clearOtherTemplateLists', function(e, tab) {
|
||||||
|
if(tab !== 'inventory_sync') {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -233,7 +263,7 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
JobTemplateDataset: ['JobTemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
|
JobTemplateDataset: ['WorkflowMakerJobTemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||||
(list, qs, $stateParams, GetBasePath) => {
|
(list, qs, $stateParams, GetBasePath) => {
|
||||||
let path = GetBasePath(list.basePath);
|
let path = GetBasePath(list.basePath);
|
||||||
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
||||||
@@ -250,6 +280,32 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
let path = GetBasePath(list.basePath);
|
let path = GetBasePath(list.basePath);
|
||||||
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
WorkflowMakerJobTemplateList: ['JobTemplateList',
|
||||||
|
(JobTemplateList) => {
|
||||||
|
let list = _.cloneDeep(JobTemplateList);
|
||||||
|
delete list.fields.type;
|
||||||
|
delete list.fields.description;
|
||||||
|
delete list.fields.smart_status;
|
||||||
|
delete list.fields.labels;
|
||||||
|
delete list.fieldActions;
|
||||||
|
list.fields.name.columnClass = "col-md-11";
|
||||||
|
list.iterator = 'job_template';
|
||||||
|
list.name = 'job_templates';
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
WorkflowProjectList: ['ProjectList',
|
||||||
|
(ProjectList) => {
|
||||||
|
let list = _.cloneDeep(ProjectList);
|
||||||
|
delete list.fields.status;
|
||||||
|
delete list.fields.scm_type;
|
||||||
|
delete list.fields.last_updated;
|
||||||
|
list.fields.name.columnClass = "col-md-11";
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -259,7 +315,7 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
name: 'templates.editWorkflowJobTemplate.workflowMaker.inventory',
|
name: 'templates.editWorkflowJobTemplate.workflowMaker.inventory',
|
||||||
url: '/inventory',
|
url: '/inventory',
|
||||||
data: {
|
data: {
|
||||||
lookup: true
|
formChildState: true
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
inventory_search: {
|
inventory_search: {
|
||||||
@@ -309,7 +365,7 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
name: 'templates.editWorkflowJobTemplate.workflowMaker.credential',
|
name: 'templates.editWorkflowJobTemplate.workflowMaker.credential',
|
||||||
url: '/credential',
|
url: '/credential',
|
||||||
data: {
|
data: {
|
||||||
lookup: true
|
formChildState: true
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
credential_search: {
|
credential_search: {
|
||||||
@@ -334,7 +390,7 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
ListDefinition: ['ListDefinition', function(list) {
|
ListDefinition: ['CredentialList', function(list) {
|
||||||
// mutate the provided list definition here
|
// mutate the provided list definition here
|
||||||
return list;
|
return list;
|
||||||
}],
|
}],
|
||||||
|
|||||||
@@ -1,49 +1,9 @@
|
|||||||
export default ['CreateDialog', 'Wait', '$q', function(CreateDialog, Wait, $q){
|
export default ['CreateDialog', 'Wait', '$q', '$state', function(CreateDialog, Wait, $q, $state){
|
||||||
return {
|
return {
|
||||||
openDialog: function(params){
|
|
||||||
// params.scope
|
|
||||||
|
|
||||||
// let deferred = $q.defer();
|
|
||||||
|
|
||||||
// if (params.scope.removeWorkflowDialogReady) {
|
|
||||||
// params.scope.removeWorkflowDialogReady();
|
|
||||||
// }
|
|
||||||
// params.scope.removeWorkflowDialogReady = params.scope.$on('WorkflowDialogReady', function() {
|
|
||||||
// $('#workflow-modal-dialog').dialog('open');
|
|
||||||
|
|
||||||
// deferred.resolve();
|
|
||||||
// });
|
|
||||||
// Wait('start');
|
|
||||||
// debugger;
|
|
||||||
// CreateDialog({
|
|
||||||
// id: 'workflow-modal-dialog',
|
|
||||||
// scope: params.scope,
|
|
||||||
// width: 1400,
|
|
||||||
// height: 720,
|
|
||||||
// draggable: false,
|
|
||||||
// dialogClass: 'SurveyMaker-dialog',
|
|
||||||
// position: ['center',20],
|
|
||||||
// onClose: function() {
|
|
||||||
// $('#workflow-modal-dialog').empty();
|
|
||||||
// },
|
|
||||||
// onOpen: function() {
|
|
||||||
// Wait('stop');
|
|
||||||
|
|
||||||
// // Let the modal height be variable based on the content
|
|
||||||
// // and set a uniform padding
|
|
||||||
// $('#workflow-modal-dialog').css({'padding': '20px'});
|
|
||||||
|
|
||||||
// },
|
|
||||||
// _allowInteraction: function(e) {
|
|
||||||
// return !!$(e.target).is('.select2-input') || this._super(e);
|
|
||||||
// },
|
|
||||||
// callback: 'WorkflowDialogReady'
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return deferred.promise;
|
|
||||||
},
|
|
||||||
closeDialog: function() {
|
closeDialog: function() {
|
||||||
$('#workflow-modal-dialog').dialog('destroy');
|
$('#workflow-modal-dialog').dialog('destroy');
|
||||||
|
|
||||||
|
$state.go('^');
|
||||||
},
|
},
|
||||||
searchTree: function(params) {
|
searchTree: function(params) {
|
||||||
// params.element
|
// params.element
|
||||||
|
|||||||
@@ -32,78 +32,10 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
|||||||
value: "check"
|
value: "check"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
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
|
|
||||||
// with another way to get the list of job templates that have credentials that don't require passwords
|
|
||||||
// on launch
|
|
||||||
job_template_url += "?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
|
|
||||||
// let jobTemplatesList = _.cloneDeep(JobTemplateList);
|
|
||||||
// delete jobTemplatesList.fields.type;
|
|
||||||
// delete jobTemplatesList.fields.description;
|
|
||||||
// delete jobTemplatesList.fields.smart_status;
|
|
||||||
// delete jobTemplatesList.fields.labels;
|
|
||||||
// jobTemplatesList.fields.name.columnClass = "col-md-11";
|
|
||||||
// jobTemplatesList.name = "workflow_job_templates";
|
|
||||||
|
|
||||||
// let project_url = GetBasePath('projects');
|
|
||||||
|
|
||||||
// let projectList = _.cloneDeep(ProjectList);
|
|
||||||
// delete projectList.fields.status;
|
|
||||||
// delete projectList.fields.scm_type;
|
|
||||||
// delete projectList.fields.last_updated;
|
|
||||||
// projectList.fields.name.columnClass = "col-md-11";
|
|
||||||
// projectList.name = "workflow_projects";
|
|
||||||
|
|
||||||
//let inventory_sources_url = GetBasePath('inventory_sources');
|
|
||||||
|
|
||||||
//let inventorySourcesList = _.cloneDeep(InventorySourcesList);
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
$scope.treeDataMaster = angular.copy($scope.treeData.data);
|
$scope.treeDataMaster = angular.copy($scope.treeData.data);
|
||||||
$scope.$broadcast("refreshWorkflowChart");
|
$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"
|
|
||||||
$scope.workflow_job_templates.forEach(function(row, i) {
|
|
||||||
if (row.id === $scope.selectedTemplate.id) {
|
|
||||||
$scope.workflow_job_templates[i].checked = 1;
|
|
||||||
} else {
|
|
||||||
$scope.workflow_job_templates[i].checked = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$watchCollection('workflow_projects', function() {
|
|
||||||
if ($scope.selectedTemplate) {
|
|
||||||
// Loop across the inventories and see if one of them should be "checked"
|
|
||||||
$scope.workflow_projects.forEach(function(row, i) {
|
|
||||||
if (row.id === $scope.selectedTemplate.id) {
|
|
||||||
$scope.workflow_projects[i].checked = 1;
|
|
||||||
} else {
|
|
||||||
$scope.workflow_projects[i].checked = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$watchCollection('workflow_inventory_sources', function() {
|
|
||||||
if ($scope.selectedTemplate) {
|
|
||||||
// Loop across the inventories and see if one of them should be "checked"
|
|
||||||
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
|
||||||
if (row.id === $scope.selectedTemplate.id) {
|
|
||||||
$scope.workflow_inventory_sources[i].checked = 1;
|
|
||||||
} else {
|
|
||||||
$scope.workflow_inventory_sources[i].checked = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$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;
|
||||||
@@ -143,7 +75,11 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.lookUpInventory = function(){
|
$scope.lookUpInventory = function(){
|
||||||
$state.go('.inventory')
|
$state.go('.inventory');
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.lookUpCredential = function(){
|
||||||
|
$state.go('.credential');
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.closeWorkflowMaker = function() {
|
$scope.closeWorkflowMaker = function() {
|
||||||
@@ -540,123 +476,63 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggleFormTab = function(tab) {
|
$scope.toggleFormTab = function(tab) {
|
||||||
// a dictionary of settings required by each encapsulated tab
|
|
||||||
$scope.$broadcast('resetWorkflowList', tab);
|
|
||||||
if ($scope.workflowMakerFormConfig.activeTab !== tab) {
|
if ($scope.workflowMakerFormConfig.activeTab !== tab) {
|
||||||
$scope.workflowMakerFormConfig.activeTab = tab;
|
$scope.workflowMakerFormConfig.activeTab = tab;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggle_job_template = function(id) {
|
$scope.$on('templateSelected', function(e, selectedTemplate) {
|
||||||
|
|
||||||
// $scope.workflow_projects.forEach(function(row, i) {
|
|
||||||
// $scope.workflow_projects[i].checked = 0;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $scope.workflow_inventory_sources.forEach(function(row, i) {
|
|
||||||
// $scope.workflow_inventory_sources[i].checked = 0;
|
|
||||||
// });
|
|
||||||
|
|
||||||
$scope.workflow_job_templates.forEach(function(row, i) {
|
|
||||||
if (row.id === id) {
|
|
||||||
$scope.selectedTemplate = angular.copy(row);
|
|
||||||
if ($scope.selectedTemplate.ask_credential_on_launch) {
|
|
||||||
if ($scope.selectedTemplate.summary_fields.credential) {
|
|
||||||
$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;
|
|
||||||
} else {
|
|
||||||
$scope.credential_name = null;
|
|
||||||
$scope.credential = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.selectedTemplate.ask_inventory_on_launch) {
|
|
||||||
if ($scope.selectedTemplate.summary_fields.inventory) {
|
|
||||||
$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;
|
|
||||||
} else {
|
|
||||||
$scope.inventory_name = null;
|
|
||||||
$scope.inventory = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.selectedTemplate.ask_job_type_on_launch) {
|
|
||||||
$scope.job_type = {
|
|
||||||
value: $scope.selectedTemplate.job_type ? $scope.selectedTemplate.job_type : null
|
|
||||||
};
|
|
||||||
|
|
||||||
// The default needs to be in place before we can select2-ify the dropdown
|
|
||||||
CreateSelect2({
|
|
||||||
element: '#workflow_maker_job_type',
|
|
||||||
multiple: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.selectedTemplate.ask_limit_on_launch) {
|
|
||||||
$scope.limit = $scope.selectedTemplate.limit ? $scope.selectedTemplate.limit : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.selectedTemplate.ask_skip_tags_on_launch) {
|
|
||||||
$scope.skip_tags = $scope.selectedTemplate.skip_tags ? $scope.selectedTemplate.skip_tags : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.selectedTemplate.ask_tags_on_launch) {
|
|
||||||
$scope.job_tags = $scope.selectedTemplate.job_tags ? $scope.selectedTemplate.job_tags : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.workflow_job_templates[i].checked = 1;
|
|
||||||
} else {
|
|
||||||
$scope.workflow_job_templates[i].checked = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.toggle_project = function(id) {
|
|
||||||
|
|
||||||
resetPromptFields();
|
resetPromptFields();
|
||||||
|
|
||||||
// $scope.workflow_job_templates.forEach(function(row, i) {
|
$scope.selectedTemplate = angular.copy(selectedTemplate);
|
||||||
// $scope.workflow_job_templates[i].checked = 0;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $scope.workflow_inventory_sources.forEach(function(row, i) {
|
if ($scope.selectedTemplate.ask_credential_on_launch) {
|
||||||
// $scope.workflow_inventory_sources[i].checked = 0;
|
if ($scope.selectedTemplate.summary_fields.credential) {
|
||||||
// });
|
$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.workflow_projects.forEach(function(row, i) {
|
|
||||||
if (row.id === id) {
|
|
||||||
$scope.selectedTemplate = angular.copy(row);
|
|
||||||
$scope.workflow_projects[i].checked = 1;
|
|
||||||
} else {
|
} else {
|
||||||
$scope.workflow_projects[i].checked = 0;
|
$scope.credential_name = null;
|
||||||
|
$scope.credential = null;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
};
|
if ($scope.selectedTemplate.ask_inventory_on_launch) {
|
||||||
|
if ($scope.selectedTemplate.summary_fields.inventory) {
|
||||||
$scope.toggle_inventory_source = function(id) {
|
$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;
|
||||||
resetPromptFields();
|
|
||||||
|
|
||||||
// $scope.workflow_job_templates.forEach(function(row, i) {
|
|
||||||
// $scope.workflow_job_templates[i].checked = 0;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $scope.workflow_projects.forEach(function(row, i) {
|
|
||||||
// $scope.workflow_projects[i].checked = 0;
|
|
||||||
// });
|
|
||||||
|
|
||||||
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
|
||||||
if (row.id === id) {
|
|
||||||
$scope.selectedTemplate = angular.copy(row);
|
|
||||||
$scope.workflow_inventory_sources[i].checked = 1;
|
|
||||||
} else {
|
} else {
|
||||||
$scope.workflow_inventory_sources[i].checked = 0;
|
$scope.inventory_name = null;
|
||||||
|
$scope.inventory = null;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
};
|
if ($scope.selectedTemplate.ask_job_type_on_launch) {
|
||||||
|
$scope.job_type = {
|
||||||
|
value: $scope.selectedTemplate.job_type ? $scope.selectedTemplate.job_type : null
|
||||||
|
};
|
||||||
|
|
||||||
|
// The default needs to be in place before we can select2-ify the dropdown
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#workflow_maker_job_type',
|
||||||
|
multiple: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($scope.selectedTemplate.ask_limit_on_launch) {
|
||||||
|
$scope.limit = $scope.selectedTemplate.limit ? $scope.selectedTemplate.limit : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($scope.selectedTemplate.ask_skip_tags_on_launch) {
|
||||||
|
$scope.skip_tags = $scope.selectedTemplate.skip_tags ? $scope.selectedTemplate.skip_tags : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($scope.selectedTemplate.ask_tags_on_launch) {
|
||||||
|
$scope.job_tags = $scope.selectedTemplate.job_tags ? $scope.selectedTemplate.job_tags : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.$broadcast('clearOtherTemplateLists', $scope.workflowMakerFormConfig.activeTab);
|
||||||
|
});
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@@ -1274,7 +1274,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if(this.mode === "edit"){
|
if(this.mode === "edit"){
|
||||||
html += `<div id="${this.form.name}_tab" class="Form-tab" ` +
|
html += `<div id="${this.form.name}_tab" class="Form-tab" ` +
|
||||||
`ng-click="$state.go('${this.form.stateTree}.edit')" ` +
|
`ng-click="$state.go('${this.form.stateTree}.edit')" ` +
|
||||||
`ng-class="{'is-selected': $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$curruent.data.lookup }">` +
|
`ng-class="{'is-selected': $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState }">` +
|
||||||
`${details}</div>`;
|
`${details}</div>`;
|
||||||
|
|
||||||
for (itm in this.form.related) {
|
for (itm in this.form.related) {
|
||||||
@@ -1372,8 +1372,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += "</div>";//tabHolder
|
html += "</div>";//tabHolder
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_.isEmpty(this.form.related) && this.mode === "edit"){
|
if(!_.isEmpty(this.form.related) && this.mode === "edit"){// TODO: either include $state.is('templates.editWorkflowJobTemplate') or figure out something else to do here
|
||||||
html += `<div class="Form-tabSection" ng-class="{'is-selected' : $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.lookup }">`;
|
html += `<div class="Form-tabSection" ng-class="{'is-selected' : $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState }">`;
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "<form class=\"Form";
|
html += "<form class=\"Form";
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ export default ['templateUrl', '$compile', function(templateUrl, $compile) {
|
|||||||
$scope.$parent[list.iterator] = $scope.selection[list.iterator].id;
|
$scope.$parent[list.iterator] = $scope.selection[list.iterator].id;
|
||||||
$state.go('^');
|
$state.go('^');
|
||||||
};
|
};
|
||||||
|
$scope.cancelForm = function() {
|
||||||
|
$state.go('^');
|
||||||
|
};
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<!-- optional: transclude header fields -->
|
<!-- optional: transclude header fields -->
|
||||||
<div class="Form-header--fields"></div>
|
<div class="Form-header--fields"></div>
|
||||||
<div class="Form-exitHolder">
|
<div class="Form-exitHolder">
|
||||||
<button type="button" class="Form-exit" data-dismiss="modal" aria-hidden="true" ng-click="$state.go('^')">
|
<button type="button" class="Form-exit" ng-click="cancelForm()">
|
||||||
<i class="fa fa-times-circle"></i>
|
<i class="fa fa-times-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<!-- see: lookup-modal.directive.js -->
|
<!-- see: lookup-modal.directive.js -->
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button data-target="#form-modal" ng-click="$state.go('^')" data-dismiss="modal" class="Lookup-cancel btn btn-default">Cancel</button>
|
<button ng-click="cancelForm()" class="Lookup-cancel btn btn-default">Cancel</button>
|
||||||
<button ng-click="saveForm()" class="Lookup-save btn btn-primary">Save</button>
|
<button ng-click="saveForm()" class="Lookup-save btn btn-primary">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat
|
|||||||
// a lookup field's basePath takes precedence over generic list definition's basePath, if supplied
|
// a lookup field's basePath takes precedence over generic list definition's basePath, if supplied
|
||||||
data: {
|
data: {
|
||||||
basePath: field.basePath || null,
|
basePath: field.basePath || null,
|
||||||
lookup: true
|
formChildState: true
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
[field.sourceModel + '_search']: {
|
[field.sourceModel + '_search']: {
|
||||||
|
|||||||
@@ -17,7 +17,13 @@ module.exports = {
|
|||||||
ws: true
|
ws: true
|
||||||
},
|
},
|
||||||
keepalive: false,
|
keepalive: false,
|
||||||
watchTask: true
|
watchTask: true,
|
||||||
|
// The browser-sync-client lib will write your current scroll position to window.name
|
||||||
|
// https://github.com/BrowserSync/browser-sync-client/blob/a2718faa91e11553feca7a3962313bf1ec6ba3e5/dist/index.js#L500
|
||||||
|
// This strategy is enabled in the core browser-sync lib, and not externally documented as an option. Yay!
|
||||||
|
// https://github.com/BrowserSync/browser-sync/blob/a522aaf12b6167d5591ed285eb3086f43a4d9ac2/lib/default-config.js#L312
|
||||||
|
scrollRestoreTechnique: null,
|
||||||
|
injectChanges: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user