Commits

merickson  committed 1ed7ddb

Added flush queue and index, new styling

  • Participants
  • Parent commits 8b80907

Comments (0)

Files changed (2)

File src/main/resources/js/dev-toolbar.css

 #dev-toolbar {
-    background: #9C6;
+    background: #000;
+    opacity: .8;
+    position: fixed;
+    bottom : 0;
+    right: 0;
+    color: white;
+    z-index: 1000;
+    -moz-border-radius-topleft: 5px; /* Firefox */
+    -webkit-border-top-left-radius: 5px; /* Safari */
+    border-top-left-radius: 5px /* CSS3 (Opera?) */
 }
 
 #dev-toolbar-index-status {
-    margin-left: 0.5em
+    margin-left: 5px;
+    float: left;
+    min-width: 40px
 }
+
+#flush-index-button {
+   float: left;
+   margin-right: 5px;
+}
+
+#reindex-button {
+   float: left
+}
+
+#close-toolbar {
+    -moz-border-radius: 1em; /* Firefox */
+    -webkit-border-radius: 1em; /* Safari */
+    border-radius: 1em; /* CSS3 (Opera?) */
+    background: #666;
+    color: black;
+    font-weight: bold;
+    width: 1.2em;
+    text-align: center;
+    float: right;
+    margin-left: 5px;
+    cursor: default
+}

File src/main/resources/js/dev-toolbar.js

         var toolbar = $('<li>').addClass('confluence-messages', 'noteMessage');
         toolbar.attr("id", "dev-toolbar");
         toolbar.attr("style", "display: list-item;");
-        toolbar.append('<button id="reindex-button" class="aui">Reindex</button><span id="dev-toolbar-index-status"></span>');
+        toolbar.append('<button id="flush-index-button" class="aui">Flush Index Queue</button><button id="reindex-button" class="aui">Reindex</button><span id="dev-toolbar-index-status">100%</span><button id="flush-mail-button" class="aui">Flush Mail Queue</button><span id="close-toolbar">X</span>');
         return toolbar;
     };
 
         }, 500);
     };
 
+    var doFlushMailQueue = function() {
+        $.ajax({
+            type: "POST",
+            dataType: "html",
+            global: false,
+            timeout: 5000,
+            data: {
+                "atl_token" : getSecurityToken()
+            },
+            url: AJS.General.getContextPath() + "/admin/mail/flushqueue.action",
+            success: function (html) {
+                AJS.log('Mail queue flushed!');
+            },
+            error: function (xml, status) {
+                AJS.log('Error flushing mail queue!');
+            }
+        });
+    };
+
+    var doFlushIndexQueue = function() {
+        $.ajax({
+            type: "POST",
+            dataType: "html",
+            global: false,
+            timeout: 5000,
+            data: {
+                "atl_token" : getSecurityToken()
+            },
+            url: AJS.General.getContextPath() + "/admin/flushindexqueue.action",
+            success: function (html) {
+                AJS.log("Successfully flushed index queue!");
+            },
+            error: function (xml, status) {
+                AJS.log("Error flushing index queue!");
+            }
+        });
+    };
+
     var doReindex = function() {
         $.ajax({
             type: "POST",
         });
     };
 
+    var hideToolbar = function() {
+        $('#dev-toolbar').hide();
+    };
+
     jQuery(document).ready(function() {
         addMessageContainer();
         $('#messageContainer').append(makeDevToolbar());
         $('#reindex-button').click(doReindex);
+        $('#flush-mail-button').click(doFlushMailQueue);
+        $('#flush-index-button').click(doFlushIndexQueue);
+        $('#close-toolbar').click(hideToolbar);
     });
 })(AJS.$);