add launched-by-webhook details to job runs

This commit is contained in:
Jake McDermott
2019-09-10 10:24:49 -04:00
committed by Jeff Bradberry
parent 00337990db
commit 6b17e86f30
6 changed files with 40 additions and 3 deletions

View File

@@ -251,10 +251,12 @@ function getHostLimitErrorDetails () {
function getLaunchedByDetails () { function getLaunchedByDetails () {
const createdBy = resource.model.get('summary_fields.created_by'); const createdBy = resource.model.get('summary_fields.created_by');
const jobTemplate = resource.model.get('summary_fields.job_template'); 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 relatedSchedule = resource.model.get('related.schedule');
const schedule = resource.model.get('summary_fields.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; return null;
} }
@@ -272,6 +274,14 @@ function getLaunchedByDetails () {
tooltip = strings.get('tooltips.SCHEDULE'); tooltip = strings.get('tooltips.SCHEDULE');
link = `/#/templates/job_template/${jobTemplate.id}/schedules/${schedule.id}`; link = `/#/templates/job_template/${jobTemplate.id}/schedules/${schedule.id}`;
value = $filter('sanitize')(schedule.name); 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 { } else {
tooltip = null; tooltip = null;
link = null; link = null;

View File

@@ -38,6 +38,8 @@ function OutputStrings (BaseString) {
MENU_UP: t.s('Get previous page'), MENU_UP: t.s('Get previous page'),
MENU_LAST: t.s('Go to last page of available output'), MENU_LAST: t.s('Go to last page of available output'),
MENU_FOLLOWING: t.s('Currently following output as it arrives. Click to unfollow'), 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 = { ns.details = {
@@ -48,6 +50,7 @@ function OutputStrings (BaseString) {
SHOW_LESS: t.s('Show Less'), SHOW_LESS: t.s('Show Less'),
SHOW_MORE: t.s('Show More'), SHOW_MORE: t.s('Show More'),
UNKNOWN: t.s('Finished'), UNKNOWN: t.s('Finished'),
WEBHOOK: t.s('Webhook'),
}; };
ns.labels = { ns.labels = {

View File

@@ -343,7 +343,7 @@ function(NotificationsList, i18n) {
label: i18n._('Webhooks'), label: i18n._('Webhooks'),
type: 'checkbox', type: 'checkbox',
column: 2, column: 2,
awPopOver: "<p>" + i18n._("Enabled webhook for this job template.") + "</p>", awPopOver: "<p>" + i18n._("Enable webhook for this job template.") + "</p>",
dataPlacement: 'right', dataPlacement: 'right',
dataTitle: i18n._('Enable Webhook'), dataTitle: i18n._('Enable Webhook'),
dataContainer: "body", dataContainer: "body",

View File

@@ -167,7 +167,7 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
label: i18n._('Webhooks'), label: i18n._('Webhooks'),
type: 'checkbox', type: 'checkbox',
column: 2, 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', dataPlacement: 'right',
dataTitle: i18n._('Enable Webhook'), dataTitle: i18n._('Enable Webhook'),
dataContainer: "body", dataContainer: "body",

View File

@@ -37,6 +37,11 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
$scope.cloud_credential_link = getLink('cloud_credential'); $scope.cloud_credential_link = getLink('cloud_credential');
$scope.network_credential_link = getLink('network_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) {
if ($scope.workflow.summary_fields.inventory.kind === 'smart') { if ($scope.workflow.summary_fields.inventory.kind === 'smart') {
$scope.inventory_link = '/#/inventories/smart/' + $scope.workflow.inventory; $scope.inventory_link = '/#/inventories/smart/' + $scope.workflow.inventory;
@@ -57,6 +62,7 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
EDIT_INVENTORY: i18n._('Edit the inventory'), EDIT_INVENTORY: i18n._('Edit the inventory'),
SOURCE_WORKFLOW_JOB: i18n._('View the source Workflow Job'), SOURCE_WORKFLOW_JOB: i18n._('View the source Workflow Job'),
TOGGLE_STDOUT_FULLSCREEN: i18n._('Expand Output'), TOGGLE_STDOUT_FULLSCREEN: i18n._('Expand Output'),
WEBHOOK_WORKFLOW_JOB_TEMPLATE: i18n._('View the webhook configuration on the workflow job template.'),
STATUS: '' // re-assigned elsewhere STATUS: '' // re-assigned elsewhere
}, },
labels: { labels: {
@@ -79,6 +85,7 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
NOT_STARTED: i18n._('Not Started'), NOT_STARTED: i18n._('Not Started'),
SHOW_LESS: i18n._('Show Less'), SHOW_LESS: i18n._('Show Less'),
SHOW_MORE: i18n._('Show More'), SHOW_MORE: i18n._('Show More'),
WEBHOOK: i18n._('Webhook'),
}, },
results: { results: {
TOTAL_NODES: i18n._('Total Nodes'), TOTAL_NODES: i18n._('Total Nodes'),

View File

@@ -206,6 +206,23 @@
</div> </div>
</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 --> <!-- SLIIIIIICE -->
<div class="WorkflowResults-resultRow" <div class="WorkflowResults-resultRow"
ng-show="workflow.summary_fields.job_template.name"> ng-show="workflow.summary_fields.job_template.name">