From e3243883f09a5343300c6340111315be5f386114 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 11 Dec 2018 13:56:48 +0100 Subject: [PATCH] Fixed static graph without images creation and update previsualization Former-commit-id: a3a0a7942f624d9ecb2a272560a57947be4b39a1 --- .../godmode/reporting/visual_console_builder.editor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index f6da2968e2..929e8b70f3 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -3674,9 +3674,10 @@ function insertDB(type, values) { success: function (data) { if (data['correct']) { id = data['id_data']; - if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){ - values['naturalWidth'] = $('#preview > img')[0].naturalWidth; - values['naturalHeight'] = $('#preview > img')[0].naturalHeight; + var image_to_show = $('#preview > img')[0]; + if((type === 'group_item') || (type === 'icon') || (type === 'static_graph' && typeof(image_to_show) !== 'undefined')){ + values['naturalWidth'] = image_to_show.naturalWidth; + values['naturalHeight'] = image_to_show.naturalHeight; } createItem(type, values, id); addItemSelectParents(id, data['text']); @@ -4947,6 +4948,9 @@ function showPreviewStaticGraph(staticGraph) { $spinner.prop("src", "../../images/spinner.gif"); } + // If no image configured do not show anything + if (staticGraph === null) return; + $("#preview") .empty() .css('text-align', 'right')