mirror of
https://github.com/portainer/portainer.git
synced 2025-07-30 02:39:41 +02:00
moved formvalue to kube app component
This commit is contained in:
parent
6d87c77ab0
commit
87ef8092ba
5 changed files with 13 additions and 20 deletions
|
@ -57,10 +57,8 @@
|
||||||
<!-- #region Git repository -->
|
<!-- #region Git repository -->
|
||||||
<kubernetes-app-git-form
|
<kubernetes-app-git-form
|
||||||
ng-if="ctrl.state.appType === ctrl.KubernetesDeploymentTypes.GIT"
|
ng-if="ctrl.state.appType === ctrl.KubernetesDeploymentTypes.GIT"
|
||||||
git-form-values="ctrl.gitFormValues"
|
|
||||||
stack="ctrl.stack"
|
stack="ctrl.stack"
|
||||||
namespace="ctrl.formValues.ResourcePool.Namespace.Name"
|
namespace="ctrl.formValues.ResourcePool.Namespace.Name"
|
||||||
is-edit="ctrl.state.isEdit"
|
|
||||||
></kubernetes-app-git-form>
|
></kubernetes-app-git-form>
|
||||||
<!-- #endregion -->
|
<!-- #endregion -->
|
||||||
|
|
||||||
|
|
|
@ -130,12 +130,6 @@ class KubernetesCreateApplicationController {
|
||||||
this.state.useServerMetrics = false;
|
this.state.useServerMetrics = false;
|
||||||
|
|
||||||
this.formValues = new KubernetesApplicationFormValues();
|
this.formValues = new KubernetesApplicationFormValues();
|
||||||
this.gitFormValues = {
|
|
||||||
RefName: '',
|
|
||||||
RepositoryAuthentication: false,
|
|
||||||
RepositoryUsername: '',
|
|
||||||
RepositoryPassword: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
this.updateApplicationAsync = this.updateApplicationAsync.bind(this);
|
this.updateApplicationAsync = this.updateApplicationAsync.bind(this);
|
||||||
this.deployApplicationAsync = this.deployApplicationAsync.bind(this);
|
this.deployApplicationAsync = this.deployApplicationAsync.bind(this);
|
||||||
|
@ -1033,11 +1027,6 @@ class KubernetesCreateApplicationController {
|
||||||
if (this.application.StackId) {
|
if (this.application.StackId) {
|
||||||
if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.GIT) {
|
if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.GIT) {
|
||||||
this.stack = await this.StackService.stack(this.application.StackId);
|
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) {
|
} else if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.CONTENT) {
|
||||||
this.stackFileContent = await this.StackService.getStackFile(this.application.StackId);
|
this.stackFileContent = await this.StackService.getStackFile(this.application.StackId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,13 @@ class KubernetesAppGitFormController {
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.formValues = {
|
||||||
|
RefName: '',
|
||||||
|
RepositoryAuthentication: false,
|
||||||
|
RepositoryUsername: '',
|
||||||
|
RepositoryPassword: '',
|
||||||
|
};
|
||||||
|
|
||||||
this.onChange = this.onChange.bind(this);
|
this.onChange = this.onChange.bind(this);
|
||||||
this.onChangeRef = this.onChangeRef.bind(this);
|
this.onChangeRef = this.onChangeRef.bind(this);
|
||||||
}
|
}
|
||||||
|
@ -23,8 +30,8 @@ class KubernetesAppGitFormController {
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(values) {
|
onChange(values) {
|
||||||
this.gitFormValues = {
|
this.formValues = {
|
||||||
...this.gitFormValues,
|
...this.formValues,
|
||||||
...values,
|
...values,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -46,8 +53,8 @@ class KubernetesAppGitFormController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.state.redeployInProgress = true;
|
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');
|
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();
|
await this.$state.reload();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Failed redeploying application');
|
this.Notifications.error('Failure', err, 'Failed redeploying application');
|
||||||
|
@ -61,7 +68,7 @@ class KubernetesAppGitFormController {
|
||||||
return this.$async(async () => {
|
return this.$async(async () => {
|
||||||
try {
|
try {
|
||||||
this.state.saveGitSettingsInProgress = true;
|
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');
|
this.Notifications.success('Save stack settings successfully');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to save application settings');
|
this.Notifications.error('Failure', err, 'Unable to save application settings');
|
||||||
|
@ -76,6 +83,7 @@ class KubernetesAppGitFormController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
|
this.formValues.RefName = this.stack.GitConfig.ReferenceName;
|
||||||
if (this.stack.GitConfig && this.stack.GitConfig.Authentication) {
|
if (this.stack.GitConfig && this.stack.GitConfig.Authentication) {
|
||||||
this.formValues.RepositoryUsername = this.stack.GitConfig.Authentication.Username;
|
this.formValues.RepositoryUsername = this.stack.GitConfig.Authentication.Username;
|
||||||
this.formValues.RepositoryAuthentication = true;
|
this.formValues.RepositoryAuthentication = true;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<git-form-auth-fieldset
|
<git-form-auth-fieldset
|
||||||
ng-if="$ctrl.state.showConfig"
|
ng-if="$ctrl.state.showConfig"
|
||||||
model="$ctrl.gitFormValues"
|
model="$ctrl.gitFormValues"
|
||||||
is-edit="$ctrl.isEdit"
|
is-edit="$ctrl.state.isEdit"
|
||||||
on-change="($ctrl.onChange)"
|
on-change="($ctrl.onChange)"
|
||||||
show-auth-explanation="true"
|
show-auth-explanation="true"
|
||||||
></git-form-auth-fieldset>
|
></git-form-auth-fieldset>
|
||||||
|
|
|
@ -5,10 +5,8 @@ const kubernetesAppGitForm = {
|
||||||
templateUrl: './kubernetes-app-git-form.html',
|
templateUrl: './kubernetes-app-git-form.html',
|
||||||
controller,
|
controller,
|
||||||
bindings: {
|
bindings: {
|
||||||
gitFormValues: '<',
|
|
||||||
namespace: '<',
|
namespace: '<',
|
||||||
stack: '<',
|
stack: '<',
|
||||||
isEdit: '<',
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue