fix(ui): stackname auto fill on create from manifest screen [EE-6688] (#11100)

* fix(ui): stackname auto fill on create from manifest screen [EE-6688]

* address review comment
pull/11103/head
Prabhat Khera 10 months ago committed by GitHub
parent 08dd7f6d2a
commit 1fd4291630
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -47,6 +47,7 @@
ng-disabled="ctrl.formValues.namespace_toggle && ctrl.state.BuildMethod !== ctrl.BuildMethods.HELM"
class="form-control"
ng-model="ctrl.formValues.Namespace"
ng-change="ctrl.onChangeNamespace()"
ng-options="namespace.Name as namespace.Name for namespace in ctrl.namespaces"
></select>
<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"
set-stack-name="(ctrl.setStackName)"
is-admin="ctrl.currentUser.isAdmin"
stacks="ctrl.stacks"
></kube-stack-name>
<!-- !namespace -->

@ -15,7 +15,7 @@ import { getVariablesFieldDefaultValues } from '@/react/portainer/custom-templat
class KubernetesDeployController {
/* @ngInject */
constructor($async, $state, $window, Authentication, Notifications, KubernetesResourcePoolService, StackService, CustomTemplateService) {
constructor($async, $state, $window, Authentication, Notifications, KubernetesResourcePoolService, StackService, CustomTemplateService, KubernetesApplicationService) {
this.$async = $async;
this.$state = $state;
this.$window = $window;
@ -24,6 +24,7 @@ class KubernetesDeployController {
this.KubernetesResourcePoolService = KubernetesResourcePoolService;
this.StackService = StackService;
this.CustomTemplateService = CustomTemplateService;
this.KubernetesApplicationService = KubernetesApplicationService;
this.isTemplateVariablesEnabled = isTemplateVariablesEnabled;
@ -78,6 +79,8 @@ class KubernetesDeployController {
Name: '',
};
this.stacks = [];
this.ManifestDeployTypes = KubernetesDeployManifestTypes;
this.BuildMethods = KubernetesDeployBuildMethods;
@ -92,6 +95,15 @@ class KubernetesDeployController {
this.onChangeDeployType = this.onChangeDeployType.bind(this);
this.onChangeTemplateVariables = this.onChangeTemplateVariables.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) {
@ -377,6 +389,7 @@ class KubernetesDeployController {
}
}
this.onChangeNamespace();
this.state.viewReady = true;
this.$window.onbeforeunload = () => {

Loading…
Cancel
Save