index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //replace url wrapper
  2. var mgUrlParser = {
  3. oldMgUrlParser: mgUrlParser,
  4. getCurrentUrl: function () {
  5. var url = this.oldMgUrlParser.getCurrentUrl();
  6. return url.replace("action=edit", "action=module-settings").replace("&success=true", "");
  7. }
  8. };
  9. //change virtualization
  10. $(document).on("click", ".virtualizationChangeConfirmButton", function (event) {
  11. event.preventDefault();
  12. $("form[name=packagefrm]").submit();
  13. });
  14. $(document).on("change", "select[name='customconfigoption[virtualization]']", function () {
  15. document.getElementById("virtualizationChangButton").click();
  16. });
  17. //default node
  18. $(document).on("change", "select[name='customconfigoption[defaultNode]']", function () {
  19. $("form[name=packagefrm]").submit();
  20. });
  21. // Disk Speed
  22. $(document).on("change", "input[name='customconfigoption[diskSpeed]']", function (e) {
  23. var show = $(this).is(":checked");
  24. $("input[name='customconfigoption[mbps_rd]']").closest(".lu-widget").toggle(show);
  25. });
  26. if ($("input[name='customconfigoption[diskSpeed]']").size()) {
  27. $("input[name='customconfigoption[diskSpeed]']").trigger('change');
  28. }
  29. //Additional Disk Speed
  30. $(document).on("change", "input[name='customconfigoption[additionalDiskSpeed]']", function (e) {
  31. var show = $(this).is(":checked");
  32. $("input[name='customconfigoption[additionalDiskMbps_rd]']").closest(".lu-widget").toggle(show);
  33. });
  34. if ($("input[name='customconfigoption[additionalDiskSpeed]']").size()) {
  35. $("input[name='customconfigoption[additionalDiskSpeed]']").trigger('change');
  36. }
  37. //Storage LVM
  38. $(document).on("change", "select[name='customconfigoption[diskStorage]']",function(e){
  39. var storage = $(this).val();
  40. if(storage.match(/lvm/)){
  41. $("select[name='customconfigoption[diskFormat]']").val("raw");
  42. $("select[name='customconfigoption[diskFormat]'] option").attr("disabled",true);
  43. $("select[name='customconfigoption[diskFormat]'] option[value=raw]").attr("disabled",false);
  44. }else{
  45. $("select[name='customconfigoption[diskFormat]'] option").attr("disabled",false);
  46. }
  47. });
  48. if ($("input[name='customconfigoption[diskStorage]']").size()) {
  49. $("input[name='customconfigoption[diskStorage]']").trigger('change');
  50. }