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

B #5336 Solved bug in attach volatile disk (raw, qcow2) (#437)

This commit is contained in:
Abel Coronado 2017-09-05 12:57:02 +02:00 committed by Tino Vázquez
parent c0ab0f71f4
commit aba4edfd4e
2 changed files with 41 additions and 9 deletions

View File

@ -105,19 +105,31 @@ define(function(require) {
$("[wizard_field]", imageContext).prop('wizard_field_disabled', true);
}
});
$("[wizard_field]", imageContext).prop('wizard_field_disabled', false);
$("[wizard_field]", volatileContext).prop('wizard_field_disabled', true);
// Volatile Type FS hides Format, Type SWAP displays Format
$("select#TYPE", volatileContext).change(function() {
$("select#TYPE_KVM", volatileContext).change(function() {
var value = $(this).val();
switch (value){
case "fs":
$("select#FORMAT", volatileContext).parent().show();
$("select#FORMAT_KVM", volatileContext).parent().show();
break;
case "swap":
$("select#FORMAT", volatileContext).parent().hide();
$("select#FORMAT_KVM", volatileContext).parent().hide();
break;
}
});
// Volatile Type FS hides Format, Type SWAP displays Format
$("select#TYPE_VCENTER", volatileContext).change(function() {
var value = $(this).val();
switch (value){
case "fs":
$("select#FORMAT_VCENTER", volatileContext).parent().show();
break;
case "swap":
$("select#FORMAT_VCENTER", volatileContext).parent().hide();
break;
}
});
@ -140,7 +152,16 @@ define(function(require) {
} else {
selectedContext = $("div.volatile", context);
if ($("select#TYPE", selectedContext).val() == "swap")
var typeKvm = $("#TYPE_KVM", context).val();
var typeVcenter = $("#TYPE_VCENTER", context).val();
var type = "fs";
if(typeKvm != "fs"){
type = typeKvm;
} else if (typeVcenter != "fs"){
type = typeVcenter;
}
if (type == "swap")
{
$("select#FORMAT", selectedContext).val("");
}
@ -148,6 +169,17 @@ define(function(require) {
var tmpl = WizardFields.retrieve(selectedContext);
tmpl.TYPE = type;
var formatKvm = $("#FORMAT_KVM", context).val();
var formatVcenter = $("#FORMAT_VCENTER", context).val();
if(formatKvm != "raw"){
tmpl.FORMAT = formatKvm;
} else if (formatVcenter != "raw"){
tmpl.FORMAT = formatVcenter;
}
if($(".mb_input_unit", context).val() == "GB"){
tmpl.SIZE = tmpl.SIZE * 1024;
tmpl.SIZE = tmpl.SIZE.toString();

View File

@ -84,11 +84,11 @@
<label for="TYPE">
{{tr "Disk type"}}
</label>
<select class="hypervisor only_kvm" wizard_field="TYPE" id="TYPE" name="type">
<select class="hypervisor only_kvm" wizard_field="TYPE" id="TYPE_KVM" name="type">
<option value="fs">{{tr "FS"}}</option>
<option value="swap">{{tr "Swap"}}</option>
</select>
<select class="hypervisor only_vcenter" style="display: none" wizard_field="TYPE" id="TYPE" name="type">
<select class="hypervisor only_vcenter" style="display: none" wizard_field="TYPE" id="TYPE_VCENTER" name="type">
<option value="fs">{{tr "FS"}}</option>
</select>
</div>
@ -96,11 +96,11 @@
<label for="FORMAT">
{{tr "Filesystem format"}}
</label>
<select class="hypervisor only_kvm" wizard_field="FORMAT" name="format" id="FORMAT">
<select class="hypervisor only_kvm" wizard_field="FORMAT" name="format" id="FORMAT_KVM">
<option value="raw" selected="selected">raw</option>
<option value="qcow2">qcow2</option>
</select>
<select class="hypervisor only_vcenter" style="display: none" wizard_field="FORMAT" name="format" id="FORMAT">
<select class="hypervisor only_vcenter" style="display: none" wizard_field="FORMAT" name="format" id="FORMAT_VCENTER">
<option value="raw" selected="selected">raw</option>
</select>
</div>