activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1444246 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/le...
Date Fri, 08 Feb 2013 21:18:49 GMT
Author: chirino
Date: Fri Feb  8 21:18:48 2013
New Revision: 1444246

URL: http://svn.apache.org/r1444246
Log:
Improve the display of topic message browsing.

Added:
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrowsePageDTO.java
Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Subscription.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/TopicStatusDTO.java
    activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBStore.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
Fri Feb  8 21:18:48 2013
@@ -123,6 +123,8 @@ object RouterListenerFactory {
   }
 }
 
+case class BrowseResult(first_seq:Long, last_seq:Long, total_entries:Long, entries:Array[(EntryStatusDTO,
Delivery)])
+
 /**
  * <p>
  * </p>
@@ -136,6 +138,9 @@ trait DomainDestination extends SecuredR
   def virtual_host:VirtualHost
 
 
+  def browse(from_seq:Long, to:Option[Long], max:Long)(func: (BrowseResult)=>Unit):Unit
+
+
   def bind (bind_address:BindAddress, consumer:DeliveryConsumer):Unit
   def unbind (consumer:DeliveryConsumer, persistent:Boolean):Unit
 

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
Fri Feb  8 21:18:48 2013
@@ -332,14 +332,14 @@ class Queue(val router: LocalRouter, val
     rc
   }
 
-  def browse(from_seq:Long, to:Option[Long], max:Long)(func: (Array[(EntryStatusDTO, Delivery)])=>Unit):Unit
= {
+  def browse(from_seq:Long, to:Option[Long], max:Long)(func: (BrowseResult)=>Unit):Unit
= {
     var result = ListBuffer[(EntryStatusDTO, Delivery)]()
     def load_from(start:Long):Unit = {
       assert_executing
       var cur = head_entry.getNext
       while(true) {
         if( cur == null || result.size >= max || ( to.isDefined && cur.seq >
to.get) ) {
-          func(result.toArray)
+          func(BrowseResult(head_entry.seq, head_entry.getPreviousCircular.seq, enqueue_item_counter,
result.toArray))
           return
         }
         val next = cur.getNext

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Subscription.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Subscription.scala?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Subscription.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Subscription.scala
Fri Feb  8 21:18:48 2013
@@ -370,6 +370,8 @@ class Subscription(val queue:Queue, val 
         return
       }
 
+      val next = entry.getNext
+
       total_ack_count += 1
       total_ack_size += entry.size
       entry.dequeue(uow)
@@ -383,11 +385,11 @@ class Subscription(val queue:Queue, val 
       // we may now be able to prefetch some messages..
       acquired_size -= entry.size
 
-      val next = entry.nextOrTail
       entry.remove // entry size changes to 0
-
       queue.trigger_swap
-      next.task.run
+      if( next!=null ) {
+        next.task.run
+      }
       check_drained
 
     }

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
Fri Feb  8 21:18:48 2013
@@ -279,6 +279,10 @@ class Topic(val router:LocalRouter, val 
       add_enqueue_counters(rc.metrics, link)
     }
 
+    if( retained_message!=null ) {
+      rc.retained = 1
+    }
+
     if( !show_producers ) {
       rc.producers = null
     }
@@ -337,17 +341,17 @@ class Topic(val router:LocalRouter, val 
     }
   }
 
-  def browse(from_seq:Long, max:Long)(func: (Array[(EntryStatusDTO, Delivery)])=>Unit):Unit
= {
+  def browse(from_seq:Long, to:Option[Long], max:Long)(func: (BrowseResult)=>Unit):Unit
= {
     val msg = retained_message
     if ( msg==null ) {
-      func(Array())
+      func(BrowseResult(0, 0, 0, Array()))
     } else {
       val status = new EntryStatusDTO()
       status.seq = retained_message.seq
       status.size = retained_message.size
       status.state = "loaded"
       status.is_prefetched = true;
-      func(Array((status, retained_message)))
+      func(BrowseResult(status.seq, status.seq, 1, Array((status, retained_message))))
     }
   }
 

Added: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrowsePageDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrowsePageDTO.java?rev=1444246&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrowsePageDTO.java
(added)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrowsePageDTO.java
Fri Feb  8 21:18:48 2013
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.dto;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import javax.xml.bind.annotation.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>Holds a page of data browsed from a destination.</p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@XmlRootElement(name="browse_page")
+@XmlAccessorType(XmlAccessType.FIELD)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class BrowsePageDTO {
+
+    /**
+     */
+    @XmlAttribute(name="first_seq")
+    public long first_seq;
+
+    /**
+     */
+    @XmlAttribute(name="last_seq")
+    public long last_seq;
+
+    /**
+     */
+    @XmlAttribute(name="total_messages")
+    public long total_messages;
+
+    @XmlElement(name="messages")
+    public List<MessageStatusDTO> messages = new ArrayList<MessageStatusDTO>();
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof BrowsePageDTO)) return false;
+
+        BrowsePageDTO that = (BrowsePageDTO) o;
+
+        if (first_seq != that.first_seq) return false;
+        if (last_seq != that.last_seq) return false;
+        if (total_messages != that.total_messages) return false;
+        if (messages != null ? !messages.equals(that.messages) : that.messages != null)
+            return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (int) (first_seq ^ (first_seq >>> 32));
+        result = 31 * result + (int) (last_seq ^ (last_seq >>> 32));
+        result = 31 * result + (int) (total_messages ^ (total_messages >>> 32));
+        result = 31 * result + (messages != null ? messages.hashCode() : 0);
+        return result;
+    }
+}

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/TopicStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/TopicStatusDTO.java?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/TopicStatusDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/TopicStatusDTO.java
Fri Feb  8 21:18:48 2013
@@ -36,6 +36,9 @@ public class TopicStatusDTO extends Serv
     @XmlElement
     public TopicDTO config;
 
