open-nomad/ui/app/components/region-switcher.js
Michael Lange 9f3a37f1c2 Simplify the control flow around changing namespaces and regions
The UI will no longer try to redirect to the appropriate namespace or
region if one is found in localStorage. Instead, it will assume that
the lack of query param means the default namespaces or region is
desired.
2018-08-09 18:22:39 -07:00

22 lines
485 B
JavaScript

import Component from '@ember/component';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
export default Component.extend({
system: service(),
router: service(),
store: service(),
sortedRegions: computed('system.regions', function() {
return this.get('system.regions')
.toArray()
.sort();
}),
gotoRegion(region) {
this.get('router').transitionTo('jobs', {
queryParams: { region },
});
},
});