1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

M #~: fix memory input GB (#138)

Signed-off-by: Jorge Lobo <jlobo@opennebula.io>
This commit is contained in:
Jorge Miguel Lobo Escalona 2020-07-30 16:03:09 +02:00 committed by GitHub
parent 72dc61013d
commit 0b7723ff7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 18 deletions

View File

@ -718,26 +718,30 @@ define(function(require) {
if (attr.type == "range"){
attr.tick_size = 1024;
}
var selectInput = inputUnit
? "<div class=\"input-group-button\">"+
"<select class=\"mb_input_unit\">" +
"<option value=\"MB\">"+Locale.tr("MB")+"</option>" +
"<option value=\"GB\">"+Locale.tr("GB")+"</option>" +
"<option value=\"TB\">"+Locale.tr("TB")+"</option>" +
"</select>" +
"</div>" : "<span style='margin-left:0.5rem'>MB</span>";
var select = '';
var selectInput = inputUnit? '': 'disabled';
if(attr && attr.visor){
var select = "<select class=\"mb_input_unit\" "+selectInput+">" +
"<option value=\"MB\">"+Locale.tr("MB")+"</option>" +
"<option value=\"GB\">"+Locale.tr("GB")+"</option>" +
"<option value=\"TB\">"+Locale.tr("TB")+"</option>" +
"</select>";
}
div.html(
"<div class=\"input-group mb_input_wrapper\"" +
(!inputUnit && " style='display:flex;align-items:center;'") + ">"+
"<div class=\"input-group mb_input_wrapper\" style=\"display:flex;align-items:center;\"" + ">"+
"<div class=\"mb_input input-group-field\">" +
_attributeInput(attr) +
"</div>" + selectInput + "</div>");
_setupAttributeInputMB(div, inputUnit);
"</div>"+
"<div class=\"input-group-button\">"+
select+
"</div>"+
"</div>");
_setupAttributeInputMB(div);
}
function _setupAttributeInputMB(context, inputUnit) {
function _setupAttributeInputMB(context) {
var base = 1024;
var baseCal = 1;
var unit = "MB";
@ -769,7 +773,7 @@ define(function(require) {
$("input, select", contextElement).val(valueInMB);
valueInUnit = valueInMB / baseCal;
}
$("input.visor", contextElement).val(inputUnit ? valueInUnit : valueInMB);
$("input.visor", contextElement).val(valueInUnit);
var contextUnit = contextElement.siblings(".input-group-button");
$(".mb_input_unit", contextUnit).val(unit).trigger("change");
}

View File

@ -247,9 +247,8 @@ meter {
width: 4em;
}
span.mb_input_unit {
width: auto;
margin-left: 0.5em;
select.mb_input_unit {
margin-bottom: 0px;
}
.superHide{