diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js
index 7d3f3d302e..012928f590 100644
--- a/awx/ui/client/src/app.js
+++ b/awx/ui/client/src/app.js
@@ -19,8 +19,8 @@ import uiRouter from 'angular-ui-router';
// backwards compatibility for $stateChange* events
import 'angular-ui-router/release/stateEvents';
// ui-router debugging
-//import { trace } from 'angular-ui-router';
-//trace.enable();
+import { trace } from 'angular-ui-router';
+trace.enable();
// Configuration dependencies
global.$AnsibleConfig = null;
diff --git a/awx/ui/client/src/job-templates/list/job-templates-list.route.js b/awx/ui/client/src/job-templates/list/job-templates-list.route.js
index c39d6af766..3e64e8cd1a 100644
--- a/awx/ui/client/src/job-templates/list/job-templates-list.route.js
+++ b/awx/ui/client/src/job-templates/list/job-templates-list.route.js
@@ -18,13 +18,13 @@ export default {
}
},
params: {
- unified_job_templates_search: {
+ template_search: {
value: {
type: 'workflow_job_template,job_template'
}
}
},
- searchPrefix: 'unified_job_templates',
+ searchPrefix: 'template',
views: {
'@': {
controller: 'JobTemplatesListController',
diff --git a/awx/ui/client/src/job-templates/main.js b/awx/ui/client/src/job-templates/main.js
index 3ff23a97c9..f22f573236 100644
--- a/awx/ui/client/src/job-templates/main.js
+++ b/awx/ui/client/src/job-templates/main.js
@@ -4,8 +4,6 @@
* All Rights Reserved
*************************************************/
-import { templateUrl } from '../shared/template-url/template-url.factory';
-
import jobTemplateService from './job-template.service';
import surveyMaker from './survey-maker/main';
@@ -75,40 +73,102 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
}
});
- workflowMaker = stateExtender.buildDefinition({
+ workflowMaker = {
name: 'templates.editWorkflowJobTemplate.workflowMaker',
url: '/workflow-maker',
+ params: {
+ template_search: {
+ value: {
+ page_size: '5'
+ },
+ squash: true,
+ dynamic: true
+ },
+ project_search: {
+ value: {
+ page_size: '5'
+ },
+ squash: true,
+ dynamic: true
+ },
+ inventory_source_search: {
+ value: {
+ page_size: '5'
+ },
+ squash: true,
+ dynamic: true
+ }
+ },
views: {
'modal': {
template: ` `
},
- // '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;
- // }
- // },
+ 'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
+ templateProvider: function(JobTemplateList, generateList) {
+ let list = _.cloneDeep(JobTemplateList);
+ delete list.fields.type;
+ delete list.fields.description;
+ delete list.fields.smart_status;
+ delete list.fields.labels;
+ list.fields.name.columnClass = "col-md-11";
+ let html = generateList.build({
+ list: list,
+ mode: 'edit'
+ });
+ return html;
+ },
+ // $scope encapsulated in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
+ controller: ['$scope', 'JobTemplateList', 'JobTemplateDataset',
+ function($scope, list, Dataset) {
+ $scope.list = list;
+ $scope[`${list.iterator}_dataset`] = Dataset.data;
+ $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
+
+ }
+ ]
+ },
+ 'inventorySyncList@templates.editWorkflowJobTemplate.workflowMaker': {
+ templateProvider: function(InventorySourcesList, generateList) {
+ let list = _.cloneDeep(InventorySourcesList);
+ // mutate list definition here!
+ let html = generateList.build({
+ list: list,
+ mode: 'edit'
+ });
+ return html;
+ },
+ // encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
+ controller: ['$scope', 'InventorySourcesList', 'InventorySourcesDataset',
+ function($scope, list, Dataset) {
+ $scope.list = list;
+ $scope[`${list.iterator}_dataset`] = Dataset.data;
+ $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
+
+ }
+ ]
+ },
+ 'projectList@templates.editWorkflowJobTemplate.workflowMaker': {
+ templateProvider: function(ProjectList, 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({
+ list: list,
+ mode: 'edit'
+ });
+ return html;
+ },
+ // encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
+ controller: ['$scope', 'ProjectList', 'ProjectDataset',
+ function($scope, list, Dataset) {
+ $scope.list = list;
+ $scope[`${list.iterator}_dataset`] = Dataset.data;
+ $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
+ }
+ ]
+ },
'workflowForm@templates.editWorkflowJobTemplate.workflowMaker': {
templateProvider: function(WorkflowMakerForm, GenerateForm) {
let form = WorkflowMakerForm();
@@ -119,12 +179,31 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
return html;
}
}
+ },
+ resolve: {
+ JobTemplateDataset: ['JobTemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
+ (list, qs, $stateParams, GetBasePath) => {
+ let path = GetBasePath(list.basePath);
+ return qs.search(path, $stateParams[`${list.iterator}_search`]);
+ }
+ ],
+ ProjectDataset: ['ProjectList', 'QuerySet', '$stateParams', 'GetBasePath',
+ (list, qs, $stateParams, GetBasePath) => {
+ let path = GetBasePath(list.basePath);
+ return qs.search(path, $stateParams[`${list.iterator}_search`]);
+ }
+ ],
+ InventorySourcesDataset: ['InventorySourcesList', 'QuerySet', '$stateParams', 'GetBasePath',
+ (list, qs, $stateParams, GetBasePath) => {
+ let path = GetBasePath(list.basePath);
+ return qs.search(path, $stateParams[`${list.iterator}_search`]);
+ }
+ ]
}
- });
+ };
- inventoryLookup = stateExtender.buildDefinition({
+ inventoryLookup = {
searchPrefix: 'inventory',
- //squashSearchUrl: true, @issue enable
name: 'templates.editWorkflowJobTemplate.workflowMaker.inventory',
url: '/inventory',
data: {
@@ -132,15 +211,19 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
},
params: {
inventory_search: {
- value: { page_size: '5'}
+ value: {
+ page_size: '5'
+ },
+ squash: true,
+ dynamic: true
}
},
views: {
'related': {
- templateProvider: function(InventoryList, generateList) {
+ templateProvider: function(ListDefinition, generateList) {
let list_html = generateList.build({
mode: 'lookup',
- list: InventoryList,
+ list: ListDefinition,
input_type: 'radio'
});
return `${list_html}`;
@@ -150,9 +233,10 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
},
resolve: {
ListDefinition: ['InventoryList', function(list) {
+ // mutate the provided list definition here
return list;
}],
- Dataset: ['InventoryList', 'QuerySet', '$stateParams', 'GetBasePath',
+ Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath',
(list, qs, $stateParams, GetBasePath) => {
let path = GetBasePath(list.name) || GetBasePath(list.basePath);
return qs.search(path, $stateParams[`${list.iterator}_search`]);
@@ -166,9 +250,57 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
$('body').removeClass('modal-open');
}
},
- });
+ };
+ credentialLookup = {
+ searchPrefix: 'credential',
+ name: 'templates.editWorkflowJobTemplate.workflowMaker.credential',
+ url: '/credential',
+ data: {
+ lookup: true
+ },
+ params: {
+ credential_search: {
+ value: {
+ page_size: '5'
+ },
+ squash: true,
+ dynamic: true
+ }
+ },
+ views: {
+ 'related': {
+ templateProvider: function(ListDefinition, generateList) {
+ let list_html = generateList.build({
+ mode: 'lookup',
+ list: ListDefinition,
+ input_type: 'radio'
+ });
+ return `${list_html}`;
+ }
+ }
+ },
+ resolve: {
+ ListDefinition: ['ListDefinition', function(list) {
+ // mutate the provided list definition here
+ return list;
+ }],
+ Dataset: ['ListDefinition', '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([
@@ -182,8 +314,9 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
return result.concat(definition.states);
}, [
stateExtender.buildDefinition(jobTemplatesListRoute),
- workflowMaker,
- inventoryLookup
+ stateExtender.buildDefinition(workflowMaker),
+ stateExtender.buildDefinition(inventoryLookup),
+ stateExtender.buildDefinition(credentialLookup)
])
};
});
diff --git a/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.partial.html b/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.partial.html
index 35234f9b93..2b36654125 100644
--- a/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.partial.html
+++ b/awx/ui/client/src/job-templates/workflow-maker/workflow-maker.partial.html
@@ -74,7 +74,7 @@
INVENTORY SYNC
diff --git a/awx/ui/client/src/lists/InventorySources.js b/awx/ui/client/src/lists/InventorySources.js
index e946e9d4d0..127352c72b 100644
--- a/awx/ui/client/src/lists/InventorySources.js
+++ b/awx/ui/client/src/lists/InventorySources.js
@@ -11,6 +11,7 @@ export default
name: 'workflow_inventory_sources',
iterator: 'inventory_source',
+ basePath: 'inventory_sources',
listTitle: 'Inventory Sources',
index: false,
hover: true,
diff --git a/awx/ui/client/src/lists/JobTemplates.js b/awx/ui/client/src/lists/JobTemplates.js
index fd5cbac79a..d776f2e680 100644
--- a/awx/ui/client/src/lists/JobTemplates.js
+++ b/awx/ui/client/src/lists/JobTemplates.js
@@ -11,7 +11,7 @@ export default
return {
name: 'templates',
- iterator: 'unified_job_templates',
+ iterator: 'template',
basePath: 'unified_job_templates',
selectTitle: i18n._('Template'),
editTitle: i18n._('Templates'),
@@ -85,7 +85,7 @@ export default
ngClick: 'submitJob(unified_job_templates)',
awToolTip: i18n._('Start a job using this template'),
dataPlacement: 'top',
- ngShow: 'unified_job_templates.summary_fields.user_capabilities.start'
+ ngShow: 'template.summary_fields.user_capabilities.start'
},
schedule: {
label: i18n._('Schedule'),
@@ -93,7 +93,7 @@ export default
ngClick: 'scheduleJob(unified_job_templates)',
awToolTip: i18n._('Schedule future job template runs'),
dataPlacement: 'top',
- ngShow: 'unified_job_templates.summary_fields.user_capabilities.schedule'
+ ngShow: 'template.summary_fields.user_capabilities.schedule'
},
copy: {
label: i18n._('Copy'),
@@ -101,7 +101,7 @@ export default
"class": 'btn-danger btn-xs',
awToolTip: i18n._('Copy template'),
dataPlacement: 'top',
- ngShow: 'unified_job_templates.summary_fields.user_capabilities.copy'
+ ngShow: 'template.summary_fields.user_capabilities.copy'
},
edit: {
label: i18n._('Edit'),
@@ -109,7 +109,7 @@ export default
awToolTip: i18n._('Edit template'),
"class": 'btn-default btn-xs',
dataPlacement: 'top',
- ngShow: 'unified_job_templates.summary_fields.user_capabilities.edit'
+ ngShow: 'template.summary_fields.user_capabilities.edit'
},
view: {
label: i18n._('View'),
@@ -117,7 +117,7 @@ export default
awToolTip: i18n._('View template'),
"class": 'btn-default btn-xs',
dataPlacement: 'top',
- ngShow: '!unified_job_templates.summary_fields.user_capabilities.edit'
+ ngShow: '!template.summary_fields.user_capabilities.edit'
},
"delete": {
label: i18n._('Delete'),
@@ -125,7 +125,7 @@ export default
"class": 'btn-danger btn-xs',
awToolTip: i18n._('Delete template'),
dataPlacement: 'top',
- ngShow: 'unified_job_templates.summary_fields.user_capabilities.delete'
+ ngShow: 'template.summary_fields.user_capabilities.delete'
}
}
};}]);
diff --git a/awx/ui/client/src/lists/Projects.js b/awx/ui/client/src/lists/Projects.js
index ce478129ac..31d176bd98 100644
--- a/awx/ui/client/src/lists/Projects.js
+++ b/awx/ui/client/src/lists/Projects.js
@@ -11,6 +11,7 @@ export default
name: 'projects',
iterator: 'project',
+ basePath: 'projects',
selectTitle: i18n._('Add Project'),
editTitle: i18n._('Projects'),
listTitle: i18n._('Projects'),