diff --git a/src/sunstone/public/app/utils/schedule_action.js b/src/sunstone/public/app/utils/schedule_action.js index 968b9eb5f7..64ac54174c 100644 --- a/src/sunstone/public/app/utils/schedule_action.js +++ b/src/sunstone/public/app/utils/schedule_action.js @@ -47,12 +47,12 @@ define(function (require) { })).find("#relative_time", context).on("click", function(e){ $("#schedule_type",context).prop("checked",false); if($(this).is(":checked")){ - $("#no_relative_time_form, .periodic",context).hide(); + $("#no_relative_time_form, .periodic",context).addClass("hide"); $("#schedule_time",context).prop("",false); - $("#relative_time_form",context).show(); + $("#relative_time_form",context).removeClass("hide"); }else{ - $("#relative_time_form",context).hide(); - $("#no_relative_time_form",context).show(); + $("#relative_time_form",context).addClass("hide"); + $("#no_relative_time_form",context).removeClass("hide"); } }); if (res === "vms"){ @@ -287,6 +287,7 @@ define(function (require) { } sched_action.ACTION = new_action; $("#scheduling_" + this.res + "_actions_table .create", context).remove(); + $("#no_relative_time_form",context).addClass("hide"); $("#add_scheduling_" + this.res + "_action", context).removeAttr("disabled"); return sched_action; } diff --git a/src/sunstone/public/app/utils/schedule_action/html.hbs b/src/sunstone/public/app/utils/schedule_action/html.hbs index 73f6dea5b9..ced1ff6d0e 100644 --- a/src/sunstone/public/app/utils/schedule_action/html.hbs +++ b/src/sunstone/public/app/utils/schedule_action/html.hbs @@ -21,7 +21,7 @@ the License for the specific language governing permissions and }} {{! limitatio - + diff --git a/src/sunstone/public/app/utils/template-utils.js b/src/sunstone/public/app/utils/template-utils.js index 3280001ff8..949d89f8c0 100644 --- a/src/sunstone/public/app/utils/template-utils.js +++ b/src/sunstone/public/app/utils/template-utils.js @@ -16,13 +16,13 @@ define(function(require) { - var Locale = require('utils/locale'); - var Sunstone = require('sunstone'); - var Notifier = require('utils/notifier'); + var Locale = require("utils/locale"); + var Sunstone = require("sunstone"); + var Notifier = require("utils/notifier"); //Escape doublequote in a string and return it function _escapeDoubleQuotes(string) { - if (string != undefined && typeof(string) == "string") { + if (string != undefined && typeof(string) === "string") { // Recursive to deal with strings like: 'aa""b"' // The second " would not match @@ -31,8 +31,8 @@ define(function(require) { do { prev = result; - result = prev.replace(/([^\\]|^)"/g, '$1\\"'); - } while (prev != result) + result = prev.replace(/([^\\]|^)"/g, "$1\\\""); + } while (prev != result); return result; } else { @@ -44,14 +44,14 @@ define(function(require) { // input: <b>bold</b> "text" // output: bold "text" function _htmlDecode(value) { - return $('
').html(value).text(); + return $("
").html(value).text(); } // Transforms text: // input: bold "text" // output: <b>bold</b> "text" function _htmlEncode(value) { - return $('
').text(value).html(); + return $("
").text(value).html(); } // Transforms an object to an opennebula template string @@ -75,16 +75,16 @@ define(function(require) { $.each(values, function(index, element) { if (!element) return true; // current value can be an object - if (typeof element == 'object') { + if (typeof element === "object") { template_str += key + " = [\n"; template_str += Object.keys(element).map(function(k){ - return " " + k + " = \"" + _escapeDoubleQuotes(element[k].toString()) + "\""; - }).join(",\n") + return " " + k + " = \"" + _escapeDoubleQuotes(element[k] ? element[k].toString() : "") + "\""; + }).join(",\n"); template_str += " ]\n"; } else { // or a string - template_str += key + " = \"" + _escapeDoubleQuotes(element.toString()) + "\"\n"; + template_str += key + " = \"" + _escapeDoubleQuotes(element? element.toString() : "") + "\"\n"; } }); } @@ -103,8 +103,8 @@ define(function(require) { var array = false; while (i <= string_json.length-1){ var symbol = symbols[symbols.length-1]; - if(string_json[i] != " " && string_json[i] != "," && string_json[i] != "\n" || symbol == '"'){ - if(string_json[i] == "=" && symbol != '"' && characters.length > 0 && (!symbol || (symbol && symbol == "["))){ + if(string_json[i] != " " && string_json[i] != "," && string_json[i] != "\n" || symbol == "\""){ + if(string_json[i] == "=" && symbol != "\"" && characters.length > 0 && (!symbol || (symbol && symbol == "["))){ var key_aux = ""; while(characters.length > 0){ key_aux += characters.shift(); @@ -126,7 +126,7 @@ define(function(require) { sub_key = key_aux; } } - else if(string_json[i] == '"' && symbol && symbol == '"' && characters[characters.length-1] != "\\"){ + else if(string_json[i] == "\"" && symbol && symbol == "\"" && characters[characters.length-1] != "\\"){ symbols.pop(); var value_aux = ""; while(characters.length > 0){ @@ -144,13 +144,13 @@ define(function(require) { template_json[key] = value_aux; } } - else if(string_json[i] == '[' && !symbol){ + else if(string_json[i] == "[" && !symbol){ symbols.push("["); } - else if(string_json[i] == '"' && characters[characters.length-1] != "\\"){ - symbols.push('"'); + else if(string_json[i] == "\"" && characters[characters.length-1] != "\\"){ + symbols.push("\""); } - else if(string_json[i] == ']' && symbol && symbol == '['){ + else if(string_json[i] == "]" && symbol && symbol == "["){ symbols.pop(); if(array){ template_json[key].push(obj_aux); @@ -158,7 +158,7 @@ define(function(require) { } } else{ - if(JSON.stringify(template_json[key]) === '{}' && symbols.length <= 0){ //Empty + if(JSON.stringify(template_json[key]) === "{}" && symbols.length <= 0){ //Empty return false; } else{ @@ -172,11 +172,11 @@ define(function(require) { } return { - 'stringToTemplate': _convert_string_to_template, - 'templateToString': _convert_template_to_string, - 'htmlDecode': _htmlDecode, - 'htmlEncode': _htmlEncode, - 'escapeDoubleQuotes': _escapeDoubleQuotes + "stringToTemplate": _convert_string_to_template, + "templateToString": _convert_template_to_string, + "htmlDecode": _htmlDecode, + "htmlEncode": _htmlEncode, + "escapeDoubleQuotes": _escapeDoubleQuotes }; }); diff --git a/src/sunstone/public/scss/app.scss b/src/sunstone/public/scss/app.scss index 9f4e36a7dc..9eaf245845 100644 --- a/src/sunstone/public/scss/app.scss +++ b/src/sunstone/public/scss/app.scss @@ -198,6 +198,10 @@ textarea { max-width: 300px; } +.hide { + display: none; +} + meter { margin-bottom: 0; -webkit-appearance: slider-horizontal;