Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Fix sticky namespace selector #11830

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/11830.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
ui: Fixes an issue where under some circumstances the namespace selector could
become 'stuck' on the default namespace
```
9 changes: 4 additions & 5 deletions ui/packages/consul-ui/app/routes/dc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,19 @@ export default class DcRoute extends Route {
@service('repository/dc') repo;
@service('repository/nspace/disabled') nspacesRepo;
@service('settings') settingsRepo;
@service('store') store;

async model(params) {
const app = this.modelFor('application');

let [token, nspace, dc] = await Promise.all([
this.settingsRepo.findBySlug('token'),
this.nspacesRepo.getActive(),
this.repo.findBySlug(params.dc, app.dcs),
this.repo.findBySlug(params.dc, this.store.peekAll('dc')),
]);
// if there is only 1 namespace then use that
// otherwise find the namespace object that corresponds
// to the active one
nspace =
app.nspaces.length > 1 ? findActiveNspace(app.nspaces, nspace) : app.nspaces.firstObject;
const nspaces = this.store.peekAll('nspace');
nspace = findActiveNspace(nspaces, nspace);

let permissions;
if (get(token, 'SecretID')) {
Expand Down