mirror of https://github.com/rancher/ui.git
put view choice in user preference
This commit is contained in:
parent
303ec253a4
commit
bffdc75cc9
|
|
@ -1,4 +1,5 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import C from 'ui/utils/constants';
|
||||||
import { tagsToArray } from 'ui/models/stack';
|
import { tagsToArray } from 'ui/models/stack';
|
||||||
|
|
||||||
//const NONE = 'none';
|
//const NONE = 'none';
|
||||||
|
|
@ -22,6 +23,12 @@ export default Ember.Controller.extend({
|
||||||
this.set('stacks', this.get('store').all('stack'));
|
this.set('stacks', this.get('store').all('stack'));
|
||||||
this.set('hosts', this.get('store').all('host'));
|
this.set('hosts', this.get('store').all('host'));
|
||||||
this.set('expandedInstances',[]);
|
this.set('expandedInstances',[]);
|
||||||
|
|
||||||
|
Ember.run.scheduleOnce('afterRender', () => {
|
||||||
|
let key = `prefs.${C.PREFS.CONTAINER_VIEW}`;
|
||||||
|
const group = this.get(key) || this.get('group');
|
||||||
|
this.transitionToRoute({queryParams: {group}});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -97,4 +104,13 @@ export default Ember.Controller.extend({
|
||||||
emptyStacks: function() {
|
emptyStacks: function() {
|
||||||
return this.get('stacks').filterBy('isEmpty',true).map((x) => { return {ref: x} });
|
return this.get('stacks').filterBy('isEmpty',true).map((x) => { return {ref: x} });
|
||||||
}.property('stacks.@each.isEmpty'),
|
}.property('stacks.@each.isEmpty'),
|
||||||
|
|
||||||
|
groupChanged: function() {
|
||||||
|
let key = `prefs.${C.PREFS.CONTAINER_VIEW}`;
|
||||||
|
let cur = this.get(key);
|
||||||
|
let neu = this.get('group');
|
||||||
|
if ( cur !== neu ) {
|
||||||
|
this.set(key,neu);
|
||||||
|
}
|
||||||
|
}.observes('group'),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@ export default Ember.Controller.extend({
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.set('expandedHosts',[]);
|
this.set('expandedHosts',[]);
|
||||||
|
|
||||||
|
Ember.run.scheduleOnce('afterRender', () => {
|
||||||
|
let key = `prefs.${C.PREFS.HOST_VIEW}`;
|
||||||
|
let mode = this.get(key) || this.get('mode');
|
||||||
|
this.transitionToRoute({queryParams: {mode}});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,7 @@ var C = {
|
||||||
EXPANDED_STACKS : 'expandedStacks',
|
EXPANDED_STACKS : 'expandedStacks',
|
||||||
FEEDBACK : 'feedback',
|
FEEDBACK : 'feedback',
|
||||||
HOST_VIEW : 'hostView',
|
HOST_VIEW : 'hostView',
|
||||||
|
CONTAINER_VIEW : 'containerView',
|
||||||
I_HATE_SPINNERS : 'ihatespinners',
|
I_HATE_SPINNERS : 'ihatespinners',
|
||||||
LANGUAGE : 'language',
|
LANGUAGE : 'language',
|
||||||
PROJECT_DEFAULT : 'defaultProjectId',
|
PROJECT_DEFAULT : 'defaultProjectId',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue