aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authoricewind1991 <icewind1991@gmail.com>2013-01-30 13:22:33 -0800
committericewind1991 <icewind1991@gmail.com>2013-01-30 13:22:33 -0800
commit0cde86ac5561f468c7218e74192cb23fb4ace0c3 (patch)
treebcc43051351cb1f455f0482ee5a0a112e9052ac7 /apps/files/js/files.js
parent2fbf3d40900d29c04b69f0c18e4d833a312fb21c (diff)
parent6043789394252a8f9042acfe0e62c1a5fb4e73d1 (diff)
downloadnextcloud-server-0cde86ac5561f468c7218e74192cb23fb4ace0c3.tar.gz
nextcloud-server-0cde86ac5561f468c7218e74192cb23fb4ace0c3.zip
Merge pull request #673 from owncloud/filesystem
Filecache rewrite
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r--apps/files/js/files.js38
1 files changed, 15 insertions, 23 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 13367b33628..8e0399b0e0c 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -670,12 +670,8 @@ $(document).ready(function() {
});
});
- //check if we need to scan the filesystem
- $.get(OC.filePath('files','ajax','scan.php'),{checkonly:'true'}, function(response) {
- if(response.data.done){
- scanFiles();
- }
- }, "json");
+ //do a background scan if needed
+ scanFiles();
var lastWidth = 0;
var breadcrumbs = [];
@@ -774,27 +770,23 @@ $(document).ready(function() {
}
});
-function scanFiles(force,dir){
+function scanFiles(force, dir){
if(!dir){
- dir='';
+ dir = '';
}
- force=!!force; //cast to bool
- scanFiles.scanning=true;
- $('#scanning-message').show();
- $('#fileList').remove();
- var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force,dir:dir});
- scanFiles.cancel=scannerEventSource.close.bind(scannerEventSource);
- scannerEventSource.listen('scanning',function(data){
- $('#scan-count').text(t('files', '{count} files scanned', {count: data.count}));
- $('#scan-current').text(data.file+'/');
+ force = !!force; //cast to bool
+ scanFiles.scanning = true;
+ var scannerEventSource = new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force,dir:dir});
+ scanFiles.cancel = scannerEventSource.close.bind(scannerEventSource);
+ scannerEventSource.listen('count',function(count){
+ console.log(count + 'files scanned')
+ });
+ scannerEventSource.listen('folder',function(path){
+ console.log('now scanning ' + path)
});
- scannerEventSource.listen('success',function(success){
+ scannerEventSource.listen('done',function(count){
scanFiles.scanning=false;
- if(success){
- window.location.reload();
- }else{
- alert(t('files', 'error while scanning'));
- }
+ console.log('done after ' + count + 'files');
});
}
scanFiles.scanning=false;