Repository: eagle
Updated Branches:
  refs/heads/master dd61a490e -> 62d5530f7


[EAGLE-1047] View all alert publishers on Eagle UI

https://issues.apache.org/jira/browse/EAGLE-1047

Users can view all the publisher configurations

Author: zombieJ <[email protected]>

Closes #954 from zombieJ/EAGLE-1047.


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

Branch: refs/heads/master
Commit: 62d5530f7d598c91108748784255ec6a28fc93b2
Parents: dd61a49
Author: zombieJ <[email protected]>
Authored: Tue Jun 20 16:42:39 2017 +0800
Committer: Zhao, Qingwen <[email protected]>
Committed: Tue Jun 20 16:42:39 2017 +0800

----------------------------------------------------------------------
 .../app/dev/partials/integration/main.html      |  1 +
 .../dev/partials/integration/publisherList.html | 40 +++++++++++++++++
 .../src/main/webapp/app/dev/public/js/app.js    |  6 +++
 .../app/dev/public/js/ctrls/integrationCtrl.js  | 46 ++++++++++++++++++++
 .../app/dev/public/js/services/pageSrv.js       |  2 +-
 5 files changed, 94 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/62d5530f/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
----------------------------------------------------------------------
diff --git 
a/eagle-server/src/main/webapp/app/dev/partials/integration/main.html 
b/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
index 3a063d7..7880501 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
@@ -20,6 +20,7 @@
        <ul class="nav nav-tabs">
                <li ng-class="{active: getState().indexOf('integration.site') 
!== -1}"><a href="#/integration/siteList">Sites</a></li>
                <li ng-class="{active: getState() === 
'integration.applicationList'}"><a 
href="#/integration/applicationList">Applications</a></li>
+               <li ng-class="{active: getState() === 
'integration.publisherList'}"><a 
href="#/integration/publisherList">Publishers</a></li>
        </ul>
        <div class="tab-content no-padding">
                <div ui-view></div>

http://git-wip-us.apache.org/repos/asf/eagle/blob/62d5530f/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html
----------------------------------------------------------------------
diff --git 
a/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html 
b/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html
new file mode 100644
index 0000000..ff7c0e0
--- /dev/null
+++ 
b/eagle-server/src/main/webapp/app/dev/partials/integration/publisherList.html
@@ -0,0 +1,40 @@
+<!--
+  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.
+  -->
+
+<div class="box-body">
+       <div sort-table="publisherList">
+               <table class="table table-bordered table-hover">
+                       <thead>
+                               <tr>
+                                       <th>Name</th>
+                                       <th>Policies</th>
+                                       <th>Properties</th>
+                                       <th></th>
+                               </tr>
+                       </thead>
+                       <tbody>
+                               <tr ng-click="showPublisher(item)">
+                                       <td 
class="text-no-break"><a>{{item.name}}</a></td>
+                                       <td>{{item.policyIds.length}}</td>
+                                       <td><pre>{{item.properties | json: 
4}}</pre></td>
+                                       <td></td>
+                               </tr>
+                       </tbody>
+               </table>
+       </div>
+</div>

http://git-wip-us.apache.org/repos/asf/eagle/blob/62d5530f/eagle-server/src/main/webapp/app/dev/public/js/app.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/app.js 
b/eagle-server/src/main/webapp/app/dev/public/js/app.js
index baa4d3e..9948ef5 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/app.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/app.js
@@ -157,6 +157,12 @@ var app = {};
                                        controller: 
"integrationApplicationListCtrl",
                                        resolve: routeResolve({ application: 
false })
                                })
+                               .state('integration.publisherList', {
+                                       url: "publisherList",
+                                       templateUrl: 
"partials/integration/publisherList.html?_=" + window._TRS(),
+                                       controller: 
"integrationPublisherListCtrl",
+                                       resolve: routeResolve({ application: 
false })
+                               })
 
                                // ================================= Metric 
=================================
                                .state('metricPreview', {

http://git-wip-us.apache.org/repos/asf/eagle/blob/62d5530f/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git 
a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js 
b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index 95e4584..6cc17e5 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -443,4 +443,50 @@
                        $("#appMDL").modal();
                };
        });
+
+       // 
======================================================================================
+       // =                                      Publisher                     
                =
+       // 
======================================================================================
+       eagleControllers.controller('integrationPublisherListCtrl', function 
($sce, $scope, $wrapState, PageConfig, Entity) {
+               PageConfig.title = "Integration";
+               PageConfig.subTitle = "Publishers";
+
+               $scope.publisherList = Entity.queryMetadata("publishments");
+               $scope.gotoPolicy = function (policyName) {
+                       var encodePolicyName = encodeURIComponent(policyName);
+                       var policyList = Entity.queryMetadata("policies/" + 
encodePolicyName);
+                       policyList._then(function () {
+                               var policy = policyList[0];
+                               if (!policy) {
+                                       $.dialog({
+                                               title: 'OPS',
+                                               content: 'Policy not found!',
+                                       });
+                                       return;
+                               }
+
+                               $wrapState.go("policyDetail", {siteId: 
policy.siteId, name: policy.name});
+                       });
+               };
+
+               $scope.showPublisher = function (publisher) {
+                       var $ul = $('<ul>');
+                       $.each(publisher.policyIds, function (i, policyName) {
+                               var $a = $("<a>").text(policyName);
+                               $a.click(function () {
+                                       $scope.gotoPolicy(policyName);
+                                       $dlg.modal('hide');
+                               });
+
+                               $ul.append(
+                                       $("<li>").append($a)
+                               );
+                       });
+
+                       var $dlg = $.dialog({
+                               title: "Policy List",
+                               content: $ul,
+                       });
+               };
+       });
 }());

http://git-wip-us.apache.org/repos/asf/eagle/blob/62d5530f/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js 
b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
index 99cf534..5ce488d 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
@@ -109,7 +109,7 @@
                                );
                        }
 
-                       return[
+                       return [
                                {name: site.siteName || site.siteId + " Home", 
icon: "home", path: "#/site/" + site.siteId},
                                {name: "Alert", icon: "bell", list: 
alertPortal},
                        ];

Reply via email to