From 4adcc0b8beb30696f0659186a6c9f76f1f4afc35 Mon Sep 17 00:00:00 2001 From: jloboescalona2 <47326048+jloboescalona2@users.noreply.github.com> Date: Fri, 15 Feb 2019 18:34:18 +0100 Subject: [PATCH] B #1548 solved nan in create vm template (#2955) --- .../public/app/utils/schedule_action.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/sunstone/public/app/utils/schedule_action.js b/src/sunstone/public/app/utils/schedule_action.js index 63d66ff23b..018b1739b0 100644 --- a/src/sunstone/public/app/utils/schedule_action.js +++ b/src/sunstone/public/app/utils/schedule_action.js @@ -232,7 +232,13 @@ define(function (require) { if (time_input_value === ""){ Notifier.notifyError("Time not defined."); return false; - } + } + var timeCal = date_input_value + " " + time_input_value; + epochStr = new Date(timeCal); + var time = parseInt(epochStr.getTime()) / 1000; + sched_action.END_TYPE = end_type; + sched_action.END_VALUE = time; + sched_action.TIME = time; if (periodic) { if (!this.repeat || !this.end_type) { return false; @@ -277,16 +283,13 @@ define(function (require) { } sched_action.DAYS = days; sched_action.REPEAT = rep; - sched_action.END_TYPE = end_type; sched_action.END_VALUE = end_value; } - var timeCal = date_input_value + " " + time_input_value; - epochStr = new Date(time); - var time = parseInt(epochStr.getTime()) / 1000; - sched_action.TIME = time; } sched_action.ACTION = new_action; $("#scheduling_" + this.res + "_actions_table .create", context).remove(); + $("#scheduling_" + this.res + "_actions_table #relative_time_form", context).remove(); + $("#scheduling_" + this.res + "_actions_table #no_relative_time_form", context).remove(); $("#no_relative_time_form",context).addClass("hide"); $("#add_scheduling_" + this.res + "_action", context).removeAttr("disabled"); return sched_action; @@ -393,7 +396,7 @@ define(function (require) { str += ""; } - var time = scheduling_action.TIME; + var time = scheduling_action.TIME.toString(); time = isNaN(time)? time_str : (time && time.match(/^\+(.*)/gi)? _time(time) : time_str); str += "" + TemplateUtils.htmlEncode(scheduling_action.ACTION) + "\