1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

M #~: show units in memory (#140)

Signed-off-by: Jorge Lobo <jlobo@opennebula.io>

Co-authored-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Miguel Lobo Escalona 2020-07-31 12:29:59 +02:00 committed by GitHub
parent 3ea9bd2696
commit 05aa6d8b84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -248,7 +248,7 @@ define(function(require) {
}
attr.visor = attr.type === "number";
UserInputs.insertAttributeInputMB(attr, $("div.memory_input", context), false);
UserInputs.insertAttributeInputMB(attr, $("div.memory_input", context), true, attr.type === "number");
if (Config.isFeatureEnabled("instantiate_hide_cpu")){
$(".vcpu_input input", context).prop("required", true);

View File

@ -712,22 +712,21 @@ define(function(require) {
* @param {object} attr structure as returned by parse
* @param {jQuery} div jQuery selector for the div to attach the html to
*/
function _insertAttributeInputMB(attr, div, inputUnit = true) {
function _insertAttributeInputMB(attr, div, displayUnit=true, editUnit = true) {
// Modified input for GB
var attr_gb = $.extend({}, attr);
if (attr.type == "range"){
attr.tick_size = 1024;
}
var select = '';
var selectInput = inputUnit? '': 'disabled';
if(attr && attr.visor){
var selectInput = editUnit? '': 'disabled';
if(displayUnit){
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\" style=\"display:flex;align-items:center;\"" + ">"+