diff --git a/pages/c/_cluster/apps/charts/install.vue b/pages/c/_cluster/apps/charts/install.vue index 8216f0563b..4ee5f7ca8f 100644 --- a/pages/c/_cluster/apps/charts/install.vue +++ b/pages/c/_cluster/apps/charts/install.vue @@ -31,6 +31,7 @@ import { clone, diff, get, set } from '@/utils/object'; import { findBy, insertAt } from '@/utils/array'; import Vue from 'vue'; import { saferDump } from '@/utils/create-yaml'; +import { DEFAULT_WORKSPACE } from '@/models/provisioning.cattle.io.cluster'; const VALUES_STATE = { FORM: 'FORM', @@ -78,26 +79,28 @@ export default { id: 'server-url' }); - this.value = await this.$store.dispatch('cluster/create', { - type: 'chartInstallAction', - metadata: { - namespace: this.existing ? this.existing.spec.namespace : this.query.appNamespace, - name: this.existing ? this.existing.spec.name : this.query.appName, - } - }); - if ( this.existing ) { this.forceNamespace = this.existing.metadata.namespace; this.nameDisabled = true; + } else if (this.$route.query[FROM_CLUSTER] === _FLAGGED) { + this.forceNamespace = DEFAULT_WORKSPACE; + } else if ( this.chart?.targetNamespace ) { + this.forceNamespace = this.chart.targetNamespace; + } else if ( this.query.appNamespace ) { + this.forceNamespace = this.query.appNamespace; } else { - if ( this.chart?.targetNamespace ) { - this.forceNamespace = this.chart.targetNamespace; - } else if ( this.query.appNamespace ) { - this.forceNamespace = this.query.appNamespace; - } else { - this.forceNamespace = null; - } + this.forceNamespace = null; + } + this.value = await this.$store.dispatch('cluster/create', { + type: 'chartInstallAction', + metadata: { + namespace: this.forceNamespace || this.$store.getters['defaultNamespace'], + name: this.existing?.spec?.name || this.query.appName || '', + } + }); + + if ( !this.existing) { if ( this.chart?.targetName ) { this.value.metadata.name = this.chart.targetName; this.nameDisabled = true;