From 2c09c21644de094fc93a8c8441b07b909ae838e8 Mon Sep 17 00:00:00 2001 From: Armando Date: Mon, 11 Aug 2025 17:20:19 -0600 Subject: [PATCH 1/2] Modified the VM edit to include a slider and made the values more human readable. --- .../styles/dynamix.vm.manager.css | 51 +++ .../templates/Custom.form.php | 298 ++++++++++++++++-- 2 files changed, 316 insertions(+), 33 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css b/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css index f7cf0abef1..0cf2f51178 100644 --- a/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css +++ b/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css @@ -679,3 +679,54 @@ img.paused{opacity: 0.6;} .paused{color:#F0DD33;} .log{cursor:zoom-in;} + +#memory-slider-range { + width: 300px; + margin: 10px 0; +} +#memory-slider-range .ui-slider-range { + border-radius:0%; + background: #007cba; +} +#memory-slider-range .ui-slider-handle { + width: 10px; + margin: 0px; + outline: none; + position: absolute; +} +#memory-slider-range .ui-slider-handle:nth-of-type(1) { + border-radius: 10px 0 0 10px; + background: #007cba; + cursor: pointer; + transform: translateX(-90%); +} +#memory-slider-range .ui-slider-handle:nth-of-type(2) { + border-radius: 0 10px 10px 0; + background: #007cba; + cursor: pointer; +} + +.memory-selects { + display: flex; + justify-content: space-between; + width: 300px; + margin-top: 5px; + font-size: 12px; + color: #666; +} + +.memory-selects > div { + display: flex; + align-items: center; + gap: 5px; +} + +.memory-selects select { + min-width: 60px; + font-size: 12px; + padding: 2px 5px; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} \ No newline at end of file diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index c5eb5b66e6..899b5165de 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -347,6 +347,40 @@ $namedisable = ""; $snapcount = "0"; } + +function getSliderPosition($currentValue) { + global $maxmem; + $values = [128 * 1024, 256 * 1024]; + for ($i = 1; $i <= ($maxmem*2); $i++) { + $values[] = $i * 512 * 1024; + } + + $position = 0; + foreach ($values as $index => $value) { + if ($currentValue <= $value) { + $position = $index; + break; + } + } + return $position; +} + +function formatMemoryDisplay($value) { + if ($value >= 1024 * 1024) { + return ($value / (1024 * 1024)) . ' GB'; + } else { + return ($value / 1024) . ' MB'; + } +} + +$memoryValues = [ + 128 * 1024, + 256 * 1024, +]; + +for ($i = 1; $i <= ($maxmem * 2); $i++) { + $memoryValues[] = $i * 512 * 1024; +} ?> @@ -602,41 +636,239 @@ - - - - - + + + + +
- _(Initial)_ _(Memory)_: - - - _(Max)_ _(Memory)_: - - - -
+ Initial/Max Memory: + + + + +
+ +
+
+ Initial: + +
+
+ Maximum: + +
+
+
+ +
+ +

Select how much memory to allocate to the VM at boot.

From 7ccaa2e4609e9ce7d72fb37acfbeca57b71049c0 Mon Sep 17 00:00:00 2001 From: Armando Date: Fri, 3 Oct 2025 12:56:13 -0600 Subject: [PATCH 2/2] Removed slider, kept dropdown. --- .../styles/dynamix.vm.manager.css | 53 +-- .../templates/Custom.form.php | 306 +++--------------- 2 files changed, 46 insertions(+), 313 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css b/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css index 0cf2f51178..f34b0c7b50 100644 --- a/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css +++ b/emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css @@ -678,55 +678,4 @@ img.paused{opacity: 0.6;} .stopped{color:#EF3D47;} .paused{color:#F0DD33;} -.log{cursor:zoom-in;} - -#memory-slider-range { - width: 300px; - margin: 10px 0; -} -#memory-slider-range .ui-slider-range { - border-radius:0%; - background: #007cba; -} -#memory-slider-range .ui-slider-handle { - width: 10px; - margin: 0px; - outline: none; - position: absolute; -} -#memory-slider-range .ui-slider-handle:nth-of-type(1) { - border-radius: 10px 0 0 10px; - background: #007cba; - cursor: pointer; - transform: translateX(-90%); -} -#memory-slider-range .ui-slider-handle:nth-of-type(2) { - border-radius: 0 10px 10px 0; - background: #007cba; - cursor: pointer; -} - -.memory-selects { - display: flex; - justify-content: space-between; - width: 300px; - margin-top: 5px; - font-size: 12px; - color: #666; -} - -.memory-selects > div { - display: flex; - align-items: center; - gap: 5px; -} - -.memory-selects select { - min-width: 60px; - font-size: 12px; - padding: 2px 5px; - box-sizing: border-box; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} \ No newline at end of file +.log{cursor:zoom-in;} \ No newline at end of file diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 899b5165de..94340d5d64 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -347,40 +347,6 @@ $namedisable = ""; $snapcount = "0"; } - -function getSliderPosition($currentValue) { - global $maxmem; - $values = [128 * 1024, 256 * 1024]; - for ($i = 1; $i <= ($maxmem*2); $i++) { - $values[] = $i * 512 * 1024; - } - - $position = 0; - foreach ($values as $index => $value) { - if ($currentValue <= $value) { - $position = $index; - break; - } - } - return $position; -} - -function formatMemoryDisplay($value) { - if ($value >= 1024 * 1024) { - return ($value / (1024 * 1024)) . ' GB'; - } else { - return ($value / 1024) . ' MB'; - } -} - -$memoryValues = [ - 128 * 1024, - 256 * 1024, -]; - -for ($i = 1; $i <= ($maxmem * 2); $i++) { - $memoryValues[] = $i * 512 * 1024; -} ?> @@ -636,238 +602,56 @@ function formatMemoryDisplay($value) {
- - - - - -
- Initial/Max Memory: - - - - -
- -
-
- Initial: - -
-
- Maximum: - -
-
-
- -
+ + + _(Initial)_ _(Memory)_: + + + + _(Max)_ _(Memory)_: + + + + + + +
@@ -3108,4 +2892,4 @@ function(inputValue) { regenerateDiskPreview(); resetForm(); }); - + \ No newline at end of file