From: Samuel Guimarães <sguimaraes943(a)gmail.com>
Signed-off-by: peterpennings <peterpnns(a)gmail.com>
---
ui/css/kimchi.css | 20 +++++++-------------
ui/css/src/modules/_edit-guests.scss | 5 +----
ui/js/src/kimchi.guest_edit_main.js | 18 ++++++++++++++++++
ui/js/src/kimchi.template_edit_main.js | 24 ++++++++++++++++++++++--
ui/pages/guest-edit.html.tmpl | 9 ++++++++-
ui/pages/tabs/templates.html.tmpl | 2 +-
ui/pages/template-edit.html.tmpl | 9 ++++++++-
7 files changed, 65 insertions(+), 22 deletions(-)
diff --git a/ui/css/kimchi.css b/ui/css/kimchi.css
index b3ff8bd..950c371 100644
--- a/ui/css/kimchi.css
+++ b/ui/css/kimchi.css
@@ -78,7 +78,7 @@
#guest-add-window.modal-content label.box-iso-outer span.box-iso-border {
display: block;
border: 3px solid transparent;
- transition: all 0.1s ease-in-out;
+ transition: all .1s ease-in-out;
}
#template-add-window.modal-content label.box-iso-outer .iso-radio-hidden:checked +
span.box-iso-border,
@@ -100,7 +100,7 @@
display: block;
border: 1px solid transparent;
background: #fff;
- transition: all 0.1s ease-in-out;
+ transition: all .1s ease-in-out;
}
#template-add-window.modal-content ul.list-template,
@@ -679,10 +679,7 @@
}
#guest-edit-window #form-guest-edit-general #guest-edit-memory-textbox,
-#guest-edit-window #form-guest-edit-general #guest-show-max-memory {
- display: block;
-}
-
+#guest-edit-window #form-guest-edit-general #guest-show-max-memory,
#guest-edit-window #form-guest-edit-general #guest-edit-cores-textbox,
#guest-edit-window #form-guest-edit-general #guest-show-max-processor {
display: inline-block;
@@ -1025,7 +1022,7 @@
border: 1px solid #eee !important;
margin-bottom: 3px;
display: block;
- padding: 0.2em 0.6em 0.3em;
+ padding: .2em .6em .3em;
font-weight: 700;
line-height: 1;
text-align: left;
@@ -1295,7 +1292,7 @@
height: 664px;
width: 2164px;
left: 0;
- transition: left 0.2s ease-in-out;
+ transition: left .2s ease-in-out;
}
#template-add-window.modal-content p {
@@ -1571,9 +1568,7 @@
padding-right: 35px !important;
}
-#templates-root-container .wok-vm-gallery .item-hidden.column-type,
-#templates-root-container .wok-vm-gallery .item-hidden.column-version,
-#templates-root-container .wok-vm-gallery .item-hidden.column-processors {
+#templates-root-container .wok-vm-gallery .item-hidden.column-type,
#templates-root-container .wok-vm-gallery .item-hidden.column-version,
#templates-root-container .wok-vm-gallery .item-hidden.column-processors {
padding-bottom: 11px;
}
@@ -2114,8 +2109,7 @@
white-space: nowrap;
}
-.storage-modal .filter-select.popable .popover ul li:hover,
-.storage-modal .filter-select.popable .popover ul li:focus,
+.storage-modal .filter-select.popable .popover ul li:hover, .storage-modal
.filter-select.popable .popover ul li:focus,
.storage-modal .storage-target-input .popover ul li:hover,
.storage-modal .storage-target-input .popover ul li:focus,
.storage-modal .storage-add-input .popover ul li:hover,
diff --git a/ui/css/src/modules/_edit-guests.scss b/ui/css/src/modules/_edit-guests.scss
index 84d116b..c7c4293 100644
--- a/ui/css/src/modules/_edit-guests.scss
+++ b/ui/css/src/modules/_edit-guests.scss
@@ -39,10 +39,7 @@
}
#guest-edit-memory-textbox,
- #guest-show-max-memory {
- display: block;
- }
-
+ #guest-show-max-memory,
#guest-edit-cores-textbox,
#guest-show-max-processor {
display: inline-block;
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 6daec53..960c650 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -664,6 +664,10 @@ kimchi.guest_edit_main = function() {
guest['max-processor'] = guest.cpu_info['maxvcpus'];
guest['icon'] = guest['icon'] ||
'plugins/kimchi/images/icon-vm.png';
$('#form-guest-edit-general').fillWithObject(guest);
+
+ $('#guest-edit-memory-textbox').val(parseInt(guest.memory.current));
+
$('#guest-edit-max-memory-textbox').val(parseInt(guest.memory.maxmemory));
+
kimchi.thisVMState = guest['state'];
refreshCDROMs();
$('#guest-edit-attach-cdrom-button').on('click', function(event)
{
@@ -673,6 +677,13 @@ kimchi.guest_edit_main = function() {
if ((kimchi.thisVMState === "running") || (kimchi.thisVMState ===
"paused")) {
$("#form-guest-edit-general
input").not("#guest-edit-memory-textbox").prop("disabled",
true);
}
+ $('#guest-show-max-memory').on('click', function(e) {
+ e.preventDefault;
+ $('#guest-max-memory-panel').slideToggle();
+ var text = $('#guest-show-max-memory span.text').text();
+ $('#guest-show-max-memory span.text').text(text ==
i18n['KCHVMED6008M'] ? i18n['KCHVMED6009M'] :
i18n['KCHVMED6008M']);
+ $('#guest-show-max-memory i.fa').toggleClass('fa-plus-circle
fa-minus-circle');
+ });
$('#guest-show-max-processor').on('click', function(e) {
e.preventDefault;
@@ -717,6 +728,9 @@ kimchi.guest_edit_main = function() {
if (data['memory'] !== undefined) {
data['memory'] = Number(data['memory']);
}
+ if (data['max-memory'] !== undefined) {
+ data['max-memory'] = Number(data['max-memory']);
+ }
if (data['vcpus'] !== undefined) {
var cpu = Number(data['vcpus']);
var maxCpu = Number(data['max-processor']);
@@ -737,6 +751,10 @@ kimchi.guest_edit_main = function() {
delete data['max-processor'];
}
+ memory = {'current': data['memory'], 'maxmemory':
data['max-memory']};
+
+ data.memory = memory;
+ delete data['max-memory'];
kimchi.updateVM(kimchi.selectedGuest, data, function() {
kimchi.listVmsAuto();
wok.window.close();
diff --git a/ui/js/src/kimchi.template_edit_main.js
b/ui/js/src/kimchi.template_edit_main.js
index 14f317f..94917a2 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -35,6 +35,14 @@ kimchi.template_edit_main = function() {
});
});
+ $('#template-show-max-memory').on('click', function(e) {
+ e.preventDefault;
+ $('.max-memory-field').slideToggle();
+ var text = $('#template-show-max-memory span.text').text();
+ $('#template-show-max-memory span.text').text(text ==
i18n['KCHVMED6008M'] ? i18n['KCHVMED6009M'] :
i18n['KCHVMED6008M']);
+ $('#template-show-max-memory i.fa').toggleClass('fa-plus-circle
fa-minus-circle');
+ });
+
var initTemplate = function(template) {
origDisks = template.disks;
origNetworks = template.networks;
@@ -54,6 +62,9 @@ kimchi.template_edit_main = function() {
$('input[name="' + prop + '"]',
templateEditMain).val(value);
}
+ $('#template-edit-memory-textbox').val(template.memory.current);
+ $('#template-edit-max-memory-textbox').val(template.memory.maxmemory);
+
$('#template-edit-graphics').append('<option value="vnc"
selected="selected">VNC</option>');
var enableSpice = function() {
if (kimchi.capabilities == undefined) {
@@ -293,6 +304,7 @@ kimchi.template_edit_main = function() {
$('#guest-max-processor-panel').slideToggle();
var text = $('#guest-show-max-processor span.text').text();
$('#guest-show-max-processor span.text').text(text ==
i18n['KCHVMED6008M'] ? i18n['KCHVMED6009M'] :
i18n['KCHVMED6008M']);
+ $('#guest-show-max-processor
i.fa').toggleClass('fa-plus-circle fa-minus-circle');
});
};
kimchi.listNetworks(initInterface);
@@ -308,7 +320,7 @@ kimchi.template_edit_main = function() {
$('.modal input[type="checkbox"]').prop('disabled',
true);
$('.modal select').prop('disabled', true);
$('.modal .selectpicker').addClass('disabled');
- var editableFields = [ 'name', 'memory', 'graphics'];
+ var editableFields = [ 'name', 'memory', 'graphics',
'max-memory'];
var data = {};
var disks = $('.template-tab-body .item',
'#form-template-storage');
var disksForUpdate = new Array();
@@ -340,13 +352,21 @@ kimchi.template_edit_main = function() {
}
});
data['memory'] = Number(data['memory']);
+ data['max-memory'] = Number(data['max-memory']);
+
+ memory = {'current': data['memory'], 'maxmemory':
data['max-memory']};
+
+ data['memory'] = memory;
+ delete data['max-memory'];
+
var cpu = parseInt($('#vcpus').val());
var maxCpu = parseInt($('#guest-edit-max-processor-textbox').val());
var maxCpuFinal = cpu; //Initially set maxCpu to be the same as cpu
if (maxCpu >= cpu) {
maxCpuFinal = maxCpu;
}
- if($("input:checkbox",
"#form-template-processor").prop("checked")){
+
+ if($("input:checkbox",
"#form-template-processor").prop("checked")){
//Check if maxCpu field has a value
data['cpu_info'] = {
vcpus: cpu,
diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
index 375d077..d6c60e2 100644
--- a/ui/pages/guest-edit.html.tmpl
+++ b/ui/pages/guest-edit.html.tmpl
@@ -57,7 +57,14 @@
</div>
<div class="form-group">
<label
for="guest-edit-memory-textbox">$_("Memory (MB)")</label>
- <input id="guest-edit-memory-textbox"
class="form-control" name="memory" type="number"
min="1024" step="1024" />
+ <div id="guest-memory">
+ <input id="guest-edit-memory-textbox"
class="form-control" name="memory" type="number"
min="1024" step="1024" />
+ <button id="guest-show-max-memory" class="btn
btn-primary" type="button"><i class="fa
fa-plus-circle"></i> <span
class="text">$_("More")</span></button>
+ </div>
+ </div>
+ <div id="guest-max-memory-panel"
class="form-group">
+ <label
for="guest-edit-max-memory-textbox">$_("Max Memory
(MB)")</label>
+ <input id="guest-edit-max-memory-textbox"
class="form-control" name="max-memory" type="number"
min="1024" step="1024" />
</div>
<div class="form-group">
<label
for="guest-edit-icon-textbox">$_("Icon")</label>
diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl
index 0cb36bd..685b4e2 100644
--- a/ui/pages/tabs/templates.html.tmpl
+++ b/ui/pages/tabs/templates.html.tmpl
@@ -129,7 +129,7 @@
--><span class="item-hidden column-version
os-version-filter">$_("Version")</span><!--
--><span class='column-processors cpus-filter'
val="{cpus}"><strong>{cpus}</strong>
$_("cores")</span><!--
--><span class="item-hidden column-processors
cpus-filter">$_("CPUs")</span><!--
- --><span class='column-memory memory-filter'
val="{memory}"><strong>{memory}</strong>
$_("M")</span><!--
+ --><span class='column-memory memory-filter'
val="{memory.current}"><strong>{memory.current}</strong>
$_("M")</span><!--
--><span class="item-hidden column-memory
memory-filter">$_("Memory")</span>
</li>
</script>
diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl
index 45ff504..95af7bc 100644
--- a/ui/pages/template-edit.html.tmpl
+++ b/ui/pages/template-edit.html.tmpl
@@ -61,6 +61,9 @@
<div
class="template-edit-wrapper-label">
<label
for="template-edit-memory-textbox">$_("Memory (MB)")</label>
</div>
+ <div class="template-edit-wrapper-label
max-memory-field" style="display: none;">
+ <label
for="template-edit-max-memory-textbox">$_("Max Memory
(MB)")</label>
+ </div>
<div class="template-edit-wrapper-label
templ-edit-cdrom">
<label
for="template-edit-cdrom-textbox">$_("CDROM")</label>
</div>
@@ -82,7 +85,11 @@
<input
id="template-edit-version-textbox" class="form-control"
name="os_version" type="text" disabled="disabled" />
</div>
<div
class="template-edit-wrapper-controls">
- <input
id="template-edit-memory-textbox" class="form-control"
name="memory" type="text" />
+ <input
id="template-edit-memory-textbox" class="form-control"
name="memory" type="number" step="1024" min="1024"
style="width: 75%; display: inline;"/>
+ <button
id="template-show-max-memory" class="btn btn-primary"
type="button"><i class="fa fa-plus-circle"></i>
<span class="text">$_("More")</span></button>
+ </div>
+ <div class="template-edit-wrapper-controls
max-memory-field" style="display: none;">
+ <input
id="template-edit-max-memory-textbox" class="form-control"
name="max-memory" type="number" min="1024"
step="1024" />
</div>
<div class="template-edit-wrapper-controls
templ-edit-cdrom">
<input
id="template-edit-cdrom-textbox" class="form-control"
name="cdrom" type="text" disabled="disabled" />
--
2.5.0