diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index 3d87c1308..8ea5925b1 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -57,10 +57,8 @@ diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js index 4cad583b0..5478e11c0 100644 --- a/app/kubernetes/views/applications/create/createApplicationController.js +++ b/app/kubernetes/views/applications/create/createApplicationController.js @@ -130,12 +130,6 @@ class KubernetesCreateApplicationController { this.state.useServerMetrics = false; this.formValues = new KubernetesApplicationFormValues(); - this.gitFormValues = { - RefName: '', - RepositoryAuthentication: false, - RepositoryUsername: '', - RepositoryPassword: '', - }; this.updateApplicationAsync = this.updateApplicationAsync.bind(this); this.deployApplicationAsync = this.deployApplicationAsync.bind(this); @@ -1033,11 +1027,6 @@ class KubernetesCreateApplicationController { if (this.application.StackId) { if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.GIT) { this.stack = await this.StackService.stack(this.application.StackId); - this.gitFormValues.RefName = this.stack.GitConfig.ReferenceName; - if (this.stack.GitConfig && this.stack.GitConfig.Authentication) { - this.gitFormValues.RepositoryUsername = this.stack.GitConfig.Authentication.Username; - this.gitFormValues.RepositoryAuthentication = true; - } } else if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.CONTENT) { this.stackFileContent = await this.StackService.getStackFile(this.application.StackId); } diff --git a/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.controller.js b/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.controller.js index 1ada91fcf..b2ec4c90a 100644 --- a/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.controller.js +++ b/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.controller.js @@ -14,6 +14,13 @@ class KubernetesAppGitFormController { isEdit: false, }; + this.formValues = { + RefName: '', + RepositoryAuthentication: false, + RepositoryUsername: '', + RepositoryPassword: '', + }; + this.onChange = this.onChange.bind(this); this.onChangeRef = this.onChangeRef.bind(this); } @@ -23,8 +30,8 @@ class KubernetesAppGitFormController { } onChange(values) { - this.gitFormValues = { - ...this.gitFormValues, + this.formValues = { + ...this.formValues, ...values, }; } @@ -46,8 +53,8 @@ class KubernetesAppGitFormController { return; } this.state.redeployInProgress = true; + await this.StackService.updateKubeGit(this.stack.Id, this.stack.EndpointId, this.namespace, this.formValues); this.Notifications.success('Pulled and redeployed stack successfully'); - await this.StackService.updateKubeGit(this.stack.Id, this.stack.EndpointId, this.namespace, this.gitFormValues); await this.$state.reload(); } catch (err) { this.Notifications.error('Failure', err, 'Failed redeploying application'); @@ -61,7 +68,7 @@ class KubernetesAppGitFormController { return this.$async(async () => { try { this.state.saveGitSettingsInProgress = true; - await this.StackService.updateKubeStack({ EndpointId: this.stack.EndpointId, Id: this.stack.Id }, null, this.gitFormValues); + await this.StackService.updateKubeStack({ EndpointId: this.stack.EndpointId, Id: this.stack.Id }, null, this.formValues); this.Notifications.success('Save stack settings successfully'); } catch (err) { this.Notifications.error('Failure', err, 'Unable to save application settings'); @@ -76,6 +83,7 @@ class KubernetesAppGitFormController { } $onInit() { + this.formValues.RefName = this.stack.GitConfig.ReferenceName; if (this.stack.GitConfig && this.stack.GitConfig.Authentication) { this.formValues.RepositoryUsername = this.stack.GitConfig.Authentication.Username; this.formValues.RepositoryAuthentication = true; diff --git a/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.html b/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.html index aefa5bed9..b0779d876 100644 --- a/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.html +++ b/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.html @@ -24,7 +24,7 @@ diff --git a/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.js b/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.js index 7cdf6914f..7a21a6384 100644 --- a/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.js +++ b/app/portainer/components/forms/kubernetes-app-git-form/kubernetes-app-git-form.js @@ -5,10 +5,8 @@ const kubernetesAppGitForm = { templateUrl: './kubernetes-app-git-form.html', controller, bindings: { - gitFormValues: '<', namespace: '<', stack: '<', - isEdit: '<', }, };