From fbc6aea497c81b314e5744a24c643f369538a53d Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Thu, 28 Mar 2019 08:12:09 -0400 Subject: [PATCH] Fix an issue where JSON data would not be rendered in the Query Tool. Fixes #4105 --- docs/en_US/release_notes_4_4.rst | 1 + .../tools/sqleditor/static/js/sqleditor.js | 48 +++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docs/en_US/release_notes_4_4.rst b/docs/en_US/release_notes_4_4.rst index 71e7d2232..a376abb0d 100644 --- a/docs/en_US/release_notes_4_4.rst +++ b/docs/en_US/release_notes_4_4.rst @@ -58,4 +58,5 @@ Bug fixes | `Bug #4090 `_ - Improve the German translation for Backup Server. | `Bug #4099 `_ - Fix SQL help for EPAS 10+, and refactor the URL generation code into a testable function. | `Bug #4100 `_ - Ensure sequences can be created with increment, start, minimum and maximum options set. +| `Bug #4105 `_ - Fix an issue where JSON data would not be rendered in the Query Tool. | `Bug #4109 `_ - Ensure View/Materialized View node should be visible after updating any property. \ No newline at end of file diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 6da106c1e..ec8ab9547 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -2422,31 +2422,31 @@ define('tools.querytool', [ if(data.types[0] && data.types[0].typname === 'json') { /* json is sent as text, parse it */ explain_data_json = JSON.parse(data.result[0]); + } - if (explain_data_json && explain_data_json[0] && - explain_data_json[0].hasOwnProperty('Plan') && - _.isObject(explain_data_json[0]['Plan']) - ) { - var explain_data = [JSON.stringify(explain_data_json, null, 2)]; - explain_data_array.push(explain_data); - // Make sure - the 'Data Output' panel is visible, before - we - // start rendering the grid. - self.gridView.data_output_panel.focus(); - setTimeout( - function() { - self.gridView.render_grid( - explain_data_array, self.columns, self.can_edit, - self.client_primary_key - ); - // Make sure - the 'Explain' panel is visible, before - we - // start rendering the grid. - self.gridView.explain_panel.focus(); - pgExplain.DrawJSONPlan( - $('.sql-editor-explain'), explain_data_json - ); - }, 10 - ); - } + if (explain_data_json && explain_data_json[0] && + explain_data_json[0].hasOwnProperty('Plan') && + _.isObject(explain_data_json[0]['Plan']) + ) { + var explain_data = [JSON.stringify(explain_data_json, null, 2)]; + explain_data_array.push(explain_data); + // Make sure - the 'Data Output' panel is visible, before - we + // start rendering the grid. + self.gridView.data_output_panel.focus(); + setTimeout( + function() { + self.gridView.render_grid( + explain_data_array, self.columns, self.can_edit, + self.client_primary_key + ); + // Make sure - the 'Explain' panel is visible, before - we + // start rendering the grid. + self.gridView.explain_panel.focus(); + pgExplain.DrawJSONPlan( + $('.sql-editor-explain'), explain_data_json + ); + }, 10 + ); } else { // Make sure - the 'Data Output' panel is visible, before - we // start rendering the grid.