add static messages to workflow inventory lookups

This commit is contained in:
Jake McDermott 2018-11-11 21:56:59 -05:00
parent 9917841585
commit 9a4667c6c7
No known key found for this signature in database
GPG Key ID: 9A6F084352C3A0B7
4 changed files with 26 additions and 8 deletions

View File

@ -494,6 +494,10 @@ export default ['$compile', 'Attr', 'Icon',
html += `></paginate></div>`;
}
if (options.mode === 'lookup' && options.lookupMessage) {
html = `<div class="Prompt-bodyQuery">${options.lookupMessage}</div>` + html;
}
return html;
},

View File

@ -806,13 +806,19 @@ function($injector, $stateExtender, $log, i18n) {
views: {
'modal': {
templateProvider: function(ListDefinition, generateList) {
let list_html = generateList.build({
const listConfig = {
mode: 'lookup',
list: ListDefinition,
input_type: 'radio'
});
return `<lookup-modal>${list_html}</lookup-modal>`;
};
if (field.lookupMessage) {
listConfig.lookupMessage = field.lookupMessage;
}
let list_html = generateList.build(listConfig);
return `<lookup-modal>${list_html}</lookup-modal>`;
}
}
},

View File

@ -6,8 +6,8 @@
import promptInventoryController from './prompt-inventory.controller';
export default [ 'templateUrl', 'QuerySet', 'GetBasePath', 'generateList', '$compile', 'InventoryList',
(templateUrl, qs, GetBasePath, GenerateList, $compile, InventoryList) => {
export default [ 'templateUrl', 'QuerySet', 'GetBasePath', 'generateList', '$compile', 'InventoryList', 'i18n',
(templateUrl, qs, GetBasePath, GenerateList, $compile, InventoryList, i18n) => {
return {
scope: {
promptData: '=',
@ -46,11 +46,18 @@ export default [ 'templateUrl', 'QuerySet', 'GetBasePath', 'generateList', '$com
let invList = _.cloneDeep(InventoryList);
invList.disableRow = "{{ readOnlyPrompts }}";
invList.disableRowValue = "readOnlyPrompts";
let html = GenerateList.build({
const listConfig = {
list: invList,
input_type: 'radio',
mode: 'lookup'
});
mode: 'lookup',
};
if (scope.promptData.templateType === "workflow_job_template") {
listConfig.lookupMessage = i18n._("This inventory is applied to all job templates nodes that prompt for an inventory.");
}
let html = GenerateList.build(listConfig);
scope.list = invList;

View File

@ -71,6 +71,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
inventory: {
label: i18n._('Inventory'),
type: 'lookup',
lookupMessage: i18n._("This inventory is applied to all job templates nodes that prompt for an inventory."),
basePath: 'inventory',
list: 'InventoryList',
sourceModel: 'inventory',