Bläddra i källkod

Optimized File Manager auto refresh during listDir

Toby Chui 3 år sedan
förälder
incheckning
050a88d3fd
2 ändrade filer med 15 tillägg och 12 borttagningar
  1. 1 1
      startup.flags.go
  2. 14 11
      web/SystemAO/file_system/file_explorer.html

+ 1 - 1
startup.flags.go

@@ -88,7 +88,7 @@ func handleBootFlagsFunction(w http.ResponseWriter, r *http.Request) {
 		}
 
 		//Update the current global flags
-		systemWideLogger.PrintAndLog("Main", "Updating boot flag to:"+newSettings, nil)
+		systemWideLogger.PrintAndLog("System", "Updating boot flag to:"+newSettings, nil)
 		*host_name = newConfig.Hostname
 		max_upload_size = int64(newConfig.MaxUploadSize << 20)
 		*upload_buf = newConfig.MaxFileUploadBuff

+ 14 - 11
web/SystemAO/file_system/file_explorer.html

@@ -1458,6 +1458,7 @@
 
             // ============================== FOLDER LISTING FUNCTIONS ====================
             function listDirectory(path, callback=undefined, recordUndo=true){
+                enableAutoRefresh = false;
                 var recordPreviousPage = true;
                 if (recordUndo == false){
                     recordPreviousPage = false;
@@ -1585,18 +1586,14 @@
                                         }
                                         return
                                     }
-                                    //console.log("Path parse error! Redirecting to parent directory.", data.error);
-                                    //var pdir = currentPath.split("/");
-                                    //pdir.pop(); pdir.pop();
-                                    //pdir = pdir.join("/");
-                                    //currentPath = pdir;
-                                    enableAutoRefresh = false;
+
+                                    
                                     //Check if it is already rooted and no more parent ahead
                                     if (currentPath == ""){
                                         currentPath = "user:/";
                                     }
                                     
-                                    //Print folder not found exceotion
+                                    //Print folder not found exception
                                     $("#folderList").show();
                                     $("#folderList").html(`<div class="ts basic segment ${currentTheme}">
                                         <div class="ts header">
@@ -1607,9 +1604,7 @@
                                     </div>`);
                                     $("#fileList").hide();
 
-                                    //listDirectory(currentPath, function(){
-                                    //    window.location.reload();
-                                    //});
+                                    enableAutoRefresh = false;
                                     return;
                                 }else{
                                     enableAutoRefresh = true;
@@ -1629,10 +1624,18 @@
                                         if (callback !== undefined){
                                             callback();
                                         }
+
+                                        enableAutoRefresh = true;
                                     });
                                 }
-                            } 
+                            },
+                            error: function(){
+                                enableAutoRefresh = true;
+                            }
                         });
+                    },
+                    error: function(){
+                        enableAutoRefresh = true;
                     }
                 });
             }