Repository: eagle
Updated Branches:
  refs/heads/master c32b71525 -> c6866e5fb


[EAGLE-916] alert support time stamp

UI alert detail pass timerange

Author: zombieJ <[email protected]>

Closes #824 from zombieJ/EAGLE-916.


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

Branch: refs/heads/master
Commit: c6866e5fb57cd5c4481158d5b492f30abbc5c90c
Parents: c32b715
Author: zombieJ <[email protected]>
Authored: Wed Feb 22 15:51:43 2017 +0800
Committer: Hao Chen <[email protected]>
Committed: Wed Feb 22 15:51:43 2017 +0800

----------------------------------------------------------------------
 .../src/main/webapp/app/dev/partials/alert/detail.html |  2 +-
 .../src/main/webapp/app/dev/partials/alert/list.html   |  6 +++---
 .../webapp/app/dev/partials/alert/policyDetail.html    |  4 ++--
 .../main/webapp/app/dev/partials/alert/policyList.html |  4 ++--
 eagle-server/src/main/webapp/app/dev/public/js/app.js  |  2 +-
 .../main/webapp/app/dev/public/js/ctrls/alertCtrl.js   | 13 +++++++++++--
 6 files changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/c6866e5f/eagle-server/src/main/webapp/app/dev/partials/alert/detail.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/detail.html 
b/eagle-server/src/main/webapp/app/dev/partials/alert/detail.html
index 2a0f54e..79a0b18 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/detail.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/detail.html
@@ -47,7 +47,7 @@
                                </tr>
                                <tr>
                                        <th>Alert Policy</th>
-                                       <td colspan="3"><a 
ui-sref="policyDetail({name: 
alert.tags.policyId})">{{alert.tags.policyId}}</a></td>
+                                       <td colspan="3"><a 
ui-sref="policyDetail({siteId: site, name: 
alert.tags.policyId})">{{alert.tags.policyId}}</a></td>
                                </tr>
                                <tr>
                                        <th>Alert Event</th>

http://git-wip-us.apache.org/repos/asf/eagle/blob/c6866e5f/eagle-server/src/main/webapp/app/dev/partials/alert/list.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/list.html 
b/eagle-server/src/main/webapp/app/dev/partials/alert/list.html
index d06b41f..9be9a56 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/list.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/list.html
@@ -58,7 +58,7 @@
                                                        <!--</ul>-->
                                                <!--</td>-->
                                                <td>{{item.tags.category || 
"N/A"}}</td>
-                                               <td><a 
ui-sref="alertDetail({alertId: item.tags.alertId})" 
title="{{item.alertBody}}">{{item.alertSubject}}</a></td>
+                                               <td><a 
ui-sref="alertDetail({siteId: site, alertId: item.tags.alertId, timestamp: 
item.timestamp})" title="{{item.alertBody}}">{{item.alertSubject}}</a></td>
                                                <!--td>{{item.streamId}}</td-->
                                                <!--td class="text-break">
                                                        <span 
ng-if="displayType === 'raw'" na-block="item.alertData"></span>
@@ -72,10 +72,10 @@
                                                        </div>
                                                </td-->
                                                <td>
-                                                       <a 
ui-sref="policyDetail({name: item.tags.policyId})">{{item.tags.policyId}}</a>
+                                                       <a 
ui-sref="policyDetail({siteId: site, name: 
item.tags.policyId})">{{item.tags.policyId}}</a>
                                                </td>
                                                <td>
-                                                       <a 
ui-sref="alertDetail({alertId: item.tags.alertId})">detail</a>
+                                                       <a 
ui-sref="alertDetail({siteId: site, alertId: item.tags.alertId, timestamp: 
item.timestamp})">detail</a>
                                                </td>
                                        </tr>
                                </tbody>

http://git-wip-us.apache.org/repos/asf/eagle/blob/c6866e5f/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
----------------------------------------------------------------------
diff --git 
a/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html 
b/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
index 559785c..031f71d 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
@@ -26,7 +26,7 @@
                        <div class="btn-group">
                                <button class="btn btn-default fa fa-play" 
ng-click="startPolicy()" ng-if="policy.policyStatus !== 'ENABLED'"></button>
                                <button class="btn btn-default fa fa-square" 
