drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prog...@apache.org
Subject [3/3] drill git commit: DRILL-5259: Allow listing a user-defined number of profiles
Date Wed, 04 Oct 2017 19:49:02 GMT
DRILL-5259: Allow listing a user-defined number of profiles

Added an additional field in the UI allowing a user to specify the max number of profiles
to load via Refresh

closes #963


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/9df8102e
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/9df8102e
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/9df8102e

Branch: refs/heads/master
Commit: 9df8102eb18d9718472a1291130345d960435085
Parents: bec436f
Author: Kunal Khatua <kkhatua@maprtech.com>
Authored: Mon Oct 2 13:07:54 2017 -0700
Committer: Paul Rogers <progers@maprtech.com>
Committed: Wed Oct 4 12:34:26 2017 -0700

----------------------------------------------------------------------
 .../server/rest/profile/ProfileResources.java   |  4 +++
 .../src/main/resources/rest/profile/list.ftl    | 37 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/9df8102e/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
index af47ee1..16c07d2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
@@ -194,6 +194,10 @@ public class ProfileResources {
       return finishedQueries;
     }
 
+    public int getMaxFetchedQueries() {
+      return work.getContext().getConfig().getInt(ExecConstants.HTTP_MAX_PROFILES);
+    }
+
     public List<String> getErrors() { return errors; }
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/9df8102e/exec/java-exec/src/main/resources/rest/profile/list.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/profile/list.ftl b/exec/java-exec/src/main/resources/rest/profile/list.ftl
index aba0033..8eb78fd 100644
--- a/exec/java-exec/src/main/resources/rest/profile/list.ftl
+++ b/exec/java-exec/src/main/resources/rest/profile/list.ftl
@@ -37,7 +37,42 @@
       <strong>No running queries.</strong>
     </div>
   </#if>
-  <h3>Completed Queries</h3>
+  <table width="100%">
+    <script type="text/javascript" language="javascript">
+    //Validate that the fetch number is valid
+    function checkMaxFetch() {
+      var maxFetch = document.forms["profileFetch"]["max"].value;
+      console.log("maxFetch: " + maxFetch);
+      if (isNaN(maxFetch) || (maxFetch < 1) || (maxFetch > 100000) ) {
+        alert("Invalid Entry: " + maxFetch + "\n" +
+               "Please enter a valid number of profiles to fetch (1 to 100000) ");
+        return false;
+      }
+      return true;
+    }
+    </script>
+    <tr>
+      <td><h3>Completed Queries</h3></td>
+      <td align="right">
+        <form name="profileFetch" action="/profiles" onsubmit="return checkMaxFetch();"
method="get"><span title="Max number of profiles to list">Showing <b>${model.getFinishedQueries()?size}</b>
profiles. Max: </span>
+        <input id="fetchMax" type="text" size="7" name="max" value="">
+        <input type="submit" value="Refresh">
+      </form></td>
+    </tr></table>
+    <!-- Placed after textbox to allow for DOM to contain "fetchMax" element -->
+    <script type="text/javascript" language="javascript">
+    //Get max fetched from URL for populating textbox
+    var maxFetched="${model.getMaxFetchedQueries()}";
+    if (window.location.search.indexOf("max=") >= 1) {
+      //Select 1st occurrence (Chrome accepts 1st of duplicates)
+      var kvPair=window.location.search.substr(1).split('&')[0];
+      maxFetched=kvPair.split('=')[1]
+    }
+    //Update textbox
+    $(document).ready(function() {
+            $("#fetchMax").val(maxFetched);
+    });
+    </script>
   <@list_queries queries=model.getFinishedQueries()/>
 </#macro>
 


Mime
View raw message