mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 18:21:03 -03:30
Merge pull request #3503 from kialam/fix-3421-wf-viz-popover
Format jt details for popover use. Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<div class="List-infoCell" ng-if="wf_maker_template.type === 'job_template'">
|
<div class="List-infoCell" ng-if="wf_maker_template.type === 'job_template'">
|
||||||
<span class="Key-icon Key-icon--circle Key-icon--default" aw-pop-over="<dl><dt>{{ 'INVENTORY' | translate }}</dt><dd>{{(wf_maker_template.summary_fields.inventory.name | sanitize) || ('NONE SELECTED' | translate)}}</dd></dl><dl><dt>{{ 'PROJECT' | translate }}</dt><dd>{{wf_maker_template.summary_fields.project.name | sanitize}}</dd></dl><dl><dt>{{ 'PLAYBOOK' | translate }}</dt><dd>{{wf_maker_template.playbook| sanitize}}</dd></dl><dl><dt>{{ 'CREDENTIAL' | translate }}</dt> <dd>{{(wf_maker_template.summary_fields.credential.name | sanitize) || ('NONE SELECTED' | translate)}}</dd></dl>"
|
<span class="Key-icon Key-icon--circle Key-icon--default" aw-pop-over="<dl><dt>{{ 'INVENTORY' | translate }}</dt><dd>{{wf_maker_template.popOverDetails.inventory | sanitize}}</dd></dl><dl><dt>{{ 'PROJECT' | translate }}</dt><dd>{{wf_maker_template.popOverDetails.project | sanitize}}</dd></dl><dl><dt>{{ 'PLAYBOOK' | translate }}</dt><dd>{{wf_maker_template.popOverDetails.playbook | sanitize}}</dd></dl><dl><dt>{{ 'CREDENTIAL' | translate }}</dt> <dd>{{wf_maker_template.popOverDetails.credentials | sanitize}}</dd></dl>"
|
||||||
data-popover-title="{{wf_maker_template.name| sanitize}}">?</span>
|
data-popover-title="{{wf_maker_template.name| sanitize}}">?</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -656,6 +656,28 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatPopOverDetails = (model) => {
|
||||||
|
model.popOverDetails = {};
|
||||||
|
model.popOverDetails.playbook = model.playbook || i18n._('NONE SELECTED');
|
||||||
|
Object.keys(model.summary_fields).forEach(field => {
|
||||||
|
if (field === 'project') {
|
||||||
|
model.popOverDetails.project = model.summary_fields[field].name || i18n._('NONE SELECTED');
|
||||||
|
}
|
||||||
|
if (field === 'inventory') {
|
||||||
|
model.popOverDetails.inventory = model.summary_fields[field].name || i18n._('NONE SELECTED');
|
||||||
|
}
|
||||||
|
if (field === 'credentials') {
|
||||||
|
if (model.summary_fields[field].length <= 0) {
|
||||||
|
model.popOverDetails.credentials = i18n._('NONE SELECTED');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const credentialNames = model.summary_fields[field].map(({name}) => name);
|
||||||
|
model.popOverDetails.credentials = credentialNames.join('<br />');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.openPromptModal = () => {
|
$scope.openPromptModal = () => {
|
||||||
$scope.promptData.triggerModalOpen = true;
|
$scope.promptData.triggerModalOpen = true;
|
||||||
};
|
};
|
||||||
@@ -677,6 +699,9 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
|
|||||||
switch($scope.activeTab) {
|
switch($scope.activeTab) {
|
||||||
case 'jobs':
|
case 'jobs':
|
||||||
$scope.wf_maker_templates.forEach((row, i) => {
|
$scope.wf_maker_templates.forEach((row, i) => {
|
||||||
|
if (row.type === 'job_template') {
|
||||||
|
formatPopOverDetails(row);
|
||||||
|
}
|
||||||
if(row.id === unifiedJobTemplateId) {
|
if(row.id === unifiedJobTemplateId) {
|
||||||
$scope.wf_maker_templates[i].checked = 1;
|
$scope.wf_maker_templates[i].checked = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user