ng-click="stopPolicy()" ng-if="policy.policyStatus === 'ENABLED'"></button>
-                               <a class="btn btn-default fa fa-pencil" 
ui-sref="policyEdit({name: policy.name})"></a>
+                               <a class="btn btn-default fa fa-pencil" 
ui-sref="policyEdit({siteId: site, name: policy.name})"></a>
                                <button class="btn btn-danger fa fa-trash" 
ng-click="deletePolicy()"></button>
                        </div>
                </div>
@@ -81,7 +81,7 @@
                                                        {{item.alertSubject}}
                                                </td>
                                                <td>
-                                                       <a 
ui-sref="alertDetail({alertId: item.tags.alertId})">Detail</a>
+                                                       <a 
ui-sref="alertDetail({siteId: site, alertId: item.tags.alertId, timestamp: 
item.timestamp})">Detail</a>
                                                </td>
                                        </tr>
                                        </tbody>

http://git-wip-us.apache.org/repos/asf/eagle/blob/c6866e5f/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
----------------------------------------------------------------------
diff --git 
a/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html 
b/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
index b41c320..cb0936f 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
@@ -40,7 +40,7 @@
                                                        <span class="fa 
fa-square" ng-class="item.policyStatus === 'ENABLED' ? 'text-green' : 
'text-muted'"></span>
                                                </td>
                                                <td>
-                                                       <a 
ui-sref="policyDetail({name: item.name})">{{item.name}}</a>
+                                                       <a 
ui-sref="policyDetail({siteId: site, name: item.name})">{{item.name}}</a>
                                                </td>
                                                <td>{{item.description}}</td>
                                                <td class="text-center">
@@ -51,7 +51,7 @@
                                                                <button 
class="btn btn-default opt" ng-if="item.policyStatus === 'ENABLED'" 
ng-click="stopPolicy(item)">
                                                                        <span 
class="fa fa-stop"></span>
                                                                </button>
-                                                               <a 
ui-sref="policyEdit({name: item.name})" class="btn btn-default opt"><span 
class="fa fa-pencil"></span></a>
+                                                               <a 
ui-sref="policyEdit({siteId: site, name: item.name})" class="btn btn-default 
opt"><span class="fa fa-pencil"></span></a>
                                                                <button 
class="btn btn-danger opt" ng-click="deletePolicy(item)"><span class="fa 
fa-trash"></span></button>
                                                        </div>
                                                </td>

http://git-wip-us.apache.org/repos/asf/eagle/blob/c6866e5f/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 c593406..a05ac92 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
@@ -201,7 +201,7 @@ var app = {};
                                })
 
                                .state('alertDetail', {
-                                       url: 
"/site/:siteId/alert/detail/{alertId}",
+                                       url: 
"/site/:siteId/alert/detail/{alertId}?timestamp",
                                        templateUrl: 
"partials/alert/detail.html?_=" + window._TRS(),
                                        controller: "alertDetailCtrl",
                                        resolve: routeResolve()

http://git-wip-us.apache.org/repos/asf/eagle/blob/c6866e5f/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js 
b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
index 5360571..dcbb188 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
@@ -49,12 +49,20 @@
                Time.onReload(loadAlerts, $scope);
        });
 
-       eagleControllers.controller('alertDetailCtrl', function ($sce, $scope, 
$wrapState, PageConfig, CompatibleEntity) {
+       eagleControllers.controller('alertDetailCtrl', function ($sce, $scope, 
$wrapState, PageConfig, CompatibleEntity, Time) {
                PageConfig.title = "Alert Detail";
 
+               $scope.site = $wrapState.param.siteId;
+
+               var endTime = Time($wrapState.param.timestamp).add(1, 'd');
+               var startTime = Time($wrapState.param.timestamp).subtract(7, 
'd');
                $scope.alertList = CompatibleEntity.query("LIST", {
                        query: "AlertService",
-                       condition: { alertId: $wrapState.param.alertId }
+                       condition: {
+                               alertId: $wrapState.param.alertId,
+                       },
+                       startTime: startTime,
+                       endTime: endTime,
                });
                $scope.alertList._then(function () {
                        $scope.alert = $scope.alertList[0];
@@ -149,6 +157,7 @@
                        {title: "Detail"}
                ];
 
+               $scope.site = $wrapState.param.siteId;
                $scope.tab = "setting";
 
                $scope.setTab = function (tab) {

Reply via email to