This is an automated email from the ASF dual-hosted git repository.

timothyfarkas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git

commit 3bc3b66919536dc94015dc23ce43e7254623de5d
Author: Anton Gozhiy <[email protected]>
AuthorDate: Fri Sep 21 15:19:33 2018 +0300

    DRILL-5782: Web UI: do not attempt to build visualized plan when plan is 
absent
    
    Added checks for undefined values. Now there are no js errors and also a 
JSON profile is now displayed for incorrect queries.
    
    closes #1476
---
 .../src/main/resources/rest/static/js/graph.js        | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/exec/java-exec/src/main/resources/rest/static/js/graph.js 
b/exec/java-exec/src/main/resources/rest/static/js/graph.js
index 9ea117c..5801245 100644
--- a/exec/java-exec/src/main/resources/rest/static/js/graph.js
+++ b/exec/java-exec/src/main/resources/rest/static/js/graph.js
@@ -19,10 +19,12 @@ $(window).on('load',(function () {
         return $.map(table, function (record, index) {
             var ra = [];
             var nested = faccess(record);
-            for (var i = 0; i < nested.length; i++) {
-                var newrec = $.extend({}, record);
-                newrec[dest] = nested[i];
-                ra.push(newrec);
+            if (nested !== undefined) {
+                for (var i = 0; i < nested.length; i++) {
+                    var newrec = $.extend({}, record);
+                    newrec[dest] = nested[i];
+                    ra.push(newrec);
+                }
             }
             return ra;
         });
@@ -350,9 +352,10 @@ $(window).on('load',(function () {
 
     function setupglobalconfig (profile) {
         globalconfig.profile = profile;
-        globalconfig.majorcolorscale = d3.scale.category20()
-            .domain([0, d3.max(profile.fragmentProfile, 
accessor("majorFragmentId"))]);
-
+        if (profile.fragmentProfile !== undefined) {
+            globalconfig.majorcolorscale = d3.scale.category20()
+                .domain([0, d3.max(profile.fragmentProfile, 
accessor("majorFragmentId"))]);
+        }
     }
 
     String.prototype.endsWith = function(suffix) {
@@ -368,7 +371,7 @@ $(window).on('load',(function () {
 
         // trigger svg drawing when visible
         $('#query-tabs').on('shown.bs.tab', function (e) {
-            if (queryvisualdrawn || !e.target.href.endsWith("#query-visual")) 
return;
+            if (profile.plan === undefined || queryvisualdrawn || 
!e.target.href.endsWith("#query-visual")) return;
             buildplangraph(d3.select("#query-visual-canvas"), profile.plan);
             queryvisualdrawn = true;
         })

Reply via email to