fix set namespace to default-namespace (#5820)

pull/5855/head
Richard Wei 2021-10-07 11:06:53 +13:00 committed by GitHub
parent fd9427cd0b
commit 84e57cebc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import KubernetesNamespaceHelper from 'Kubernetes/helpers/namespaceHelper'; import KubernetesNamespaceHelper from 'Kubernetes/helpers/namespaceHelper';
import _ from 'lodash-es';
export default class HelmTemplatesController { export default class HelmTemplatesController {
/* @ngInject */ /* @ngInject */
@ -141,8 +142,8 @@ export default class HelmTemplatesController {
const resourcePools = await this.KubernetesResourcePoolService.get(); const resourcePools = await this.KubernetesResourcePoolService.get();
const nonSystemNamespaces = resourcePools.filter((resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name)); const nonSystemNamespaces = resourcePools.filter((resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name));
this.state.resourcePools = nonSystemNamespaces; this.state.resourcePools = _.sortBy(nonSystemNamespaces, ({ Namespace }) => (Namespace.Name === 'default' ? 0 : 1));
this.state.resourcePool = nonSystemNamespaces[0]; this.state.resourcePool = this.state.resourcePools[0];
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve initial helm data.'); this.Notifications.error('Failure', err, 'Unable to retrieve initial helm data.');
} finally { } finally {

View File

@ -1074,7 +1074,10 @@ class KubernetesCreateApplicationController {
]); ]);
this.nodesLimits = nodesLimits; this.nodesLimits = nodesLimits;
this.resourcePools = _.filter(resourcePools, (resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name)); const nonSystemNamespaces = _.filter(resourcePools, (resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name));
this.resourcePools = _.sortBy(nonSystemNamespaces, ({ Namespace }) => (Namespace.Name === 'default' ? 0 : 1));
this.formValues.ResourcePool = this.resourcePools[0]; this.formValues.ResourcePool = this.resourcePools[0];
if (!this.formValues.ResourcePool) { if (!this.formValues.ResourcePool) {
return; return;