mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
Integrate smart-search into workflow maker
This commit is contained in:
parent
ed5fb05c17
commit
c091590d67
@ -19,8 +19,8 @@ import uiRouter from 'angular-ui-router';
|
|||||||
// backwards compatibility for $stateChange* events
|
// backwards compatibility for $stateChange* events
|
||||||
import 'angular-ui-router/release/stateEvents';
|
import 'angular-ui-router/release/stateEvents';
|
||||||
// ui-router debugging
|
// ui-router debugging
|
||||||
//import { trace } from 'angular-ui-router';
|
import { trace } from 'angular-ui-router';
|
||||||
//trace.enable();
|
trace.enable();
|
||||||
|
|
||||||
// Configuration dependencies
|
// Configuration dependencies
|
||||||
global.$AnsibleConfig = null;
|
global.$AnsibleConfig = null;
|
||||||
|
@ -18,13 +18,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
unified_job_templates_search: {
|
template_search: {
|
||||||
value: {
|
value: {
|
||||||
type: 'workflow_job_template,job_template'
|
type: 'workflow_job_template,job_template'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
searchPrefix: 'unified_job_templates',
|
searchPrefix: 'template',
|
||||||
views: {
|
views: {
|
||||||
'@': {
|
'@': {
|
||||||
controller: 'JobTemplatesListController',
|
controller: 'JobTemplatesListController',
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
* 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';
|
||||||
@ -75,40 +73,102 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
workflowMaker = stateExtender.buildDefinition({
|
workflowMaker = {
|
||||||
name: 'templates.editWorkflowJobTemplate.workflowMaker',
|
name: 'templates.editWorkflowJobTemplate.workflowMaker',
|
||||||
url: '/workflow-maker',
|
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: {
|
views: {
|
||||||
'modal': {
|
'modal': {
|
||||||
template: ` <workflow-maker ng-if="includeWorkflowMaker" tree-data="workflowTree"></workflow-maker>`
|
template: ` <workflow-maker ng-if="includeWorkflowMaker" tree-data="workflowTree"></workflow-maker>`
|
||||||
},
|
},
|
||||||
// 'jobsTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
// templateProvider: function(JobTemplateList, generateList) {
|
templateProvider: function(JobTemplateList, generateList) {
|
||||||
// let html = generateList.build({
|
let list = _.cloneDeep(JobTemplateList);
|
||||||
// list: JobTemplateList,
|
delete list.fields.type;
|
||||||
// mode: 'edit'
|
delete list.fields.description;
|
||||||
// });
|
delete list.fields.smart_status;
|
||||||
// return html;
|
delete list.fields.labels;
|
||||||
// }
|
list.fields.name.columnClass = "col-md-11";
|
||||||
// },
|
let html = generateList.build({
|
||||||
// 'inventorySyncList@templates.editWorkflowJobTemplate.workflowMaker': {
|
list: list,
|
||||||
// templateProvider: function(InventoryList, generateList) {
|
mode: 'edit'
|
||||||
// let html = generateList.build({
|
});
|
||||||
// list: InventoryList,
|
return html;
|
||||||
// mode: 'edit'
|
},
|
||||||
// });
|
// $scope encapsulated in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
||||||
// return html;
|
controller: ['$scope', 'JobTemplateList', 'JobTemplateDataset',
|
||||||
// }
|
function($scope, list, Dataset) {
|
||||||
// },
|
$scope.list = list;
|
||||||
// 'projectList@templates.editWorkflowJobTemplate.workflowMaker': {
|
$scope[`${list.iterator}_dataset`] = Dataset.data;
|
||||||
// templateProvider: function(ProjectList, generateList) {
|
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||||
// let html = generateList.build({
|
|
||||||
// list: ProjectList,
|
}
|
||||||
// mode: 'edit'
|
]
|
||||||
// });
|
},
|
||||||
// return html;
|
'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': {
|
'workflowForm@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
templateProvider: function(WorkflowMakerForm, GenerateForm) {
|
templateProvider: function(WorkflowMakerForm, GenerateForm) {
|
||||||
let form = WorkflowMakerForm();
|
let form = WorkflowMakerForm();
|
||||||
@ -119,12 +179,31 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
return html;
|
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',
|
searchPrefix: 'inventory',
|
||||||
//squashSearchUrl: true, @issue enable
|
|
||||||
name: 'templates.editWorkflowJobTemplate.workflowMaker.inventory',
|
name: 'templates.editWorkflowJobTemplate.workflowMaker.inventory',
|
||||||
url: '/inventory',
|
url: '/inventory',
|
||||||
data: {
|
data: {
|
||||||
@ -132,15 +211,19 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
inventory_search: {
|
inventory_search: {
|
||||||
value: { page_size: '5'}
|
value: {
|
||||||
|
page_size: '5'
|
||||||
|
},
|
||||||
|
squash: true,
|
||||||
|
dynamic: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
views: {
|
views: {
|
||||||
'related': {
|
'related': {
|
||||||
templateProvider: function(InventoryList, generateList) {
|
templateProvider: function(ListDefinition, generateList) {
|
||||||
let list_html = generateList.build({
|
let list_html = generateList.build({
|
||||||
mode: 'lookup',
|
mode: 'lookup',
|
||||||
list: InventoryList,
|
list: ListDefinition,
|
||||||
input_type: 'radio'
|
input_type: 'radio'
|
||||||
});
|
});
|
||||||
return `<lookup-modal>${list_html}</lookup-modal>`;
|
return `<lookup-modal>${list_html}</lookup-modal>`;
|
||||||
@ -150,9 +233,10 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
ListDefinition: ['InventoryList', function(list) {
|
ListDefinition: ['InventoryList', function(list) {
|
||||||
|
// mutate the provided list definition here
|
||||||
return list;
|
return list;
|
||||||
}],
|
}],
|
||||||
Dataset: ['InventoryList', 'QuerySet', '$stateParams', 'GetBasePath',
|
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||||
(list, qs, $stateParams, GetBasePath) => {
|
(list, qs, $stateParams, GetBasePath) => {
|
||||||
let path = GetBasePath(list.name) || GetBasePath(list.basePath);
|
let path = GetBasePath(list.name) || GetBasePath(list.basePath);
|
||||||
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
return qs.search(path, $stateParams[`${list.iterator}_search`]);
|
||||||
@ -166,9 +250,57 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
$('body').removeClass('modal-open');
|
$('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 `<lookup-modal>${list_html}</lookup-modal>`;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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([
|
return Promise.all([
|
||||||
@ -182,8 +314,9 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
|||||||
return result.concat(definition.states);
|
return result.concat(definition.states);
|
||||||
}, [
|
}, [
|
||||||
stateExtender.buildDefinition(jobTemplatesListRoute),
|
stateExtender.buildDefinition(jobTemplatesListRoute),
|
||||||
workflowMaker,
|
stateExtender.buildDefinition(workflowMaker),
|
||||||
inventoryLookup
|
stateExtender.buildDefinition(inventoryLookup),
|
||||||
|
stateExtender.buildDefinition(credentialLookup)
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
<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" ui-view="jobsTemplateList"></div> <!-- ng-show="workflowMakerFormConfig.activeTab === 'jobs'" -->
|
<div id="workflow-jobs-list" ui-view="jobTemplateList"></div> <!-- ng-show="workflowMakerFormConfig.activeTab === 'jobs'" -->
|
||||||
<div id="workflow-project-sync-list" ng-show="workflowMakerFormConfig.activeTab === 'project_sync'" ui-view="projectSyncList"></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'" ui-view="inventorySyncList"></div>
|
<div id="workflow-inventory-sync-list" ng-show="workflowMakerFormConfig.activeTab === 'inventory_sync'" ui-view="inventorySyncList"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,6 +11,7 @@ export default
|
|||||||
|
|
||||||
name: 'workflow_inventory_sources',
|
name: 'workflow_inventory_sources',
|
||||||
iterator: 'inventory_source',
|
iterator: 'inventory_source',
|
||||||
|
basePath: 'inventory_sources',
|
||||||
listTitle: 'Inventory Sources',
|
listTitle: 'Inventory Sources',
|
||||||
index: false,
|
index: false,
|
||||||
hover: true,
|
hover: true,
|
||||||
|
@ -11,7 +11,7 @@ export default
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
name: 'templates',
|
name: 'templates',
|
||||||
iterator: 'unified_job_templates',
|
iterator: 'template',
|
||||||
basePath: 'unified_job_templates',
|
basePath: 'unified_job_templates',
|
||||||
selectTitle: i18n._('Template'),
|
selectTitle: i18n._('Template'),
|
||||||
editTitle: i18n._('Templates'),
|
editTitle: i18n._('Templates'),
|
||||||
@ -85,7 +85,7 @@ export default
|
|||||||
ngClick: 'submitJob(unified_job_templates)',
|
ngClick: 'submitJob(unified_job_templates)',
|
||||||
awToolTip: i18n._('Start a job using this template'),
|
awToolTip: i18n._('Start a job using this template'),
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: 'unified_job_templates.summary_fields.user_capabilities.start'
|
ngShow: 'template.summary_fields.user_capabilities.start'
|
||||||
},
|
},
|
||||||
schedule: {
|
schedule: {
|
||||||
label: i18n._('Schedule'),
|
label: i18n._('Schedule'),
|
||||||
@ -93,7 +93,7 @@ export default
|
|||||||
ngClick: 'scheduleJob(unified_job_templates)',
|
ngClick: 'scheduleJob(unified_job_templates)',
|
||||||
awToolTip: i18n._('Schedule future job template runs'),
|
awToolTip: i18n._('Schedule future job template runs'),
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: 'unified_job_templates.summary_fields.user_capabilities.schedule'
|
ngShow: 'template.summary_fields.user_capabilities.schedule'
|
||||||
},
|
},
|
||||||
copy: {
|
copy: {
|
||||||
label: i18n._('Copy'),
|
label: i18n._('Copy'),
|
||||||
@ -101,7 +101,7 @@ export default
|
|||||||
"class": 'btn-danger btn-xs',
|
"class": 'btn-danger btn-xs',
|
||||||
awToolTip: i18n._('Copy template'),
|
awToolTip: i18n._('Copy template'),
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: 'unified_job_templates.summary_fields.user_capabilities.copy'
|
ngShow: 'template.summary_fields.user_capabilities.copy'
|
||||||
},
|
},
|
||||||
edit: {
|
edit: {
|
||||||
label: i18n._('Edit'),
|
label: i18n._('Edit'),
|
||||||
@ -109,7 +109,7 @@ export default
|
|||||||
awToolTip: i18n._('Edit template'),
|
awToolTip: i18n._('Edit template'),
|
||||||
"class": 'btn-default btn-xs',
|
"class": 'btn-default btn-xs',
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: 'unified_job_templates.summary_fields.user_capabilities.edit'
|
ngShow: 'template.summary_fields.user_capabilities.edit'
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
label: i18n._('View'),
|
label: i18n._('View'),
|
||||||
@ -117,7 +117,7 @@ export default
|
|||||||
awToolTip: i18n._('View template'),
|
awToolTip: i18n._('View template'),
|
||||||
"class": 'btn-default btn-xs',
|
"class": 'btn-default btn-xs',
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: '!unified_job_templates.summary_fields.user_capabilities.edit'
|
ngShow: '!template.summary_fields.user_capabilities.edit'
|
||||||
},
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
label: i18n._('Delete'),
|
label: i18n._('Delete'),
|
||||||
@ -125,7 +125,7 @@ export default
|
|||||||
"class": 'btn-danger btn-xs',
|
"class": 'btn-danger btn-xs',
|
||||||
awToolTip: i18n._('Delete template'),
|
awToolTip: i18n._('Delete template'),
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: 'unified_job_templates.summary_fields.user_capabilities.delete'
|
ngShow: 'template.summary_fields.user_capabilities.delete'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};}]);
|
};}]);
|
||||||
|
@ -11,6 +11,7 @@ export default
|
|||||||
|
|
||||||
name: 'projects',
|
name: 'projects',
|
||||||
iterator: 'project',
|
iterator: 'project',
|
||||||
|
basePath: 'projects',
|
||||||
selectTitle: i18n._('Add Project'),
|
selectTitle: i18n._('Add Project'),
|
||||||
editTitle: i18n._('Projects'),
|
editTitle: i18n._('Projects'),
|
||||||
listTitle: i18n._('Projects'),
|
listTitle: i18n._('Projects'),
|
||||||
|
Loading…
Reference in New Issue
Block a user