mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 10:41:05 -03:30
add webhook url field
This commit is contained in:
committed by
Jeff Bradberry
parent
17b34b1e36
commit
f5c151d5c4
@@ -343,6 +343,7 @@
|
|||||||
// be provided to the related credentials endpoint by the template save success handler.
|
// be provided to the related credentials endpoint by the template save success handler.
|
||||||
delete data.credential;
|
delete data.credential;
|
||||||
delete data.vault_credential;
|
delete data.vault_credential;
|
||||||
|
delete data.webhook_url;
|
||||||
|
|
||||||
data.extra_vars = ToJSON($scope.parseType, $scope.extra_vars, true);
|
data.extra_vars = ToJSON($scope.parseType, $scope.extra_vars, true);
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export default
|
|||||||
$scope.webhook_service_options = null;
|
$scope.webhook_service_options = null;
|
||||||
$scope.playbook = null;
|
$scope.playbook = null;
|
||||||
$scope.webhook_service = null;
|
$scope.webhook_service = null;
|
||||||
|
$scope.webhook_url = '';
|
||||||
$scope.mode = 'edit';
|
$scope.mode = 'edit';
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
$scope.showJobType = false;
|
$scope.showJobType = false;
|
||||||
@@ -74,6 +75,7 @@ export default
|
|||||||
$scope.skip_tag_options = [];
|
$scope.skip_tag_options = [];
|
||||||
const virtualEnvs = ConfigData.custom_virtualenvs || [];
|
const virtualEnvs = ConfigData.custom_virtualenvs || [];
|
||||||
$scope.custom_virtualenvs_options = virtualEnvs;
|
$scope.custom_virtualenvs_options = virtualEnvs;
|
||||||
|
$scope.webhook_url_help = i18n._('Webhook services can launch jobs with this job template by making a POST request to this URL.');
|
||||||
|
|
||||||
SurveyControllerInit({
|
SurveyControllerInit({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -179,7 +181,21 @@ export default
|
|||||||
|
|
||||||
// watch for changes to 'verbosity', ensure we keep our select2 in sync when it changes.
|
// watch for changes to 'verbosity', ensure we keep our select2 in sync when it changes.
|
||||||
$scope.$watch('verbosity', sync_verbosity_select2);
|
$scope.$watch('verbosity', sync_verbosity_select2);
|
||||||
$scope.$watch('webhook_service', sync_webhook_service_select2);
|
$scope.$watch('webhook_service', (newValue) => {
|
||||||
|
if (newValue) {
|
||||||
|
// TODO: We'll need the host from the server.
|
||||||
|
const baseURL = window.location.origin;
|
||||||
|
if (typeof newValue === 'string') {
|
||||||
|
$scope.webhook_url = `${baseURL}${jobTemplateData.url}${newValue}`;
|
||||||
|
$scope.webhook_service = { value: newValue };
|
||||||
|
} else {
|
||||||
|
$scope.webhook_url = `${baseURL}${jobTemplateData.url}${newValue.value}`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$scope.webhook_url = '';
|
||||||
|
}
|
||||||
|
sync_webhook_service_select2();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
callback = function() {
|
callback = function() {
|
||||||
@@ -759,6 +775,7 @@ export default
|
|||||||
|
|
||||||
data.job_tags = (Array.isArray($scope.job_tags)) ? _.uniq($scope.job_tags).join() : "";
|
data.job_tags = (Array.isArray($scope.job_tags)) ? _.uniq($scope.job_tags).join() : "";
|
||||||
data.skip_tags = (Array.isArray($scope.skip_tags)) ? _.uniq($scope.skip_tags).join() : "";
|
data.skip_tags = (Array.isArray($scope.skip_tags)) ? _.uniq($scope.skip_tags).join() : "";
|
||||||
|
delete data.webhook_url;
|
||||||
|
|
||||||
Rest.setUrl(defaultUrl + $state.params.job_template_id);
|
Rest.setUrl(defaultUrl + $state.params.job_template_id);
|
||||||
Rest.patch(data)
|
Rest.patch(data)
|
||||||
|
|||||||
@@ -406,6 +406,19 @@ function(NotificationsList, i18n) {
|
|||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body",
|
dataContainer: "body",
|
||||||
},
|
},
|
||||||
|
webhook_url: {
|
||||||
|
label: i18n._('Webhook URL'),
|
||||||
|
type: 'text',
|
||||||
|
readonly: true,
|
||||||
|
//ngShow: "allow_webhooks && allow_webhooks !== 'false'",
|
||||||
|
column: 2,
|
||||||
|
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)'
|
||||||
|
},
|
||||||
extra_vars: {
|
extra_vars: {
|
||||||
label: i18n._('Extra Variables'),
|
label: i18n._('Extra Variables'),
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
|
|||||||
Reference in New Issue
Block a user