More connection handling

This commit is contained in:
Basti 2017-12-24 10:52:41 +01:00
parent e865ffe073
commit 456e1f15fb
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import Controller from '@ember/controller'; import Controller from '@ember/controller';
import EmberObject from '@ember/object'; import EmberObject from '@ember/object';
import { observer } from '@ember/object';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed'; import { alias } from '@ember/object/computed';
import { isEmpty } from '@ember/utils'; import { isEmpty } from '@ember/utils';
@ -11,6 +12,7 @@ export default Controller.extend({
connecting: alias('storage.connecting'), connecting: alias('storage.connecting'),
connected: alias('storage.connected'), connected: alias('storage.connected'),
rootListing: alias('storage.rootListing'), rootListing: alias('storage.rootListing'),
currentDirPath: null,
categories: function() { categories: function() {
let categories = []; let categories = [];
@ -28,8 +30,14 @@ export default Controller.extend({
}); });
return categories; return categories;
}.property('rootListing') }.property('rootListing'),
connectedChange: observer('connected', function() {
if (this.get('connected')) {
// console.debug('connectedChange connected');
} else {
this.set('currentDirPath', null);
}
}),
}); });

View File

@ -10,7 +10,6 @@ export default Controller.extend({
application: controller(), application: controller(),
storage: service(), storage: service(),
// connecting: alias('storage.connecting'),
connected: alias('storage.connected'), connected: alias('storage.connected'),
rootListing: alias('storage.rootListing'), rootListing: alias('storage.rootListing'),
currentDirPath: alias('application.currentDirPath'), currentDirPath: alias('application.currentDirPath'),
@ -29,7 +28,7 @@ export default Controller.extend({
if (this.get('connected')) { if (this.get('connected')) {
// console.debug('connectedChange connected'); // console.debug('connectedChange connected');
} else { } else {
this.set('model', {}); this.set('model', null);
this.set('path', null); this.set('path', null);
} }
}), }),