mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-07-04 14:15:12 +08:00
Display total space, used space and % occuped
in file manager for SPIFFS
This commit is contained in:
parent
94232ca720
commit
eae00a3648
@ -35,7 +35,12 @@ $SUCCESS_MSG$
|
|||||||
function dispatchstatus(jsonresponse)
|
function dispatchstatus(jsonresponse)
|
||||||
{
|
{
|
||||||
var content ="";
|
var content ="";
|
||||||
document.getElementById('status').innerHTML=jsonresponse.status;
|
content ="Status: "+jsonresponse.status;
|
||||||
|
content +=" Total space: "+jsonresponse.total;
|
||||||
|
content +=" Used space: "+jsonresponse.used;
|
||||||
|
content +=" Occupation: "+jsonresponse.occupation;
|
||||||
|
document.getElementById('status').innerHTML=content;
|
||||||
|
content ="";
|
||||||
for (var i=0;i <jsonresponse.files.length;i++){
|
for (var i=0;i <jsonresponse.files.length;i++){
|
||||||
content +="<TR><TD style=\"cursor:hand;\" onclick=\"window.open('"+jsonresponse.files[i].name+"');\">";
|
content +="<TR><TD style=\"cursor:hand;\" onclick=\"window.open('"+jsonresponse.files[i].name+"');\">";
|
||||||
content +=jsonresponse.files[i].name;
|
content +=jsonresponse.files[i].name;
|
||||||
|
@ -2394,7 +2394,15 @@ void handleFileList() {
|
|||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
jsonfile+="],";
|
jsonfile+="],";
|
||||||
jsonfile+="\"status\":\"" + status + "\"";
|
jsonfile+="\"status\":\"" + status + "\",";
|
||||||
|
uint32_t total;
|
||||||
|
uint32_t used;
|
||||||
|
SPIFFS.info(&total,&used);
|
||||||
|
jsonfile+="\"total\":\"" + formatBytes(total) + "\",";
|
||||||
|
jsonfile+="\"used\":\"" + formatBytes(used) + "\",";
|
||||||
|
jsonfile+="\"occupation\":\"" ;
|
||||||
|
jsonfile+= intTostr(100*used/total);
|
||||||
|
jsonfile+="%\"";
|
||||||
jsonfile+="}";
|
jsonfile+="}";
|
||||||
path = "";
|
path = "";
|
||||||
web_interface->WebServer.send(200, "application/json", jsonfile);
|
web_interface->WebServer.send(200, "application/json", jsonfile);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user