You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by so...@apache.org on 2018/06/06 15:43:35 UTC

[drill] branch master updated: DRILL-6432: Show Button to print visualized query plan (#1278)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 23a7a8d  DRILL-6432: Show Button to print visualized query plan (#1278)
23a7a8d is described below

commit 23a7a8d83abdcc0f4cff66bdf6b2010be02e3698
Author: Kunal Khatua <kk...@users.noreply.github.com>
AuthorDate: Wed Jun 6 08:43:27 2018 -0700

    DRILL-6432: Show Button to print visualized query plan (#1278)
    
    * DRILL-6432: Show Button to print visualized query plan
    
    Having the capability to only print the visualized query plan means the user can specifyi the zoom level (in the printer settings) when printing large complex plans that might span multiple pages.
    
    * Update based on review comment
    
    Padded button by 15px to avoid sticking to pane
    
    closes #1278
---
 .../src/main/resources/rest/profile/profile.ftl        | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/exec/java-exec/src/main/resources/rest/profile/profile.ftl b/exec/java-exec/src/main/resources/rest/profile/profile.ftl
index 64a955c..13bd8c4 100644
--- a/exec/java-exec/src/main/resources/rest/profile/profile.ftl
+++ b/exec/java-exec/src/main/resources/rest/profile/profile.ftl
@@ -86,7 +86,12 @@ table.sortable thead .sorting_desc { background-image: url("/static/img/black-de
       <p><pre>${model.profile.plan}</pre></p>
     </div>
     <div id="query-visual" class="tab-pane">
-      <svg id="query-visual-canvas" class="center-block"></svg>
+      <div style='padding: 15px 15px;'>
+        <button type='button' class='btn btn-default' onclick='popUpAndPrintPlan();'><span class="glyphicon glyphicon-print"></span> Print Plan</button>
+      </div>
+      <div>
+        <svg id="query-visual-canvas" class="center-block"></svg>
+      </div>
     </div>
     <div id="query-edit" class="tab-pane">
       <p>
@@ -453,7 +458,16 @@ table.sortable thead .sorting_desc { background-image: url("/static/img/black-de
       enableBasicAutocompletion: true,
       enableLiveAutocompletion: false
     });
-  </script>
+
+    //Pops out a new window and provids prompt to print
+    var popUpAndPrintPlan = function() {
+      var srcSvg = $('#query-visual-canvas');
+      var screenRatio=0.9;
+      let printWindow = window.open('', 'PlanPrint', 'width=' + (screenRatio*screen.width) + ',height=' + (screenRatio*screen.height) );
+      printWindow.document.writeln($(srcSvg).parent().html());
+      printWindow.print();
+    };
+    </script>
 
 </#macro>
 

-- 
To stop receiving notification emails like this one, please contact
sorabh@apache.org.