pull/205/head
midoks 3 years ago
parent abf39428fc
commit 4d3a6c27f7
  1. 4
      plugins/swap/index.py
  2. 11
      plugins/swap/js/swap.js

@ -168,7 +168,11 @@ def initdUinstall():
def swapStatus(): def swapStatus():
sfile = getServerDir() + '/swapfile' sfile = getServerDir() + '/swapfile'
if os.path.exists(sfile):
size = os.path.getsize(sfile) / 1024 / 1024 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)

@ -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);
}); });
}); });
} }

Loading…
Cancel
Save