From cf7746082be471402ad9c0711746807716bbfcbf Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Mon, 21 Mar 2022 14:35:31 +0200 Subject: [PATCH] fix(stacks): show force pull image for git stacks [EE-2579] (#6607) --- .../git-form-auto-update-fieldset.html | 2 +- .../forms/git-form/git-form-auto-update-fieldset/index.js | 1 + app/portainer/components/forms/git-form/git-form.html | 7 ++++++- app/portainer/components/forms/git-form/git-form.js | 1 + .../stack-redeploy-git-form.controller.js | 3 +-- .../stack-redeploy-git-form/stack-redeploy-git-form.html | 6 +++++- app/portainer/views/stacks/create/createStackController.js | 2 -- app/portainer/views/stacks/create/createstack.html | 1 + 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/git-form-auto-update-fieldset.html b/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/git-form-auto-update-fieldset.html index 20877a2f0..7590dc9a0 100644 --- a/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/git-form-auto-update-fieldset.html +++ b/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/git-form-auto-update-fieldset.html @@ -51,7 +51,7 @@ /> -
+
diff --git a/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/index.js b/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/index.js index 237cb6006..6f510fb00 100644 --- a/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/index.js +++ b/app/portainer/components/forms/git-form/git-form-auto-update-fieldset/index.js @@ -6,5 +6,6 @@ export const gitFormAutoUpdateFieldset = { bindings: { model: '<', onChange: '<', + showForcePullImage: '<', }, }; diff --git a/app/portainer/components/forms/git-form/git-form.html b/app/portainer/components/forms/git-form/git-form.html index d6829ffbf..8d241e702 100644 --- a/app/portainer/components/forms/git-form/git-form.html +++ b/app/portainer/components/forms/git-form/git-form.html @@ -12,5 +12,10 @@ - + diff --git a/app/portainer/components/forms/git-form/git-form.js b/app/portainer/components/forms/git-form/git-form.js index 8e6bbf70f..17bea33e3 100644 --- a/app/portainer/components/forms/git-form/git-form.js +++ b/app/portainer/components/forms/git-form/git-form.js @@ -10,5 +10,6 @@ export const gitForm = { additionalFile: '<', autoUpdate: '<', showAuthExplanation: '<', + showForcePullImage: '<', }, }; diff --git a/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.controller.js b/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.controller.js index 8f262dd7a..7aa527f03 100644 --- a/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.controller.js +++ b/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.controller.js @@ -34,7 +34,6 @@ class StackRedeployGitFormController { RepositoryMechanism: RepositoryMechanismTypes.INTERVAL, RepositoryFetchInterval: '5m', RepositoryWebhookURL: '', - ShowForcePullImage: false, }, }; @@ -149,10 +148,10 @@ class StackRedeployGitFormController { $onInit() { this.formValues.RefName = this.model.ReferenceName; this.formValues.Env = this.stack.Env; + // Init auto update if (this.stack.AutoUpdate && (this.stack.AutoUpdate.Interval || this.stack.AutoUpdate.Webhook)) { this.formValues.AutoUpdate.RepositoryAutomaticUpdates = true; - this.formValues.AutoUpdate.ShowForcePullImage = this.stack.Type !== 3; if (this.stack.AutoUpdate.Interval) { this.formValues.AutoUpdate.RepositoryMechanism = RepositoryMechanismTypes.INTERVAL; diff --git a/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.html b/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.html index 7d0f80933..fce764ba2 100644 --- a/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.html +++ b/app/portainer/components/forms/stack-redeploy-git-form/stack-redeploy-git-form.html @@ -8,7 +8,11 @@ additional-files="$ctrl.stack.AdditionalFiles" > - +

diff --git a/app/portainer/views/stacks/create/createStackController.js b/app/portainer/views/stacks/create/createStackController.js index 13709354e..1b174ce01 100644 --- a/app/portainer/views/stacks/create/createStackController.js +++ b/app/portainer/views/stacks/create/createStackController.js @@ -53,7 +53,6 @@ angular RepositoryMechanism: RepositoryMechanismTypes.INTERVAL, RepositoryFetchInterval: '5m', RepositoryWebhookURL: WebhookHelper.returnStackWebhookUrl(uuidv4()), - ShowForcePullImage: false, }; $scope.state = { @@ -313,7 +312,6 @@ angular } $scope.composeSyntaxMaxVersion = endpoint.ComposeSyntaxMaxVersion; - $scope.formValues.ShowForcePullImage = $scope.state.StackType !== 3; try { const containers = await ContainerService.containers(true); $scope.containerNames = ContainerHelper.getContainerNames(containers); diff --git a/app/portainer/views/stacks/create/createstack.html b/app/portainer/views/stacks/create/createstack.html index 5331cf340..e0c8655d7 100644 --- a/app/portainer/views/stacks/create/createstack.html +++ b/app/portainer/views/stacks/create/createstack.html @@ -125,6 +125,7 @@ on-change="(onChangeFormValues)" additional-file="true" auto-update="true" + show-force-pull-image="true" show-auth-explanation="true" path-text-title="Compose path" path-placeholder="docker-compose.yml"