Skip to content

Commit

Permalink
Fix: user namespace override (Fixes argoproj#9266) (argoproj#9267)
Browse files Browse the repository at this point in the history
fix: user namespace override

Signed-off-by: Loric ANDRE <loric.a@padoa-group.com>
Signed-off-by: Reddy <Rajshekar.Reddy@lowes.com>
  • Loading branch information
LoricAndre authored and Reddy committed Jan 2, 2023
1 parent b963528 commit 112fd7a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ui/src/app/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ export const Utils = {
},

get currentNamespace() {
// we always prefer the user namespace
return this.userNamespace || this.managedNamespace || this.fixLocalStorageString(localStorage.getItem(currentNamespaceKey));
// we always prefer the managed namespace
if (localStorage.getItem(currentNamespaceKey) === null) {
return this.userNamespace || this.managedNamespace;
} else {
return this.fixLocalStorageString(localStorage.getItem(currentNamespaceKey));
}
},

// return a namespace, favoring managed namespace when set
Expand All @@ -114,7 +118,7 @@ export const Utils = {

// return a namespace, never return null/undefined, defaults to "default"
getNamespaceWithDefault(namespace: string) {
return this.userNamespace || this.managedNamespace || namespace || this.currentNamespace || 'default';
return namespace || this.currentNamespace || this.userNamespace || this.managedNamespace || 'default';
},

queryParams(filter: {
Expand Down

0 comments on commit 112fd7a

Please sign in to comment.