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', 'HttpRequestHelper',
'NodeService', 'NodeService',
'WebhookService', 'WebhookService',
'EndpointProvider',
'endpoint', 'endpoint',
function ( function (
$q, $q,
@ -57,9 +56,10 @@ angular.module('portainer.docker').controller('CreateServiceController', [
HttpRequestHelper, HttpRequestHelper,
NodeService, NodeService,
WebhookService, WebhookService,
EndpointProvider,
endpoint endpoint
) { ) {
$scope.endpoint = endpoint;
$scope.formValues = { $scope.formValues = {
Name: '', Name: '',
RegistryModel: new PorImageRegistryModel(), RegistryModel: new PorImageRegistryModel(),
@ -493,7 +493,7 @@ angular.module('portainer.docker').controller('CreateServiceController', [
const resourceControl = data.Portainer.ResourceControl; const resourceControl = data.Portainer.ResourceControl;
const userId = Authentication.getUserDetails().ID; const userId = Authentication.getUserDetails().ID;
const rcPromise = ResourceControlService.applyResourceControl(userId, accessControlData, resourceControl); 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]); return $q.all([rcPromise, webhookPromise]);
}) })
.then(function success() { .then(function success() {

View File

@ -95,19 +95,21 @@
</div> </div>
<!-- !port-mapping --> <!-- !port-mapping -->
<!-- create-webhook --> <!-- create-webhook -->
<div class="col-sm-12 form-section-title"> <div ng-if="endpoint.Type !== 4">
Webhooks <div class="col-sm-12 form-section-title">
</div> Webhooks
<div class="form-group"> </div>
<div class="col-sm-12"> <div class="form-group">
<label class="control-label text-left"> <div class="col-sm-12">
Create a service webhook <label class="control-label text-left">
<portainer-tooltip Create a service webhook
position="top" <portainer-tooltip
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." position="top"
></portainer-tooltip> 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."
</label> ></portainer-tooltip>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" ng-model="formValues.Webhook" /><i></i> </label> </label>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" ng-model="formValues.Webhook" /><i></i> </label>
</div>
</div> </div>
</div> </div>
<!-- !create-webhook --> <!-- !create-webhook -->