DRILL-6021:Show shutdown button when authentication is not enabled

closes #1127


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

Branch: refs/heads/master
Commit: e61df7c8d0da192c5c2c9e64b1d213c63cc81ecb
Parents: 4652b0b
Author: Jyothsna Donapati <jyothsnadonapati@jdonapa-e890.local>
Authored: Thu Feb 22 11:17:48 2018 -0800
Committer: Ben-Zvi <bben-...@mapr.com>
Committed: Wed Mar 7 14:58:18 2018 -0800

----------------------------------------------------------------------
 .../apache/drill/exec/server/rest/DrillRoot.java    | 16 +++++++++++-----
 exec/java-exec/src/main/resources/rest/index.ftl    |  4 ++--
 2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/e61df7c8/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
index ca6d748..ef439f6 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
@@ -205,12 +205,12 @@ public class DrillRoot {
       return new ClusterInfo(drillbits, currentVersion, mismatchedVersions,
           userEncryptionEnabled, bitEncryptionEnabled, shouldShowAdminInfo,
           QueueInfo.build(dbContext.getResourceManager()),
-          processUser, processUserGroups, adminUsers, adminUserGroups);
+          processUser, processUserGroups, adminUsers, adminUserGroups, 
authEnabled.get());
     }
 
     return new ClusterInfo(drillbits, currentVersion, mismatchedVersions,
         userEncryptionEnabled, bitEncryptionEnabled, shouldShowAdminInfo,
-        QueueInfo.build(dbContext.getResourceManager()));
+        QueueInfo.build(dbContext.getResourceManager()), authEnabled.get());
   }
 
   /**
@@ -341,6 +341,7 @@ public static class ClusterInfo {
   private final boolean userEncryptionEnabled;
   private final boolean bitEncryptionEnabled;
   private final boolean shouldShowAdminInfo;
+  private final boolean authEnabled;
   private final QueueInfo queueInfo;
 
   private String adminUsers;
@@ -355,7 +356,8 @@ public static class ClusterInfo {
                      boolean userEncryption,
                      boolean bitEncryption,
                      boolean shouldShowAdminInfo,
-                     QueueInfo queueInfo) {
+                     QueueInfo queueInfo,
+                     boolean authEnabled) {
     this.drillbits = Sets.newTreeSet(drillbits);
     this.currentVersion = currentVersion;
     this.mismatchedVersions = Sets.newTreeSet(mismatchedVersions);
@@ -363,6 +365,7 @@ public static class ClusterInfo {
     this.bitEncryptionEnabled = bitEncryption;
     this.shouldShowAdminInfo = shouldShowAdminInfo;
     this.queueInfo = queueInfo;
+    this.authEnabled = authEnabled;
   }
 
   @JsonCreator
@@ -376,8 +379,9 @@ public static class ClusterInfo {
                      String processUser,
                      String processUserGroups,
                      String adminUsers,
-                     String adminUserGroups) {
-    this(drillbits, currentVersion, mismatchedVersions, userEncryption, 
bitEncryption, shouldShowAdminInfo, queueInfo);
+                     String adminUserGroups,
+                     boolean authEnabled) {
+    this(drillbits, currentVersion, mismatchedVersions, userEncryption, 
bitEncryption, shouldShowAdminInfo, queueInfo, authEnabled);
     this.processUser = processUser;
     this.processUserGroups = processUserGroups;
     this.adminUsers = adminUsers;
@@ -411,6 +415,8 @@ public static class ClusterInfo {
   public boolean shouldShowAdminInfo() { return shouldShowAdminInfo; }
 
   public QueueInfo queueInfo() { return queueInfo; }
+
+  public boolean isAuthEnabled() { return  authEnabled; }
 }
 
 public static class DrillbitInfo implements Comparable<DrillbitInfo> {

http://git-wip-us.apache.org/repos/asf/drill/blob/e61df7c8/exec/java-exec/src/main/resources/rest/index.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/index.ftl 
b/exec/java-exec/src/main/resources/rest/index.ftl
index 6466701..449ea04 100644
--- a/exec/java-exec/src/main/resources/rest/index.ftl
+++ b/exec/java-exec/src/main/resources/rest/index.ftl
@@ -79,7 +79,7 @@
                   </span>
                 </td>
                 <td id="status" >${drillbit.getState()}</td>
-                <#if model.shouldShowAdminInfo()>
+                <#if model.shouldShowAdminInfo() || !model.isAuthEnabled() >
                   <td>
                       <button type="button" id="shutdown" 
onClick="shutdown('${drillbit.getAddress()}',$(this));"> SHUTDOWN </button>
                   </td>
@@ -269,7 +269,7 @@
                               }
                         });
       }
-       <#if model.shouldShowAdminInfo()>
+      <#if model.shouldShowAdminInfo() || !model.isAuthEnabled() >
           function shutdown(address,button) {
               url = "http://"+address+":"+portNum+"/gracefulShutdown";;
               var result = $.ajax({

Reply via email to