Commit b8a48b95 by Kálmán Viktor

dashboard: fix sliders

forked the original repo and applied our changes
parent 8e1635ef
......@@ -17,7 +17,7 @@
"no-vnc": "*",
"bootstrap-tour": "~0.9.3",
"jquery-knob": "~1.2.9",
"jquery-simple-slider": "*",
"jquery-simple-slider": "https://github.com/BME-IK/jquery-simple-slider.git",
"bootbox": "~4.3.0"
}
}
......@@ -455,15 +455,14 @@ $(document).on('shown.bs.tab', 'a[href="#resources"]', function (e) {
});
function addSliderMiscs() {
var vms = $(".vm-slider:not(.slider-added)").addClass("slider-added");
// set max values based on inputs
var cpu_count_range = "0, " + $(".cpu-count-input").prop("max");
var ram_range = "0, " + $(".ram-input").prop("max");
$(".cpu-count-slider").data("slider-range", cpu_count_range);
$(".ram-slider").data("slider-range", ram_range);
vms.simpleSlider();
$(".cpu-priority-slider", vms).bind("slider:changed", function (event, data) {
$(".vm-slider").simpleSlider();
$(".cpu-priority-slider").bind("slider:changed", function (event, data) {
var value = data.value + 0;
$('.cpu-priority-input option[value="' + value + '"]').attr("selected", "selected");
......@@ -474,7 +473,7 @@ function addSliderMiscs() {
$(".cpu-priority-slider").simpleSlider("setValue", val);
});
$(".cpu-count-slider", vms).bind("slider:changed", function (event, data) {
$(".cpu-count-slider").bind("slider:changed", function (event, data) {
var value = data.value + 0;
$(".cpu-count-input").val(parseInt(value));
});
......@@ -487,7 +486,7 @@ function addSliderMiscs() {
var ram_fire = false;
$(".ram-slider", vms).bind("slider:changed", function (event, data) {
$(".ram-slider").bind("slider:changed", function (event, data) {
if(ram_fire) {
ram_fire = false;
return;
......@@ -505,9 +504,9 @@ function addSliderMiscs() {
setDefaultSliderValues();
$(".cpu-priority-slider", vms).simpleSlider("setDisabled", $(".cpu-priority-input").prop("disabled"));
$(".cpu-count-slider", vms).simpleSlider("setDisabled", $(".cpu-count-input").prop("disabled"));
$(".ram-slider", vms).simpleSlider("setDisabled", $(".ram-input").prop("disabled"));
$(".cpu-priority-slider").simpleSlider("setDisabled", $(".cpu-priority-input").prop("disabled"));
$(".cpu-count-slider").simpleSlider("setDisabled", $(".cpu-count-input").prop("disabled"));
$(".ram-slider").simpleSlider("setDisabled", $(".ram-input").prop("disabled"));
}
function setDefaultSliderValues() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment