* Clear directory data on disconnect * Clear path URL param on disconnect * Don't try to fetch dir listing when starting app disconnected
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
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';
|
|
|
|
export default Controller.extend({
|
|
|
|
application: controller(),
|
|
storage: service(),
|
|
|
|
// connecting: alias('storage.connecting'),
|
|
connected: alias('storage.connected'),
|
|
rootListing: alias('storage.rootListing'),
|
|
currentDirPath: alias('application.currentDirPath'),
|
|
|
|
queryParams: ['path'],
|
|
|
|
currentListing: function() {
|
|
if (isPresent(this.get('model.currentListing'))) {
|
|
return this.get('model.currentListing').sortBy('name');
|
|
} else {
|
|
return this.get('rootListing');
|
|
}
|
|
}.property('rootListing.[]', 'model.[]'),
|
|
|
|
connectedChange: observer('connected', function() {
|
|
if (this.get('connected')) {
|
|
// console.debug('connectedChange connected');
|
|
} else {
|
|
this.set('model', {});
|
|
this.set('path', null);
|
|
}
|
|
}),
|
|
|
|
});
|