azkaban-aplcache

Fixed the UI display issue of same executionOptions for all

2/8/2018 4:25:38 PM

Details

diff --git a/azkaban-common/src/main/java/azkaban/executor/ExecutionOptions.java b/azkaban-common/src/main/java/azkaban/executor/ExecutionOptions.java
index ad47ff8..44ff5df 100644
--- a/azkaban-common/src/main/java/azkaban/executor/ExecutionOptions.java
+++ b/azkaban-common/src/main/java/azkaban/executor/ExecutionOptions.java
@@ -18,6 +18,7 @@ package azkaban.executor;
 
 import azkaban.executor.mail.DefaultMailCreator;
 import azkaban.utils.TypedMapWrapper;
+import com.google.gson.GsonBuilder;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -265,6 +266,10 @@ public class ExecutionOptions {
     return flowOptionObj;
   }
 
+  public String toJSON() {
+    return new GsonBuilder().setPrettyPrinting().create().toJson(toObject());
+  }
+
   public enum FailureAction {
     FINISH_CURRENTLY_RUNNING, CANCEL_ALL, FINISH_ALL_POSSIBLE
   }
diff --git a/azkaban-web-server/src/main/resources/azkaban/webapp/servlet/velocity/scheduledflowpage.vm b/azkaban-web-server/src/main/resources/azkaban/webapp/servlet/velocity/scheduledflowpage.vm
index 54958ab..ab55208 100644
--- a/azkaban-web-server/src/main/resources/azkaban/webapp/servlet/velocity/scheduledflowpage.vm
+++ b/azkaban-web-server/src/main/resources/azkaban/webapp/servlet/velocity/scheduledflowpage.vm
@@ -114,9 +114,18 @@
                 #else
                   <td>Not Applicable</td>
                 #end
-                <td><button type="button" data-toggle="modal" data-target="#executionOptions">show</button></td>
+                <td>
+                ## Changed the style of "Show" button to be consistent with other buttons.
+                  <button type="button" class="btn btn-sm btn-info" data-toggle="modal"
+                          data-target="#executionOptions-${velocityCount}">Show
+                  </button>
+                </td>
 
-                  <div class="modal fade" id="executionOptions" tabindex="-1" role="dialog" aria-labelledby="executionOptionsLabel">
+              ## Distinguished executionOptions of each schedule with unique count number to fix
+              ## the issue of same display for all schedules
+                <div class="modal fade" id="executionOptions-${velocityCount}" tabindex="-1"
+                     role="dialog"
+                     aria-labelledby="executionOptionsLabel">
                       <div class="modal-dialog" role="document">
                           <div class="modal-content">
                               <div class="modal-header">
@@ -124,7 +133,8 @@
                                   <h4 class="modal-title" id="executionOptionsLabel">Execution Options</h4>
                               </div>
                               <div class="modal-body">
-                                  ${sched.executionOptions.toObject()}
+                              ## Used <pre> to display text with code format
+                                <pre>${sched.executionOptions.toJSON()}</pre>
                               </div>
                               <div class="modal-footer">
                                   <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>