mirror of
https://github.com/portainer/portainer.git
synced 2025-08-07 23:05:26 +02:00
refactor(docker/switch/component): implement new design [EE-3688] (#7239)
* refactor(docker/switch/component): implement new design [EE=3688] * revert create volume * revert por-switch on exec.html * refactor(container): switch fields on container creation page and edition page * refactor(container): switch fields on networking/secret/servicewebhook/swarmvisual * bug fixed * code review issues * merge code * fix teaser for container edition * fix encode secret toggle bug on adding secret page * fixed a bug for service webhook toggle
This commit is contained in:
parent
e07253bcef
commit
43bbeed141
15 changed files with 194 additions and 86 deletions
|
@ -111,6 +111,14 @@ angular.module('portainer.docker').controller('CreateServiceController', [
|
|||
|
||||
$scope.allowBindMounts = false;
|
||||
|
||||
$scope.handleWebHookChange = handleWebHookChange;
|
||||
|
||||
function handleWebHookChange(checked) {
|
||||
return $scope.$evalAsync(() => {
|
||||
$scope.formValues.Webhook = checked;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.handleEnvVarChange = handleEnvVarChange;
|
||||
function handleEnvVarChange(value) {
|
||||
$scope.formValues.Env = value;
|
||||
|
|
|
@ -96,14 +96,13 @@
|
|||
<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>
|
||||
<por-switch-field
|
||||
label-class="'col-sm-2'"
|
||||
checked="$ctrl.formValues.Webhook"
|
||||
label="'Create a service webhook'"
|
||||
on-change="(handleWebHookChange)"
|
||||
tooltip="'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.'"
|
||||
></por-switch-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -67,14 +67,13 @@
|
|||
</tr>
|
||||
<tr ng-if="isAdmin && applicationState.endpoint.type !== 4">
|
||||
<td colspan="{{ webhookURL ? '1' : '2' }}">
|
||||
Service webhook
|
||||
<portainer-tooltip
|
||||
position="'top'"
|
||||
message="'Webhook (or callback URI) used 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 class="switch" style="margin-left: 20px">
|
||||
<input disable-authorization="DockerServiceUpdate" type="checkbox" ng-model="WebhookExists" ng-click="updateWebhook(service)" /><i></i>
|
||||
</label>
|
||||
<por-switch-field
|
||||
tooltip="'Webhook (or callback URI) used 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.'"
|
||||
checked="WebhookExists"
|
||||
disabled="!isAdmin"
|
||||
on-change="(onWebhookChange)"
|
||||
label="'Service webhook'"
|
||||
></por-switch-field>
|
||||
</td>
|
||||
<td ng-if="webhookURL">
|
||||
<span class="text-muted">{{ webhookURL | truncatelr }}</span>
|
||||
|
|
|
@ -331,6 +331,13 @@ angular.module('portainer.docker').controller('ServiceController', [
|
|||
updateServiceArray(service, 'Hosts', service.Hosts);
|
||||
};
|
||||
|
||||
$scope.onWebhookChange = function (enabled) {
|
||||
$scope.$evalAsync(() => {
|
||||
$scope.updateWebhook($scope.service);
|
||||
$scope.WebhookExists = enabled;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateWebhook = function updateWebhook(service) {
|
||||
if ($scope.WebhookExists) {
|
||||
WebhookService.deleteWebhook($scope.webhookID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue