Эх сурвалжийг харах

Fixed error message in disk prop

Toby Chui 1 жил өмнө
parent
commit
f383dd7b76

+ 18 - 7
web/SystemAO/disk/diskprop.html

@@ -218,19 +218,27 @@
             //There are something to load. Load the vroot properties
             if (window.location.hash.length > 0 && typeof(files) != null){
                 var rootName = files[0].split("/")[0];
+                var NALocaleString = applocale.getString("error/na", "[Not Available]");
                 $("#vrootName").val(rootName + "/");
 
                 getDiskProp(files[0], function(data){
                     if (data.error !== undefined){
                         $("#phydisk").text("Unknown");
                         $("#hierarchy").text("Unknown");
-                        $("#usedSpaceInBytes").text("Not Available");
-                        $("#usableSpaceInBytes").text("Not Available");
-                        $("#totalSpaceInBytes").text("Not Available");
+                        $("#usedSpaceInBytes").text(NALocaleString);
+                        $("#usableSpaceInBytes").text(NALocaleString);
+                        $("#totalSpaceInBytes").text(NALocaleString);
                         console.log(data.error);
                     }else{
-                        $("#usedSpaceInBytes").text(new Intl.NumberFormat('en-US').format(data.Used));
-                        $("#usedSpaceInHumanReadableFormat").text(bytesToSize(data.Used));
+                        if (data.Used == 0){
+                            //Network drive
+                            $("#usedSpaceInBytes").text(NALocaleString);
+                            $("#usedSpaceInHumanReadableFormat").text("");
+                        }else{
+                            $("#usedSpaceInBytes").text(new Intl.NumberFormat('en-US').format(data.Used));
+                            $("#usedSpaceInHumanReadableFormat").text(bytesToSize(data.Used));
+                        }
+                        
 
                         $("#usableSpaceInBytes").text(new Intl.NumberFormat('en-US').format(data.Available));
                         $("#usableSpaceInHumanReadableFormat").text(bytesToSize(data.Available));
@@ -253,14 +261,17 @@
                             $("#usedVirtualSpaceInHumanReadableFormat").text(bytesToSize(folderdata.Filesize));
                         
                         }else{
-                            $("#usedVirtualSpaceInByte").text("Not Available");
+                            $("#usedVirtualSpaceInByte").text(NALocaleString);
                             $("#usedVirtualSpaceInHumanReadableFormat").text("");
                         }
 
-                        if (diskInfo.Used == 0){
+                        if (diskInfo.Used == 0 && folderdata.Filesize >= 0){
                             //Network or special drive. Use user space as usedSpace
                             $("#usedSpaceInBytes").text(new Intl.NumberFormat('en-US').format(folderdata.Filesize));
                             $("#usedSpaceInHumanReadableFormat").text(bytesToSize(folderdata.Filesize));
+                        }else if (diskInfo.Used == 0){
+                            $("#usedSpaceInBytes").text(NALocaleString);
+                            $("#usedSpaceInHumanReadableFormat").text("");
                         }
                        
                         

+ 5 - 0
web/SystemAO/locale/disk_properties.json

@@ -22,6 +22,7 @@
                 "spaceinfo/Capacity":"磁碟容量",
 
                 "unit/bytes":" 個位元組",
+                "error/na": "【沒有資訊】",
 
                 "button/close":"確認",
 
@@ -54,6 +55,7 @@
                 "spaceinfo/Capacity":"磁碟容量",
 
                 "unit/bytes":" 個位元組",
+                "error/na": "【無資料】",
 
                 "button/close":"確認",
 
@@ -86,6 +88,7 @@
                 "spaceinfo/Capacity":"磁盘容量",
 
                 "unit/bytes":" 字节",
+                "error/na": "【无效资料】",
 
                 "button/close":"确定",
 
@@ -113,6 +116,7 @@
             "spaceinfo/Usable": "Available Disk Space",
             "spaceinfo/Capacity": "Disk Capacity",
             "unit/bytes": " Bytes",
+            "error/na": "[Not Available]",
             "button/close": "Confirm",
             "": ""
             },
@@ -136,6 +140,7 @@
                 "spaceinfo/Usable": "利用可能な空間",
                 "spaceinfo/Capacity": "ディスク容量",
                 "unit/bytes": " バイト",
+                "error/na": "[利用不可]",
                 "button/close": "確認",
                 "": ""
             },