Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up fetching of WebDAV folder listing #31160

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions apps/files/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
/* global dragOptions, folderDropOptions, OC */
(function() {

if (!OCA.Files) {
/**
* Namespace for the files app
* @namespace OCA.Files
*/
OCA.Files = {};
}

/**
* @namespace OCA.Files.App
*/
Expand Down Expand Up @@ -136,7 +128,10 @@
// refer to the one of the "files" view
window.FileList = this.fileList;

OC.Plugins.attach('OCA.Files.App', this);
let selfApp = this
window.addEventListener('DOMContentLoaded', function() {
OC.Plugins.attach('OCA.Files.App', selfApp)
})

this._setupEvents();
// trigger URL change event handlers
Expand Down Expand Up @@ -398,10 +393,4 @@
};
})();

window.addEventListener('DOMContentLoaded', function() {
// wait for other apps/extensions to register their event handlers and file actions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems you discarded this logic
now, this was there for apps that still register their file actions using the global FileActions object instead of the namespaces one. Not sure how many such apps still exist nowadays.

// in the "ready" clause
_.defer(function() {
OCA.Files.App.initialize();
});
});
OCA.Files.App.initialize();
7 changes: 7 additions & 0 deletions apps/files/js/breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
*/

(function() {
if (!OCA.Files) {
/**
* Namespace for the files app
* @namespace OCA.Files
*/
OCA.Files = {};
}
/**
* @class BreadCrumb
* @memberof OCA.Files
Expand Down
52 changes: 34 additions & 18 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/

(function() {

/**
* @class OCA.Files.FileList
* @classdesc
Expand All @@ -28,9 +27,24 @@
* @param {boolean} [options.enableUpload=false] whether to enable uploader
* @param {OC.Files.Client} [options.filesClient] files client to use
*/
var FileList = function($el, options) {
function FileList($el, options) {
this.initialize($el, options);
};
let filelist = this

window.addEventListener('DOMContentLoaded', function() {
// FIXME: unused ?
this.useUndo = (window.onbeforeunload)?true:false;
$(window).on('beforeunload', function () {
if (this.lastAction) {
this.lastAction();
}
});
if (this._updateDetailsViewTmpFileName && this._updateDetailsViewTmpShow) {
filelist.updateDetailsView(this._updateDetailsViewTmpFileName, this._updateDetailsViewTmpShow)
}
});
}

/**
* @memberof OCA.Files
*/
Expand Down Expand Up @@ -460,11 +474,14 @@
}
this.triedActionOnce = false;

OC.Plugins.attach('OCA.Files.FileList', this);
window.addEventListener('DOMContentLoaded', function() {
console.debug('Attaching OCA.Files.FileList', self)
OC.Plugins.attach('OCA.Files.FileList', self);
self.initHeadersAndFooters()
OCA.Files.App && OCA.Files.App.updateCurrentFileList(self);
})

OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);

this.initHeadersAndFooters()
},

initHeadersAndFooters: function() {
Expand Down Expand Up @@ -667,6 +684,13 @@
}
},

_updateDetailsViewTmpFileName: null,
_updateDetailsViewTmpShow: null,

updateDetailsView: function(fileName, show) {
this._updateDetailsView(fileName, show)
},

/**
* Update the details view to display the given file
*
Expand All @@ -675,7 +699,8 @@
*/
_updateDetailsView: function(fileName, show) {
if (!(OCA.Files && OCA.Files.Sidebar)) {
console.error('No sidebar available');
this._updateDetailsViewTmpFileName = fileName
this._updateDetailsViewTmpShow = show
return;
}

Expand Down Expand Up @@ -4009,16 +4034,7 @@
*/
OCA.Files.FileInfo = OC.Files.FileInfo;

FileList.prototype.constructor = FileList

OCA.Files.FileList = FileList;
})();

window.addEventListener('DOMContentLoaded', function() {
// FIXME: unused ?
OCA.Files.FileList.useUndo = (window.onbeforeunload)?true:false;
$(window).on('beforeunload', function () {
if (OCA.Files.FileList.lastAction) {
OCA.Files.FileList.lastAction();
}
});

});
4 changes: 2 additions & 2 deletions apps/files/js/merged-index.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[
"app.js",
"breadcrumb.js",
"detailfileinfoview.js",
"detailsview.js",
Expand Down Expand Up @@ -28,5 +27,6 @@
"sidebarpreviewmanager.js",
"sidebarpreviewtext.js",
"tagsplugin.js",
"templates.js"
"templates.js",
"app.js"
]
5 changes: 4 additions & 1 deletion apps/files/js/newfilemenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
}
}];

OC.Plugins.attach('OCA.Files.NewFileMenu', this);
let selfNewFileMenu = this
window.addEventListener('DOMContentLoaded', function() {
OC.Plugins.attach('OCA.Files.NewFileMenu', selfNewFileMenu);
})
},

template: function(data) {
Expand Down
5 changes: 4 additions & 1 deletion apps/files/js/sidebarpreviewmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
var SidebarPreviewManager = function (fileList) {
this._fileList = fileList;
this._previewHandlers = {};
OC.Plugins.attach('OCA.Files.SidebarPreviewManager', this);
let selfSidebarPreview = this
window.addEventListener('DOMContentLoaded', function() {
OC.Plugins.attach('OCA.Files.SidebarPreviewManager', selfSidebarPreview);
})
};

SidebarPreviewManager.prototype = {
Expand Down