+    @XmlElement(name="retained")
+    public long retained;
+
     /**
      * Ids of all connections that are producing to the destination
      */

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBStore.scala?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBStore.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBStore.scala
Fri Feb  8 21:18:48 2013
@@ -77,9 +77,13 @@ class LevelDBStore(val config: LevelDBSt
     }
   }
 
-  protected def store(uows: Seq[DelayableUOW])(callback: => Unit) = {
-    write_executor {
+  protected def store(uows: Seq[DelayableUOW])(callback: => Unit) = write_executor {
+    try {
       client.store(uows)
+    } catch {
+      case e =>
+      warn(e, "Failure occured while storing units of work: "+e)
+    } finally {
       dispatch_queue {
         callback
       }

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
Fri Feb  8 21:18:48 2013
@@ -618,17 +618,24 @@ class BrokerResource() extends Resource 
   def topic_messages(@PathParam("id") id : String, @PathParam("name") name : String,
                      @QueryParam("from") _from:java.lang.Long,
                      @QueryParam("max") _max:java.lang.Long,
-                     @QueryParam("max_body") _max_body:java.lang.Integer):Array[MessageStatusDTO]
= {
+                     @QueryParam("max_body") _max_body:java.lang.Integer):BrowsePageDTO =
{
     var from = OptionSupport(_from).getOrElse(0L)
     var max = OptionSupport(_max).getOrElse(100L)
     var max_body = OptionSupport(_max_body).getOrElse(0)
     with_virtual_host(id) { host =>
-      val rc = FutureResult[Array[MessageStatusDTO]]()
+      val rc = FutureResult[BrowsePageDTO]()
       val router: LocalRouter = host
       val node = router.local_topic_domain.destination_by_id.get(name).getOrElse(result(NOT_FOUND))
       monitoring(node) {
-        node.browse(from, max) { deliveries =>
-          rc.set(Success(deliveries.map(message_convert(max_body, _))))
+        node.browse(from, None, max) { browse_result =>
+          val page = new BrowsePageDTO()
+          for( entry <- browse_result.entries ) {
+            page.messages.add(message_convert(max_body, entry))
+          }
+          page.first_seq = browse_result.first_seq
+          page.last_seq = browse_result.last_seq
+          page.total_messages = browse_result.total_entries
+          rc.set(Success(page))
         }
       }
       rc
@@ -673,18 +680,25 @@ class BrokerResource() extends Resource 
                       @QueryParam("from") _from:java.lang.Long,
                       @QueryParam("to") _to:java.lang.Long,
                       @QueryParam("max") _max:java.lang.Long,
-                      @QueryParam("max_body") _max_body:java.lang.Integer):Array[MessageStatusDTO]
= {
+                      @QueryParam("max_body") _max_body:java.lang.Integer):BrowsePageDTO
= {
     var from = OptionSupport(_from).getOrElse(0L)
     var to = OptionSupport(_to)
     var max = OptionSupport(_max).getOrElse(100L)
     var max_body = OptionSupport(_max_body).getOrElse(0)
     with_virtual_host(id) { host =>
-      val rc = FutureResult[Array[MessageStatusDTO]]()
+      val rc = FutureResult[BrowsePageDTO]()
       val router: LocalRouter = host
       val node = router.local_queue_domain.destination_by_id.get(name).getOrElse(result(NOT_FOUND))
       monitoring(node) {
-        node.browse(from, to, max) { deliveries =>
-          rc.set(Success(deliveries.map(message_convert(max_body, _))))
+        node.browse(from, to, max) { browe_result =>
+          val page = new BrowsePageDTO()
+          for( entry <- browe_result.entries ) {
+            page.messages.add(message_convert(max_body, entry))
+          }
+          page.first_seq = browe_result.first_seq
+          page.last_seq = browe_result.last_seq
+          page.total_messages = browe_result.total_entries
+          rc.set(Success(page))
         }
       }
       rc
@@ -742,6 +756,7 @@ class BrokerResource() extends Resource 
     rc.codec = delivery.message.codec.id()
     rc.headers = delivery.message.headers_as_json;
     rc.expiration = delivery.expiration
+    rc.persistent = delivery.persistent
     rc.entry = entry
 
     if( max_body > 0 ) {
@@ -818,19 +833,26 @@ class BrokerResource() extends Resource 
              @QueryParam("from") _from:java.lang.Long,
              @QueryParam("to") _to:java.lang.Long,
              @QueryParam("max") _max:java.lang.Long,
-             @QueryParam("max_body") _max_body:java.lang.Integer):Array[MessageStatusDTO]
= {
+             @QueryParam("max_body") _max_body:java.lang.Integer):BrowsePageDTO = {
     var from = OptionSupport(_from).getOrElse(0L)
     var to = OptionSupport(_to)
     var max = OptionSupport(_max).getOrElse(100L)
     var max_body = OptionSupport(_max_body).getOrElse(0)
 
     with_virtual_host(id) { host =>
-      val rc = FutureResult[Array[MessageStatusDTO]]()
+      val rc = FutureResult[BrowsePageDTO]()
       val router: LocalRouter = host
       val node = router.local_dsub_domain.destination_by_id.get(name).getOrElse(result(NOT_FOUND))
       monitoring(node) {
-        node.browse(from, to, max) { deliveries =>
-          rc.set(Success(deliveries.map(message_convert(max_body, _))))
+        node.browse(from, to, max) { browse_result =>
+          val page = new BrowsePageDTO()
+          for( entry <- browse_result.entries ) {
+            page.messages.add(message_convert(max_body, entry))
+          }
+          page.first_seq = browse_result.first_seq
+          page.last_seq = browse_result.last_seq
+          page.total_messages = browse_result.total_entries
+          rc.set(Success(page))
         }
       }
       rc

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml Fri Feb  8 21:18:48
2013
@@ -72,5 +72,9 @@
     <extension>woff</extension>
     <mime-type>font/woff</mime-type>
   </mime-mapping>
+  <mime-mapping>
+    <extension>ttf</extension>
+    <mime-type>font/ttf</mime-type>
+  </mime-mapping>
 
 </web-app>

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html Fri Feb 
8 21:18:48 2013
@@ -220,16 +220,16 @@
                   {{/if}}
                   <tr><td><strong>Queue Size: </strong>{{App.destination.metrics.queue_items}}
messages</td></tr>
                   <tr><td><strong>Enqueued: </strong>{{App.destination.metrics.enqueue_item_counter}}
items / {{memory App.destination.metrics.enqueue_size_counter}}
-                    <a class="tooltip-link" href="#" {{bindAttr title="App.destination.metrics.enqueue_date"}}><i
class="icon-time"></i></a>
+                    {{#view App.Tooltip titleBinding="App.destination.metrics.enqueue_date"}}<i
class="icon-time"></i>{{/view}}
                   </td></tr>
                   <tr><td><strong>Dequeued: </strong>{{App.destination.metrics.dequeue_item_counter}}
/ {{memory App.destination.metrics.dequeue_size_counter}}
-                    <a class="tooltip-link" href="#" {{bindAttr title="App.destination.metrics.dequeue_date"}}><i
class="icon-time"></i></a>
+                    {{#view App.Tooltip titleBinding="App.destination.metrics.dequeue_date"}}<i
class="icon-time"></i>{{/view}}
                     </td></tr>
                   <tr><td><strong>Nacked: </strong>{{App.destination.metrics.nack_item_counter}}
/ {{memory App.destination.metrics.nack_size_counter}}
-                    <a class="tooltip-link" href="#" {{bindAttr title="App.destination.metrics.nack_date"}}><i
class="icon-time"></i></a>
+                    {{#view App.Tooltip titleBinding="App.destination.metrics.nack_date"}}<i
class="icon-time"></i>{{/view}}
                     </td></tr>
                   <tr><td><strong>Expired: </strong>{{App.destination.metrics.expired_item_counter}}
/ {{memory App.destination.metrics.expired_size_counter}}
-                    <a class="tooltip-link" href="#" {{bindAttr title="App.destination.metrics.expired_date"}}><i
class="icon-time"></i></a>
+                    {{#view App.Tooltip titleBinding="App.destination.metrics.expired_date"}}<i
class="icon-time"></i>{{/view}}
                     </td></tr>
                   <tr><td><strong>Enqueue Rate Throttle: </strong>{{App.destination.metrics.max_enqueue_rate}}</td></tr>
                   <tr><td><strong>Swapped In: </strong>{{App.destination.metrics.swapped_in_items}}
msgs {{memory App.destination.metrics.swapped_in_size}}</td></tr>
@@ -244,7 +244,7 @@
 
             <div class="span7">
               <ul class="nav nav-tabs">
-                <li class="active"><a href="#TAB_Messages" data-toggle="tab">Messages
({{App.destination.metrics.queue_items}})</a></li>
+                <li class="active"><a href="#TAB_Messages" data-toggle="tab">Messages
({{App.DestinationController.browse_count}})</a></li>
                 <li><a href="#TAB_Producers" data-toggle="tab">Producers ({{App.destination.producers.length}})</a></li>
                 <li><a href="#TAB_Consumers" data-toggle="tab">Consumers ({{App.destination.consumers.length}})</a></li>
               </ul>
@@ -304,12 +304,12 @@
                           {{/if}}
                           </a>
                         </td>
-                        <td>{{entry.seq}}:{{count}}</td>
+                        <td>{{entry.seq}}</td>
                         <td>{{codec}}</td>
                         <td>{{persistent}}</td>
                         <td>{{expiration}}</td>
                         <td>{{entry.is_prefetched}}</td>
-                        <td>{{entry.acquirer}}</td>
+                        <td>{{entry.acquirer.kind}} {{entry.acquirer.label}}</td>
                         <td>{{memory entry.size}}</td>
                       </tr>
                       {{#if show_details}}
@@ -354,22 +354,21 @@
                       <tbody>
                       <tr>
                         <th>Name</th>
-                        <th>Kind</th>
                         <div style="padding:.5em 0">
                           <!--<button class="btn btn-small" {{action "remove" target="App.MessagesController"
on="click"}}>Delete</button>-->
                           &nbsp;
                         </div>
                         <th>Transfers</th>
                         <th>Size</th>
-                        <th>Last Transfer</th>
                       </tr>
                       {{#each App.destination.producers}}
                       <tr>
-                        <td>{{label}}</td>
-                        <td>{{kind}}</td>
-                        <td>{{enqueue_item_counter}}</td>
+                        <td>{{kind}}: {{label}}</td>
+                        <td>
+                          {{enqueue_item_counter}}
+                          {{#view App.Tooltip titleBinding="enqueue_date"}}<i class="icon-time"></i>{{/view}}
+                        </td>
                         <td>{{memory enqueue_size_counter}}</td>
-                        <td>{{enqueue_date}}</td>
                       </tr>
                       {{/each}}
                       </tbody>
@@ -383,11 +382,9 @@
                     <table class="details table table-bordered table-striped" style="">
                       <tbody>
                       <tr>
-                        <th>Kind</th>
                         <th>Name</th>
                         <th>Transfers</th>
                         <th>Size</th>
-                        <th>Last Transfer</th>
                         <th>Acks</th>
                         <th>Nacks</th>
                         <th>Ack Rate</th>
@@ -395,11 +392,11 @@
                       </tr>
                       {{#each App.destination.consumers}}
                       <tr>
-                        <td>{{kind}}</td>
-                        <td>{{label}}</td>
-                        <td>{{enqueue_item_counter}}</td>
+                        <td>{{kind}}: {{label}}</td>
+                        <td>{{enqueue_item_counter}}
+                            {{#view App.Tooltip titleBinding="enqueue_date"}}<i class="icon-time"></i>{{/view}}
+                        </td>
                         <td>{{memory enqueue_size_counter}}</td>
-                        <td>{{enqueue_date}}</td>
                         <td>{{total_ack_count}}</td>
                         <td>{{total_nack_count}}</td>
                         <td>{{ack_item_rate}} msgs/sec {{memory ack_size_rate}}/sec</td>

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js?rev=1444246&r1=1444245&r2=1444246&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js Fri Feb  8
21:18:48 2013
@@ -1,94 +1,10 @@
-
-// Install a base64 decoding function if one is not available.
-if( !window.atob ) {
-  window.atob = function(text){
-    text = text.replace(/\s/g,"");
-    if(!(/^[a-z0-9\+\/\s]+\={0,2}$/i.test(text)) || text.length % 4 > 0){
-      throw new Error("Not a base64-encoded string.");
-    }
-    var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
-      cur, prev, digitNum,
-      i=0,
-      result = [];
-    text = text.replace(/=/g, "");
-    while(i < text.length){
-      cur = digits.indexOf(text.charAt(i));
-      digitNum = i % 4;
-      switch(digitNum){
-        case 1:
-          result.push(String.fromCharCode(prev << 2 | cur >> 4));
-          break;
-        case 2:
-          result.push(String.fromCharCode((prev & 0x0f) << 4 | cur >> 2));
-          break;
-        case 3:
-          result.push(String.fromCharCode((prev & 3) << 6 | cur));
-          break;
-      }
-      prev = cur;
-      i++;
-    }
-    return result.join("");
-  }
-}
-
-Ember.Handlebars.registerHelper("key_value", function(name, fn) {
-  var obj = this[name];
-  var buffer = "", key;
-  for (key in obj) {
-    if (obj.hasOwnProperty(key)) {
-      buffer += fn({key: key, value: obj[key]});
-    }
-  }
-  return buffer;
-});
-
-Ember.Handlebars.registerHelper('memory', function(property, options) {
-  options.fn = function(size) {
-    if( (typeof size)=="number" ) {
-      var units = "bytes"
-      if( size > 1024 ) {
-        size = size / 1024;
-        units = "kb"
-        if( size > 1024 ) {
-          size = size / 1024;
-          units = "mb"
-          if( size > 1024 ) {
-            size = size / 1024;
-            units = "gb"
-            if( size > 1024 ) {
-              size = size / 1024;
-              units = "tb"
-            }
-          }
-        }
-        size = size.toFixed(2);
-      } else {
-        if( (""+size).indexOf(".") !== -1 ) {
-          size = size.toFixed(2);
-        }
-      }
-      return size+" "+units;
-    }
-    return size;
-  }
-  return Ember.Handlebars.helpers.bind(property, options);
-});
-
-$(window).resize(function() {
- App.set("window_size", {
-  height:$(window).height(),
-  width:$(window).width(),
- })
-});
-
 App = Em.Application.create({
   window_size:{
     height:$(window).height(),
     width:$(window).width(),
   },
 
-  refresh_interval:2,
+  refresh_interval:30,
 
   ready: function() {
     this.schedule_refresh();
@@ -113,9 +29,6 @@ App = Em.Application.create({
     App.VirtualHostController.auto_refresh();
     App.ConnectorController.auto_refresh();
     App.ConfigurationController.auto_refresh();
-    Ember.run(function(){
-      $(".tooltip-link").tooltip();
-    });
   },
 
   refresh: function() {
@@ -588,6 +501,7 @@ App.DestinationController = Em.Controlle
 
   tabs:["Messages","Producers","Consumers"],
   selected_tab:"Messages",
+  browse_count:0,
 
   destinationBinding:"App.destination",
   selectedBinding:"App.DestinationsController.selected",
@@ -603,6 +517,12 @@ App.DestinationController = Em.Controlle
       var virtual_host = App.DestinationsController.get("virtual_host");
       var kind = App.DestinationsController.get("kind");
       App.ajax("GET", "/broker/virtual-hosts/"+virtual_host+"/"+kind+"/"+selected+"?consumers=true&producers=true",
function(data) {
+
+        if( kind == "topics ") {
+          App.set('browse_count', data.retained);
+        } else {
+          App.set('browse_count', data.metrics.queue_items);
+        }
         data.state_date = date_to_string(data.state_since);
         data.metrics.enqueue_date = date_to_string(data.metrics.enqueue_ts);
         data.metrics.dequeue_date = date_to_string(data.metrics.dequeue_ts);
@@ -730,9 +650,10 @@ App.MessagesController = Ember. ArrayCon
   auto_refresh:function() {
     var virtual_host = App.DestinationsController.get("virtual_host");
     var kind = App.DestinationsController.get("kind");
+    var content = this.get("content");
     var selected = App.DestinationController.get("selected")
     var destination_path = "/broker/virtual-hosts/"+virtual_host+"/"+kind+"/"+selected;
-    if( destination_path != this.get("destination_path") ) {
+    if( destination_path != this.get("destination_path") || content.get("length")==0 ) {
       this.refresh();
     }
   },
@@ -745,7 +666,8 @@ App.MessagesController = Ember. ArrayCon
     var from = this.get("from");
     var max = this.get("max");
     var destination_path = "/broker/virtual-hosts/"+virtual_host+"/"+kind+"/"+selected;
-    App.ajax("GET", destination_path+"/messages?from="+from+"&max="+max+"&max_body="+max_body,
function(data) {
+    App.ajax("GET", destination_path+"/messages?from="+from+"&max="+max+"&max_body="+max_body,
function(page) {
+      var data = page.messages;
       data.forEach(function(item, index){
         if( item.base64_body ) {
           var rc = atob(item.base64_body);
@@ -938,6 +860,25 @@ App.NumberField = Ember.TextField.extend
     }.observes('value')
 });
 
+App.Tooltip = Ember.View.extend({
+  tagName:'a',
+  attributeBindings: ['href', 'title'],
+  href:'#',
+  title:'Example',
+  didInsertElement: function() {
+    this.$().tooltip();
+  },
+  click: function(event){
+    this.$().tooltip('toggle')
+  },
+  mouseEnter: function(event){
+    this.$().tooltip('show')
+  },
+  mouseLeave: function(event){
+    this.$().tooltip('hide')
+  },
+});
+
 App.AceView = Ember.View.extend({
 
   editor: null,
@@ -1080,4 +1021,89 @@ App.Router = Ember.Router.extend({
     }),
   })
 })
+
+
+// Install a base64 decoding function if one is not available.
+if( !window.atob ) {
+  window.atob = function(text){
+    text = text.replace(/\s/g,"");
+    if(!(/^[a-z0-9\+\/\s]+\={0,2}$/i.test(text)) || text.length % 4 > 0){
+      throw new Error("Not a base64-encoded string.");
+    }
+    var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
+      cur, prev, digitNum,
+      i=0,
+      result = [];
+    text = text.replace(/=/g, "");
+    while(i < text.length){
+      cur = digits.indexOf(text.charAt(i));
+      digitNum = i % 4;
+      switch(digitNum){
+        case 1:
+          result.push(String.fromCharCode(prev << 2 | cur >> 4));
+          break;
+        case 2:
+          result.push(String.fromCharCode((prev & 0x0f) << 4 | cur >> 2));
+          break;
+        case 3:
+          result.push(String.fromCharCode((prev & 3) << 6 | cur));
+          break;
+      }
+      prev = cur;
+      i++;
+    }
+    return result.join("");
+  }
+}
+
+Ember.Handlebars.registerHelper("key_value", function(name, fn) {
+  var obj = this[name];
+  var buffer = "", key;
+  for (key in obj) {
+    if (obj.hasOwnProperty(key)) {
+      buffer += fn({key: key, value: obj[key]});
+    }
+  }
+  return buffer;
+});
+
+Ember.Handlebars.registerHelper('memory', function(property, options) {
+  options.fn = function(size) {
+    if( (typeof size)=="number" ) {
+      var units = "bytes"
+      if( size > 1024 ) {
+        size = size / 1024;
+        units = "kb"
+        if( size > 1024 ) {
+          size = size / 1024;
+          units = "mb"
+          if( size > 1024 ) {
+            size = size / 1024;
+            units = "gb"
+            if( size > 1024 ) {
+              size = size / 1024;
+              units = "tb"
+            }
+          }
+        }
+        size = size.toFixed(2);
+      } else {
+        if( (""+size).indexOf(".") !== -1 ) {
+          size = size.toFixed(2);
+        }
+      }
+      return size+" "+units;
+    }
+    return size;
+  }
+  return Ember.Handlebars.helpers.bind(property, options);
+});
+
+$(window).resize(function() {
+ App.set("window_size", {
+  height:$(window).height(),
+  width:$(window).width(),
+ })
+});
+
 App.initialize();



Mime
View raw message