This commit is contained in:
midoks
2022-10-06 17:19:36 +08:00
parent abf39428fc
commit 4d3a6c27f7
2 changed files with 13 additions and 4 deletions
+5 -1
View File
@@ -168,7 +168,11 @@ def initdUinstall():
def swapStatus(): def swapStatus():
sfile = getServerDir() + '/swapfile' sfile = getServerDir() + '/swapfile'
size = os.path.getsize(sfile) / 1024 / 1024
if os.path.exists(sfile):
size = os.path.getsize(sfile) / 1024 / 1024
else:
size = '218'
data = {'size': size} data = {'size': size}
return mw.returnJson(True, "ok", data) return mw.returnJson(True, "ok", data)
+8 -3
View File
@@ -52,9 +52,14 @@ function swapStatus() {
$(".soft-man-con").html(spCon); $(".soft-man-con").html(spCon);
$(".conf_p select[name='swap_set']").change(function() { $(".conf_p select[name='swap_set']").change(function() {
var size = $(this).val(); var swap_size = $(this).val();
$("input[name='cur_size']").val(size); if (swap_size.indexOf('GB')>-1){
$("input[name='size']").val(size); swap_size = parseInt(swap_size)*1024;
} else{
swap_size = parseInt(swap_size);
}
$("input[name='cur_size']").val(swap_size);
$("input[name='size']").val(swap_size);
}); });
}); });
} }