diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js
index 5f0330b4b2..18c5bf2eee 100644
--- a/awx/ui/client/src/shared/form-generator.js
+++ b/awx/ui/client/src/shared/form-generator.js
@@ -794,9 +794,21 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
}
if (field.genHash) {
- html += "\n\n";
+ const defaultGenHashButtonTemplate = `
+
+
+ `;
+ const genHashButtonTemplate = _.get(field, 'genHashButtonTemplate', defaultGenHashButtonTemplate);
+ html += `${genHashButtonTemplate}\n\n`;
}
// Add error messages
diff --git a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js
index 3e8dc913b7..7463b5f9a7 100644
--- a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js
+++ b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js
@@ -44,6 +44,7 @@
$scope.parseType = 'yaml';
$scope.credentialNotPresent = false;
$scope.canGetAllRelatedResources = true;
+ $scope.webhook_key_help = i18n._('Webhook services can use this as a shared secret.');
//
// webhook credential - all handlers, dynamic state, etc. live here
@@ -105,6 +106,8 @@
$scope.webhookCredential.modalSelectedName = null;
};
+ $scope.handleWebhookKeyButtonClick = () => {};
+
$('#content-container').append($compile(`
" + i18n._("Select a webhook service.") + "
", dataTitle: i18n._('Webhook Service'), @@ -420,36 +418,49 @@ function(NotificationsList, i18n) { webhook_url: { label: i18n._('Webhook URL'), type: 'text', - ngShow: "enable_webhooks && enable_webhooks !== 'false'", - column: 2, + ngShow: "job_template_obj && enable_webhook && enable_webhook !== 'false'", awPopOver: "webhook_url_help", awPopOverWatch: "webhook_url_help", dataPlacement: 'top', dataTitle: i18n._('Webhook URL'), dataContainer: "body", - ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)' + readonly: true }, webhook_key: { label: i18n._('Webhook Key'), type: 'text', - ngShow: "enable_webhooks && enable_webhooks !== 'false'", + ngShow: "enable_webhook && enable_webhook !== 'false'", genHash: true, - column: 2, + genHashButtonTemplate: ` + + + + `, + genHashButtonClickHandlerName: "handleWebhookKeyButtonClick", awPopOver: "webhook_key_help", awPopOverWatch: "webhook_key_help", dataPlacement: 'right', - dataTitle: i18n._("Webhook Config Key"), + dataTitle: i18n._("Webhook Key"), dataContainer: "body", - ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)', - awRequiredWhen: { - reqExpression: 'enable_webhooks', - alwaysShowAsterisk: true - } + readonly: true, + required: false, }, webhook_credential: { label: i18n._('Webhook Credential'), type: 'custom', - ngShow: "enable_webhooks && enable_webhooks !== 'false'", + ngShow: "enable_webhook && enable_webhook !== 'false'", control: `