Wonjun Hong Wonjun Hong 2018-07-31
webhook: Minor update (webhook UI, naming)
@4caef1c0c9fbdc4f6212d44fde6817f0ad11df2b
app/assets/stylesheets/less/_common.less
--- app/assets/stylesheets/less/_common.less
+++ app/assets/stylesheets/less/_common.less
@@ -305,4 +305,9 @@
     line-height: 36px;
 }
 
-.dimgray { color:dimgray; }
(No newline at end of file)
+.dimgray { color:dimgray; }
+
+.vertical-align {
+    display: flex;
+    align-items: center;
+}
(No newline at end of file)
app/models/Webhook.java
--- app/models/Webhook.java
+++ app/models/Webhook.java
@@ -78,7 +78,7 @@
      */
     public Boolean gitPushOnly;
 
-    public WebhookType webhookType = WebhookType.WITH_DETAILS;
+    public WebhookType webhookType = WebhookType.SIMPLE;
 
     /**
      * Payload URL of webhook.
@@ -250,7 +250,7 @@
         }
         requestMessage += " <" + utils.Config.getScheme() + "://" + utils.Config.getHostport("localhost:9000") + RouteUtil.getUrl(eventPullRequest) + "|#" + eventPullRequest.number + ": " + eventPullRequest.title + ">";
 
-        if (this.webhookType == WebhookType.WITH_DETAILS) {
+        if (this.webhookType == WebhookType.DETAIL_SLACK) {
             return buildJsonWithPullReqtuestDetails(eventPullRequest, detailFields, attachments, requestMessage);
         } else {
             return buildTextPropertyOnlyJSON(requestMessage);
app/models/enumeration/WebhookType.java
--- app/models/enumeration/WebhookType.java
+++ app/models/enumeration/WebhookType.java
@@ -7,7 +7,7 @@
 package models.enumeration;
 
 public enum WebhookType {
-    SIMPLE(0), WITH_DETAILS(1);
+    SIMPLE(0), DETAIL_SLACK(1);
 
     private int type;
 
app/views/project/partial_webhooks_list.scala.html
--- app/views/project/partial_webhooks_list.scala.html
+++ app/views/project/partial_webhooks_list.scala.html
@@ -30,50 +30,51 @@
   </div>
 } else {
   <div class="row-fluid list-head">
-    <div class="span6 payload-url">
+    <div class="span5 payload-url">
       <strong>@Messages("project.webhook.payloadUrl")</strong>
     </div>
-    <div class="span6 secret">
-      <strong>@Messages("project.webhook.secret") | Include details or not | Working only when to push commit</strong>
+    <div class="span2 secret text-center">
+      <strong>@Messages("project.webhook.secret")</strong>
     </div>
+    <div class="span2 secret text-center">
+      <strong>Type of message</strong>
+    </div>
+    <div class="span2 secret text-center">
+      <strong>Just the push event</strong>
+    </div>
+    <div class="span1 secret text-center"></div>
+
   </div>
 
   @webhooks.map { webhook =>
-    <div class="row-fluid list-item" data-webhook-id="@webhook.id">
-      <div class="span6">
+    <div class="row-fluid list-item vertical-align" data-webhook-id="@webhook.id">
+      <div class="span5">
         <h6 class="mr20 truncate">
           @webhook.payloadUrl
         </h6>
       </div>
-      <div class="span6">
-        <table class="table nm">
-          <tr>
-            <td>
-              <span class="webhook-secret truncate">
-              @if(webhook.secret.isEmpty) {
-                  NONE
-              } else {
-                @webhook.secret
-              }
-              </span>
-            </td>
-            <td>
-              <span class="webhook-secret truncate">
-              @webhook.webhookType
-              </span>
-            </td>
-            <td>
-              <span class="webhook-secret truncate">
-              <input type="checkbox" @if(webhook.gitPushOnly){checked} onclick="return false;" />
-              </span>
-            </td>
-            <td class="actions">
-              <button type="button" class="ybtn ybtn-danger ybtn-small" data-request-method="delete" data-request-uri="@routes.ProjectApp.deleteWebhook(project.owner, project.name, webhook.id)">
-                @Messages("button.delete")
-              </button>
-            </td>
-          </tr>
-        </table>
+      <div class="span2 text-center">
+        <h6>
+          @if(webhook.secret.isEmpty) {
+              NONE
+          } else {
+            @webhook.secret
+          }
+        </h6>
+      </div>
+      <div class="span2 text-center">
+        <h6>
+          @webhook.webhookType
+        </h6>
+      </div>
+      <div class="span2 text-center">
+          <input type="checkbox" @if(webhook.gitPushOnly){checked} onclick="return false;" />
+
+      </div>
+      <div class="span1 text-center">
+        <button type="button" class="ybtn ybtn-danger ybtn-small" data-request-method="delete" data-request-uri="@routes.ProjectApp.deleteWebhook(project.owner, project.name, webhook.id)">
+          @Messages("button.delete")
+        </button>
       </div>
     </div>
   }
app/views/project/webhooks.scala.html
--- app/views/project/webhooks.scala.html
+++ app/views/project/webhooks.scala.html
@@ -24,7 +24,7 @@
             <input type="text" name="secret" class="input-webhook-secret" maxlength="250" autocomplete="off" placeholder="@Messages("project.webhook.secret")">
             <select class="form-control" title="add details or not" name="webhookType">
               <option value="SIMPLE">SIMPLE Version (no details)</option>
-              <option value="WITH_DETAILS">Normal (Slack/with details)</option>
+              <option value="DETAIL_SLACK">DETAIL Version (for slack) </option>
             </select>
             <label for="gitPushOnly">@Messages("project.webhook.gitPushOnly")</label>
             <input type="checkbox" id="gitPushOnly" name="gitPushOnly" class="form-check-input">
Add a comment
List