Improve connection handling
* Clear directory data on disconnect * Clear path URL param on disconnect * Don't try to fetch dir listing when starting app disconnected
This commit is contained in:
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
|
||||
import EmberObject from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import { observer } from '@ember/object';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
|
||||
export default Controller.extend({
|
||||
@@ -13,10 +12,6 @@ export default Controller.extend({
|
||||
connected: alias('storage.connected'),
|
||||
rootListing: alias('storage.rootListing'),
|
||||
|
||||
handleConnected: observer('connected', function() {
|
||||
this.get('storage').fetchRootListing();
|
||||
}),
|
||||
|
||||
categories: function() {
|
||||
let categories = [];
|
||||
let rootListing = this.get('rootListing');
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as controller } from '@ember/controller';
|
||||
import { observer } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import { isPresent } from '@ember/utils';
|
||||
@@ -10,7 +11,7 @@ export default Controller.extend({
|
||||
storage: service(),
|
||||
|
||||
// connecting: alias('storage.connecting'),
|
||||
// connected: alias('storage.connected'),
|
||||
connected: alias('storage.connected'),
|
||||
rootListing: alias('storage.rootListing'),
|
||||
currentDirPath: alias('application.currentDirPath'),
|
||||
|
||||
@@ -22,6 +23,15 @@ export default Controller.extend({
|
||||
} else {
|
||||
return this.get('rootListing');
|
||||
}
|
||||
}.property('rootListing.[]', 'model.[]')
|
||||
}.property('rootListing.[]', 'model.[]'),
|
||||
|
||||
connectedChange: observer('connected', function() {
|
||||
if (this.get('connected')) {
|
||||
// console.debug('connectedChange connected');
|
||||
} else {
|
||||
this.set('model', {});
|
||||
this.set('path', null);
|
||||
}
|
||||
}),
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user