[ 
https://issues.apache.org/jira/browse/DRILL-6668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16699190#comment-16699190
 ] 

ASF GitHub Bot commented on DRILL-6668:
---------------------------------------

asfgit closed pull request #1543:  DRILL-6668: In Web UI, highlight options 
that are not default values 
URL: https://github.com/apache/drill/pull/1543
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java
index e6b116ccd4f..1ebef313e24 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java
@@ -90,7 +90,7 @@ public Viewable getStatus() {
     OptionList optionList = internal ? optionManager.getInternalOptionList(): 
optionManager.getPublicOptionList();
 
     for (OptionValue option : optionList) {
-      options.add(new OptionWrapper(option.name, option.getValue(), 
option.accessibleScopes, option.kind, option.scope));
+      options.add(new OptionWrapper(option.name, option.getValue(), 
optionManager.getDefault(option.name).getValue().toString(), 
option.accessibleScopes, option.kind, option.scope));
     }
 
     Collections.sort(options, new Comparator<OptionWrapper>() {
@@ -171,6 +171,7 @@ public Viewable updateSystemOption(@FormParam("name") 
String name,
 
     private String name;
     private Object value;
+    private String defaultValue;
     private OptionValue.AccessibleScopes accessibleScopes;
     private String kind;
     private String optionScope;
@@ -178,11 +179,13 @@ public Viewable updateSystemOption(@FormParam("name") 
String name,
     @JsonCreator
     public OptionWrapper(@JsonProperty("name") String name,
                          @JsonProperty("value") Object value,
+                         @JsonProperty("defaultValue") String defaultValue,
                          @JsonProperty("accessibleScopes") 
OptionValue.AccessibleScopes type,
                          @JsonProperty("kind") Kind kind,
                          @JsonProperty("optionScope") OptionValue.OptionScope 
scope) {
       this.name = name;
       this.value = value;
+      this.defaultValue = defaultValue;
       this.accessibleScopes = type;
       this.kind = kind.name();
       this.optionScope = scope.name();
@@ -201,6 +204,10 @@ public Object getValue() {
       return value;
     }
 
+    public String getDefaultValue() {
+      return defaultValue;
+    }
+
     public OptionValue.AccessibleScopes getAccessibleScopes() {
       return accessibleScopes;
     }
@@ -215,7 +222,7 @@ public String getOptionScope() {
 
     @Override
     public String toString() {
-      return "OptionWrapper{" + "name='" + name + '\'' + ", value=" + value + 
", accessibleScopes=" + accessibleScopes + ", kind='" + kind + '\'' + ", 
scope='" + optionScope + '\'' +'}';
+      return "OptionWrapper{" + "name='" + name + '\'' + ", value=" + value + 
", default=" + defaultValue + ", accessibleScopes=" + accessibleScopes + ", 
kind='" + kind + '\'' + ", scope='" + optionScope + '\'' +'}';
     }
   }
 }
diff --git a/exec/java-exec/src/main/resources/rest/options.ftl 
b/exec/java-exec/src/main/resources/rest/options.ftl
index 085fb451b1d..7ac8a2e7f79 100644
--- a/exec/java-exec/src/main/resources/rest/options.ftl
+++ b/exec/java-exec/src/main/resources/rest/options.ftl
@@ -21,6 +21,11 @@
 <#macro page_head>
     <script type="text/javascript" language="javascript"  
src="/static/js/jquery.dataTables-1.10.16.min.js"> </script>
     <script type="text/javascript" language="javascript" 
src="/static/js/dataTables.colVis-1.1.0.min.js"></script>
+    <script>
+        function resetToDefault(optionName, optionValue, optionKind) {
+            $.post("/option/"+optionName, {kind: optionKind, name: optionName, 
value: optionValue}, function (status) { location.reload(true); } );
+        }
+    </script>
     <!-- List of Option Descriptions -->
     <script src="/dynamic/options.describe.js"></script>
     <link href="/static/css/dataTables.colVis-1.1.0.min.css" rel="stylesheet">
@@ -85,6 +90,9 @@ table.sortable thead .sorting_desc { background-image: 
url("/static/img/black-de
                   </#if>
                     <div class="input-group-btn">
                       <button class="btn btn-default" 
type="submit">Update</button>
+                      <button class="btn btn-default" 
onClick="resetToDefault('${option.getName()}','${option.getDefaultValue()}', 
'${option.getKind()}')" type="button"
+                              <#if option.getDefaultValue() == 
option.getValueAsString()>disabled="true" style="pointer-events:none" <#else>
+                      title="Reset to 
${option.getDefaultValue()}"</#if>>Reset</button>
                     </div>
                   </div>
                 </div>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> In Web Console, highlight options that are different from default values
> ------------------------------------------------------------------------
>
>                 Key: DRILL-6668
>                 URL: https://issues.apache.org/jira/browse/DRILL-6668
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Web Server
>    Affects Versions: 1.14.0
>            Reporter: Paul Rogers
>            Assignee: Kunal Khatua
>            Priority: Minor
>              Labels: doc-impacting, ready-to-commit
>             Fix For: 1.15.0
>
>         Attachments: screenshot-1.png
>
>
> Suppose you inherit a Drill setup created by someone else (or by you, some 
> time in the past). Or, suppose you are a support person. You want to know 
> which Drill options have been changed from the defaults.
> The Web UI conveniently displays all options. But, there is no indication of 
> which might have non-default values.
> After the improvements of the last year, the information needed to detect 
> non-default values is now available. Would be great to mark these values. 
> Perhaps using colors, perhaps with words.
> For example:
> *planner.width.max_per_node*          200 \[Update]
> Or
> planner.width.max_per_node (system)     200 \[Update]
> (The Web UI does not, I believe, show session settings, since the Web UI has 
> no sessions. I believe the custom values are all set by {{ALTER SYSTEM}}. 
> Otherwise, we could also have a "(session)" suffix above.)
> Then, in addition to the {{[Update]}} button, for non default values, also 
> provide a {{[Reset]}} button that does the same as {{ALTER SESSION RESET}}.
> planner.width.max_per_node (session)     200 \[Update] \[Reset]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to