1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-27 03:21:29 +03:00

B #1019: Fix scale action in sunstone cloud view (#722)

Co-authored-by: Tino Vázquez <cvazquez@opennebula.io>
This commit is contained in:
Sergio Betanzos 2021-01-28 19:50:18 +01:00 committed by GitHub
parent 083bec9844
commit 8c9caee42f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 23 deletions

View File

@ -130,6 +130,7 @@ define(function(require) {
$( ".cardinality_slider_div", context).html(RangeSlider.html({ $( ".cardinality_slider_div", context).html(RangeSlider.html({
min: min_vms, min: min_vms,
max: max_vms, max: max_vms,
max_value: max_vms,
initial: role_template.cardinality, initial: role_template.cardinality,
label: Locale.tr("Number of VMs for Role")+" "+role_template.name, label: Locale.tr("Number of VMs for Role")+" "+role_template.name,
name: "cardinality" name: "cardinality"

View File

@ -404,37 +404,47 @@ define(function(require) {
var role = $(this).closest(".provision_role_ul").data("role"); var role = $(this).closest(".provision_role_ul").data("role");
$(".provision_info_flow", context).data("role_id", role.name); $(".provision_info_flow", context).data("role_id", role.name);
var vms = [];
var promises = [];
if (role.nodes && role.nodes.length > 0) { if (role.nodes && role.nodes.length > 0) {
var vms = []; $.each(role.nodes, function(_, node) {
if (node.vm_info !== undefined) {
function promiseVmInfo(id, success) {
return $.ajax({
url: "vm/" + id,
type: "GET",
dataType: "json",
success: function (vm_json) {
vms.push(vm_json);
}
})
}
$.each(role.nodes, function(_, node){ promises.push(promiseVmInfo(node.deploy_id))
if(node.vm_info != undefined){
OpenNebulaVm.show({
data : { id: node.deploy_id },
timeout: true,
success: function (_, vm_json) {
vms.push(vm_json);
ProvisionVmsList.generate(
$(".provision_role_vms_container", context),
{
title: role.name + " " + Locale.tr("VMs"),
active: true,
refresh: false,
create: false,
filter: false,
data: vms
});
}
});
} }
}); });
} }
$.when.apply($, promises).then(function() {
ProvisionVmsList.generate(
$(".provision_role_vms_container", context),
{
title: role.name + " " + Locale.tr("VMs"),
active: true,
refresh: true,
create: false,
filter: false,
data: vms
});
});
}); });
context.on("click", ".provision_role_cardinality_button", function(){ context.on("click", ".provision_role_cardinality_button", function(){
var role = $(this).closest(".provision_role_ul").data("role"); var role = $(this).closest(".provision_role_ul").data("role");
var role_name = role.name var min_vms = (role.min_vms||0);
var min_vms = (role.min_vms||1);
var max_vms = (role.max_vms||100); var max_vms = (role.max_vms||100);
@ -465,6 +475,7 @@ define(function(require) {
$( ".cardinality_slider_div", context).html(RangeSlider.html({ $( ".cardinality_slider_div", context).html(RangeSlider.html({
min: min_vms, min: min_vms,
max: max_vms, max: max_vms,
max_value: max_vms,
initial: role.cardinality, initial: role.cardinality,
label: Locale.tr("Number of VMs for Role")+" "+role_name label: Locale.tr("Number of VMs for Role")+" "+role_name
})); }));

View File

@ -1020,7 +1020,12 @@ define(function(require) {
} }
function get_provision_ips(data) { function get_provision_ips(data) {
return "<i class=\"fas fa-fw fa-lg fa-globe\"></i> " + OpenNebula.VM.ipsStr(data, ", "); return (
"<div style=\"display: flex; gap: 5px;\">" +
"<i class=\"fas fa-fw fa-lg fa-globe\"></i>" +
"<div>" + OpenNebula.VM.ipsStr(data, ", ") + "</div>" +
"</div>"
);
} }
// @params // @params