mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
add launched-by-webhook details to job runs
This commit is contained in:
committed by
Jeff Bradberry
parent
00337990db
commit
6b17e86f30
@@ -251,10 +251,12 @@ function getHostLimitErrorDetails () {
|
||||
function getLaunchedByDetails () {
|
||||
const createdBy = resource.model.get('summary_fields.created_by');
|
||||
const jobTemplate = resource.model.get('summary_fields.job_template');
|
||||
const workflowJobTemplate = resource.model.get('summary_fields.workflow_job_template');
|
||||
const relatedSchedule = resource.model.get('related.schedule');
|
||||
const schedule = resource.model.get('summary_fields.schedule');
|
||||
const webhookGUID = resource.model.get('webhook_guid');
|
||||
|
||||
if (!createdBy && !schedule) {
|
||||
if (!createdBy && !schedule && !webhookGUID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -272,6 +274,14 @@ function getLaunchedByDetails () {
|
||||
tooltip = strings.get('tooltips.SCHEDULE');
|
||||
link = `/#/templates/job_template/${jobTemplate.id}/schedules/${schedule.id}`;
|
||||
value = $filter('sanitize')(schedule.name);
|
||||
} else if (webhookGUID && jobTemplate) {
|
||||
tooltip = strings.get('tooltips.WEBHOOK_JOB_TEMPLATE');
|
||||
link = `/#/templates/job_template/${jobTemplate.id}`;
|
||||
value = strings.get('details.WEBHOOK');
|
||||
} else if (webhookGUID && workflowJobTemplate) {
|
||||
tooltip = strings.get('tooltips.WEBHOOK_WORKFLOW_JOB_TEMPLATE');
|
||||
link = `/#/templates/workflow_job_template/${workflowJobTemplate.id}`;
|
||||
value = strings.get('details.WEBHOOK');
|
||||
} else {
|
||||
tooltip = null;
|
||||
link = null;
|
||||
|
||||
@@ -38,6 +38,8 @@ function OutputStrings (BaseString) {
|
||||
MENU_UP: t.s('Get previous page'),
|
||||
MENU_LAST: t.s('Go to last page of available output'),
|
||||
MENU_FOLLOWING: t.s('Currently following output as it arrives. Click to unfollow'),
|
||||
WEBHOOK_JOB_TEMPLATE: t.s('View the webhook configuration on the job template.'),
|
||||
WEBHOOK_WORKFLOW_JOB_TEMPLATE: t.s('View the webhook configuration on the workflow job template.'),
|
||||
};
|
||||
|
||||
ns.details = {
|
||||
@@ -48,6 +50,7 @@ function OutputStrings (BaseString) {
|
||||
SHOW_LESS: t.s('Show Less'),
|
||||
SHOW_MORE: t.s('Show More'),
|
||||
UNKNOWN: t.s('Finished'),
|
||||
WEBHOOK: t.s('Webhook'),
|
||||
};
|
||||
|
||||
ns.labels = {
|
||||
|
||||
@@ -343,7 +343,7 @@ function(NotificationsList, i18n) {
|
||||
label: i18n._('Webhooks'),
|
||||
type: 'checkbox',
|
||||
column: 2,
|
||||
awPopOver: "<p>" + i18n._("Enabled webhook for this job template.") + "</p>",
|
||||
awPopOver: "<p>" + i18n._("Enable webhook for this job template.") + "</p>",
|
||||
dataPlacement: 'right',
|
||||
dataTitle: i18n._('Enable Webhook'),
|
||||
dataContainer: "body",
|
||||
|
||||
@@ -167,7 +167,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
||||
label: i18n._('Webhooks'),
|
||||
type: 'checkbox',
|
||||
column: 2,
|
||||
awPopOver: "<p>" + i18n._("Enabled webhook for this workflow job template.") + "</p>",
|
||||
awPopOver: "<p>" + i18n._("Enable webhooks for this workflow job template.") + "</p>",
|
||||
dataPlacement: 'right',
|
||||
dataTitle: i18n._('Enable Webhook'),
|
||||
dataContainer: "body",
|
||||
|
||||
@@ -37,6 +37,11 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
|
||||
$scope.cloud_credential_link = getLink('cloud_credential');
|
||||
$scope.network_credential_link = getLink('network_credential');
|
||||
|
||||
$scope.launched_by_webhook_link = null;
|
||||
if ($scope.workflow.webhook_guid) {
|
||||
$scope.launched_by_webhook_link = $scope.workflow_template_link;
|
||||
}
|
||||
|
||||
if ($scope.workflow.summary_fields.inventory) {
|
||||
if ($scope.workflow.summary_fields.inventory.kind === 'smart') {
|
||||
$scope.inventory_link = '/#/inventories/smart/' + $scope.workflow.inventory;
|
||||
@@ -57,6 +62,7 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
|
||||
EDIT_INVENTORY: i18n._('Edit the inventory'),
|
||||
SOURCE_WORKFLOW_JOB: i18n._('View the source Workflow Job'),
|
||||
TOGGLE_STDOUT_FULLSCREEN: i18n._('Expand Output'),
|
||||
WEBHOOK_WORKFLOW_JOB_TEMPLATE: i18n._('View the webhook configuration on the workflow job template.'),
|
||||
STATUS: '' // re-assigned elsewhere
|
||||
},
|
||||
labels: {
|
||||
@@ -79,6 +85,7 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
|
||||
NOT_STARTED: i18n._('Not Started'),
|
||||
SHOW_LESS: i18n._('Show Less'),
|
||||
SHOW_MORE: i18n._('Show More'),
|
||||
WEBHOOK: i18n._('Webhook'),
|
||||
},
|
||||
results: {
|
||||
TOTAL_NODES: i18n._('Total Nodes'),
|
||||
|
||||
@@ -206,6 +206,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- LAUNCHED BY WEBHOOK DETAIL -->
|
||||
<div class="WorkflowResults-resultRow toggle-show"
|
||||
ng-show="launched_by_webhook_link">
|
||||
<label
|
||||
class="WorkflowResults-resultRowLabel">
|
||||
{{ strings.labels.LAUNCHED_BY }}
|
||||
</label>
|
||||
<div class="WorkflowResults-resultRowText">
|
||||
<a href="{{ launched_by_webhook_link }}"
|
||||
aw-tool-tip="{{ strings.tooltips.WEBHOOK_WORKFLOW_JOB_TEMPLATE }}"
|
||||
data-placement="top">
|
||||
{{ strings.details.WEBHOOK }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SLIIIIIICE -->
|
||||
<div class="WorkflowResults-resultRow"
|
||||
ng-show="workflow.summary_fields.job_template.name">
|
||||
|
||||
Reference in New Issue
Block a user