feat(services): hide webhook interface (#4794)

pull/4414/merge
Chaim Lev-Ari 2021-02-25 00:08:22 +02:00 committed by GitHub
parent 7e7127831d
commit c72d07441d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 16 deletions

View File

@ -31,7 +31,6 @@ angular.module('portainer.docker').controller('CreateServiceController', [
'HttpRequestHelper',
'NodeService',
'WebhookService',
'EndpointProvider',
'endpoint',
function (
$q,
@ -57,9 +56,10 @@ angular.module('portainer.docker').controller('CreateServiceController', [
HttpRequestHelper,
NodeService,
WebhookService,
EndpointProvider,
endpoint
) {
$scope.endpoint = endpoint;
$scope.formValues = {
Name: '',
RegistryModel: new PorImageRegistryModel(),
@ -493,7 +493,7 @@ angular.module('portainer.docker').controller('CreateServiceController', [
const resourceControl = data.Portainer.ResourceControl;
const userId = Authentication.getUserDetails().ID;
const rcPromise = ResourceControlService.applyResourceControl(userId, accessControlData, resourceControl);
const webhookPromise = $q.when($scope.formValues.Webhook && WebhookService.createServiceWebhook(serviceId, EndpointProvider.endpointID()));
const webhookPromise = $q.when(endpoint.Type !== 4 && $scope.formValues.Webhook && WebhookService.createServiceWebhook(serviceId, endpoint.ID));
return $q.all([rcPromise, webhookPromise]);
})
.then(function success() {

View File

@ -95,19 +95,21 @@
</div>
<!-- !port-mapping -->
<!-- create-webhook -->
<div class="col-sm-12 form-section-title">
Webhooks
</div>
<div class="form-group">
<div class="col-sm-12">
<label class="control-label text-left">
Create a service webhook
<portainer-tooltip
position="top"
message="Create a webhook (or callback URI) to automate the update of this service. Sending a POST request to this callback URI (without requiring any authentication) will pull the most up-to-date version of the associated image and re-deploy this service."
></portainer-tooltip>
</label>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" ng-model="formValues.Webhook" /><i></i> </label>
<div ng-if="endpoint.Type !== 4">
<div class="col-sm-12 form-section-title">
Webhooks
</div>
<div class="form-group">
<div class="col-sm-12">
<label class="control-label text-left">
Create a service webhook
<portainer-tooltip
position="top"
message="Create a webhook (or callback URI) to automate the update of this service. Sending a POST request to this callback URI (without requiring any authentication) will pull the most up-to-date version of the associated image and re-deploy this service."
></portainer-tooltip>
</label>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" ng-model="formValues.Webhook" /><i></i> </label>
</div>
</div>
</div>
<!-- !create-webhook -->