1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 13:55:31 +03:00

add webhook service field

This commit is contained in:
Jake McDermott 2019-09-04 17:43:02 -04:00 committed by Jeff Bradberry
parent ee1d118752
commit 17b34b1e36
3 changed files with 62 additions and 1 deletions

View File

@ -39,6 +39,7 @@
$scope.can_edit = true;
$scope.allow_callbacks = false;
$scope.playbook_options = [];
$scope.webhook_service_options = [];
$scope.mode = "add";
$scope.parseType = 'yaml';
$scope.credentialNotPresent = false;
@ -131,6 +132,14 @@
multiple: false,
opts: $scope.custom_virtualenvs_options
});
CreateSelect2({
element:'#webhook-service-select',
addNew: false,
multiple: false,
scope: $scope,
options: 'webhook_service_options',
model: 'webhook_service'
});
}
});
@ -151,7 +160,13 @@
variable: 'job_type_options',
callback: 'choicesReadyVerbosity'
});
GetChoices({
scope: $scope,
url: defaultUrl,
field: 'webhook_service',
variable: 'webhook_service_options',
callback: 'choicesReadyVerbosity'
});
$scope.labelOptions = availableLabels
.map((i) => ({label: i.name, value: i.id}));
$scope.$emit("choicesReadyVerbosity");

View File

@ -61,7 +61,9 @@ export default
$scope.sufficientRoleForNotifToggle = isNotificationAdmin;
$scope.sufficientRoleForNotif = isNotificationAdmin || $scope.user_is_system_auditor;
$scope.playbook_options = null;
$scope.webhook_service_options = null;
$scope.playbook = null;
$scope.webhook_service = null;
$scope.mode = 'edit';
$scope.parseType = 'yaml';
$scope.showJobType = false;
@ -177,6 +179,7 @@ export default
// watch for changes to 'verbosity', ensure we keep our select2 in sync when it changes.
$scope.$watch('verbosity', sync_verbosity_select2);
$scope.$watch('webhook_service', sync_webhook_service_select2);
}
callback = function() {
@ -202,7 +205,19 @@ export default
}));
}
function sync_webhook_service_select2() {
select2LoadDefer.push(CreateSelect2({
element:'#webhook-service-select',
addNew: false,
multiple: false,
scope: $scope,
options: 'webhook_service_options',
model: 'webhook_service'
}));
}
function jobTemplateLoadFinished(){
//$scope.webhook_service = jobTemplateData.webhook_service;
select2LoadDefer.push(CreateSelect2({
element:'#job_template_job_type',
multiple: false
@ -225,6 +240,14 @@ export default
multiple: false,
opts: $scope.custom_virtualenvs_options
}));
select2LoadDefer.push(CreateSelect2({
element:'#webhook-service-select',
addNew: false,
multiple: false,
scope: $scope,
options: 'webhook_service_options',
model: 'webhook_service'
}));
if (!launchHasBeenEnabled) {
$q.all(select2LoadDefer).then(() => {
@ -498,6 +521,14 @@ export default
callback: 'choicesReady'
});
GetChoices({
scope: $scope,
url: defaultUrl,
field: 'webhook_service',
variable: 'webhook_service_options',
callback: 'choicesReady'
});
$scope.labelOptions = availableLabels
.map((i) => ({label: i.name, value: i.id}));

View File

@ -391,6 +391,21 @@ function(NotificationsList, i18n) {
alwaysShowAsterisk: true
}
},
webhook_service: {
label: i18n._('Webhook Service'),
type:'select',
defaultText: i18n._('Choose a Webhook Service'),
ngOptions: 'svc.label for svc in webhook_service_options track by svc.value',
ngShow: true,
ngDisabled: "!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || !canGetAllRelatedResources",
id: 'webhook-service-select',
required: false,
column: 1,
awPopOver: "<p>" + i18n._("Select a webhook service.") + "</p>",
dataTitle: i18n._('Webhook Service'),
dataPlacement: 'right',
dataContainer: "body",
},
extra_vars: {
label: i18n._('Extra Variables'),
type: 'textarea',