If loading a directory fails, navigate back to the previous directory
This commit is contained in:
parent
4526bc0ba6
commit
30c240a145
|
@ -836,13 +836,18 @@
|
||||||
* @param {boolean} force set to true to force changing directory
|
* @param {boolean} force set to true to force changing directory
|
||||||
*/
|
*/
|
||||||
changeDirectory: function(targetDir, changeUrl, force) {
|
changeDirectory: function(targetDir, changeUrl, force) {
|
||||||
|
var self = this;
|
||||||
var currentDir = this.getCurrentDirectory();
|
var currentDir = this.getCurrentDirectory();
|
||||||
targetDir = targetDir || '/';
|
targetDir = targetDir || '/';
|
||||||
if (!force && currentDir === targetDir) {
|
if (!force && currentDir === targetDir) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._setCurrentDir(targetDir, changeUrl);
|
this._setCurrentDir(targetDir, changeUrl);
|
||||||
this.reload();
|
this.reload().then(function(success){
|
||||||
|
if (!success) {
|
||||||
|
self.changeDirectory(currentDir, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
linkTo: function(dir) {
|
linkTo: function(dir) {
|
||||||
return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
|
return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
|
||||||
|
@ -902,7 +907,6 @@
|
||||||
* @brief Reloads the file list using ajax call
|
* @brief Reloads the file list using ajax call
|
||||||
*/
|
*/
|
||||||
reload: function() {
|
reload: function() {
|
||||||
var self = this;
|
|
||||||
this._selectedFiles = {};
|
this._selectedFiles = {};
|
||||||
this._selectionSummary.clear();
|
this._selectionSummary.clear();
|
||||||
this.$el.find('.select-all').prop('checked', false);
|
this.$el.find('.select-all').prop('checked', false);
|
||||||
|
@ -916,14 +920,10 @@
|
||||||
dir : this.getCurrentDirectory(),
|
dir : this.getCurrentDirectory(),
|
||||||
sort: this._sort,
|
sort: this._sort,
|
||||||
sortdirection: this._sortDirection
|
sortdirection: this._sortDirection
|
||||||
},
|
|
||||||
error: function(result) {
|
|
||||||
self.reloadCallback(result);
|
|
||||||
},
|
|
||||||
success: function(result) {
|
|
||||||
self.reloadCallback(result);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
var callBack = this.reloadCallback.bind(this);
|
||||||
|
return this._reloadCall.then(callBack, callBack);
|
||||||
},
|
},
|
||||||
reloadCallback: function(result) {
|
reloadCallback: function(result) {
|
||||||
delete this._reloadCall;
|
delete this._reloadCall;
|
||||||
|
@ -931,17 +931,17 @@
|
||||||
|
|
||||||
if (!result || result.status === 'error') {
|
if (!result || result.status === 'error') {
|
||||||
OC.Notification.show(result.data.message);
|
OC.Notification.show(result.data.message);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.status === 404) {
|
if (result.status === 404) {
|
||||||
// go back home
|
// go back home
|
||||||
this.changeDirectory('/');
|
this.changeDirectory('/');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
// aborted ?
|
// aborted ?
|
||||||
if (result.status === 0){
|
if (result.status === 0){
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should rather return upload file size through
|
// TODO: should rather return upload file size through
|
||||||
|
@ -953,6 +953,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setFiles(result.data.files);
|
this.setFiles(result.data.files);
|
||||||
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
updateStorageStatistics: function(force) {
|
updateStorageStatistics: function(force) {
|
||||||
|
|
Loading…
Reference in New Issue