mirror of https://github.com/portainer/portainer
fix(ui): stackname auto fill on create from manifest screen [EE-6688] (#11099)
* fix(ui): stackname auto fill on create from manifest screen [EE-6688] * address review commentpull/11102/head
parent
80d02f9cd1
commit
c4942de89b
|
@ -47,6 +47,7 @@
|
||||||
ng-disabled="ctrl.formValues.namespace_toggle && ctrl.state.BuildMethod !== ctrl.BuildMethods.HELM"
|
ng-disabled="ctrl.formValues.namespace_toggle && ctrl.state.BuildMethod !== ctrl.BuildMethods.HELM"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
ng-model="ctrl.formValues.Namespace"
|
ng-model="ctrl.formValues.Namespace"
|
||||||
|
ng-change="ctrl.onChangeNamespace()"
|
||||||
ng-options="namespace.Name as namespace.Name for namespace in ctrl.namespaces"
|
ng-options="namespace.Name as namespace.Name for namespace in ctrl.namespaces"
|
||||||
></select>
|
></select>
|
||||||
<span ng-if="ctrl.formValues.namespace_toggle && ctrl.state.BuildMethod !== ctrl.BuildMethods.HELM" class="small text-muted pt-[7px]"
|
<span ng-if="ctrl.formValues.namespace_toggle && ctrl.state.BuildMethod !== ctrl.BuildMethods.HELM" class="small text-muted pt-[7px]"
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
stack-name="ctrl.formValues.StackName"
|
stack-name="ctrl.formValues.StackName"
|
||||||
set-stack-name="(ctrl.setStackName)"
|
set-stack-name="(ctrl.setStackName)"
|
||||||
is-admin="ctrl.currentUser.isAdmin"
|
is-admin="ctrl.currentUser.isAdmin"
|
||||||
|
stacks="ctrl.stacks"
|
||||||
></kube-stack-name>
|
></kube-stack-name>
|
||||||
<!-- !namespace -->
|
<!-- !namespace -->
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { getVariablesFieldDefaultValues } from '@/react/portainer/custom-templat
|
||||||
|
|
||||||
class KubernetesDeployController {
|
class KubernetesDeployController {
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor($async, $state, $window, Authentication, Notifications, KubernetesResourcePoolService, StackService, CustomTemplateService) {
|
constructor($async, $state, $window, Authentication, Notifications, KubernetesResourcePoolService, StackService, CustomTemplateService, KubernetesApplicationService) {
|
||||||
this.$async = $async;
|
this.$async = $async;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
this.$window = $window;
|
this.$window = $window;
|
||||||
|
@ -24,6 +24,7 @@ class KubernetesDeployController {
|
||||||
this.KubernetesResourcePoolService = KubernetesResourcePoolService;
|
this.KubernetesResourcePoolService = KubernetesResourcePoolService;
|
||||||
this.StackService = StackService;
|
this.StackService = StackService;
|
||||||
this.CustomTemplateService = CustomTemplateService;
|
this.CustomTemplateService = CustomTemplateService;
|
||||||
|
this.KubernetesApplicationService = KubernetesApplicationService;
|
||||||
|
|
||||||
this.isTemplateVariablesEnabled = isTemplateVariablesEnabled;
|
this.isTemplateVariablesEnabled = isTemplateVariablesEnabled;
|
||||||
|
|
||||||
|
@ -78,6 +79,8 @@ class KubernetesDeployController {
|
||||||
Name: '',
|
Name: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.stacks = [];
|
||||||
|
|
||||||
this.ManifestDeployTypes = KubernetesDeployManifestTypes;
|
this.ManifestDeployTypes = KubernetesDeployManifestTypes;
|
||||||
this.BuildMethods = KubernetesDeployBuildMethods;
|
this.BuildMethods = KubernetesDeployBuildMethods;
|
||||||
|
|
||||||
|
@ -92,6 +95,15 @@ class KubernetesDeployController {
|
||||||
this.onChangeDeployType = this.onChangeDeployType.bind(this);
|
this.onChangeDeployType = this.onChangeDeployType.bind(this);
|
||||||
this.onChangeTemplateVariables = this.onChangeTemplateVariables.bind(this);
|
this.onChangeTemplateVariables = this.onChangeTemplateVariables.bind(this);
|
||||||
this.setStackName = this.setStackName.bind(this);
|
this.setStackName = this.setStackName.bind(this);
|
||||||
|
this.onChangeNamespace = this.onChangeNamespace.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeNamespace() {
|
||||||
|
return this.$async(async () => {
|
||||||
|
const applications = await this.KubernetesApplicationService.get(this.formValues.Namespace);
|
||||||
|
const stacks = _.map(applications, (item) => item.StackName).filter((item) => item !== '');
|
||||||
|
this.stacks = _.uniq(stacks);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectHelmChart(chart) {
|
onSelectHelmChart(chart) {
|
||||||
|
@ -377,6 +389,7 @@ class KubernetesDeployController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.onChangeNamespace();
|
||||||
this.state.viewReady = true;
|
this.state.viewReady = true;
|
||||||
|
|
||||||
this.$window.onbeforeunload = () => {
|
this.$window.onbeforeunload = () => {
|
||||||
|
|
Loading…
Reference in New Issue