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

Bug #4017: Disable slider for persistent images. Add label to volatile disks

(cherry picked from commit dd3d1efb36)
This commit is contained in:
Carlos Martín 2015-10-19 16:58:18 +02:00
parent 8f327c76b4
commit f790ca94a9
2 changed files with 14 additions and 3 deletions

View File

@ -108,15 +108,20 @@ define(function(require){
var sizeGB = disk.SIZE / 1024;
diskContext.data('original_size', sizeGB);
var label = disk.IMAGE ? disk.IMAGE : Locale.tr("Volatile Disk");
var enabled = !(disk.PERSISTENT && disk.PERSISTENT.toUpperCase() == "YES");
RangeSlider.insert({
'label': disk.IMAGE,
'label': label,
'unitLabel': 'GB',
'name': 'SIZE',
'start': sizeGB,
'end': sizeGB + 500,
'step': 10,
'startValue': sizeGB
}, $(".diskSlider", diskContext))
'startValue': sizeGB,
'enabled': enabled
}, $(".diskSlider", diskContext));
})
}
})

View File

@ -32,6 +32,7 @@ define(function(require) {
opts.end End value of the slider
opts.step Step value of the slider
opts.startValue Initialize the slider with this value
opts.enabled false to disable the inputs (true by default)
@param {Object} context div to insert the range slider
@returns {String} HTML row
*/
@ -61,5 +62,10 @@ define(function(require) {
slider.foundation('slider', 'set_value', opts.startValue);
input.val(opts.startValue);
}
if (opts.enabled == false){
input.attr('disabled', 'disabled');
slider.attr('disabled', 'disabled');
}
}
});