Repository: eagle Updated Branches: refs/heads/master 67c170f93 -> 83d9c8277
[EAGLE-896] Add site filter for policy definition and remove inputstreams column Add site filter for policy definition and remove inputstreams column https://issues.apache.org/jira/browse/EAGLE-896 Author: zombieJ <[email protected]> Closes #802 from zombieJ/EAGLE-896. Project: http://git-wip-us.apache.org/repos/asf/eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/83d9c827 Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/83d9c827 Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/83d9c827 Branch: refs/heads/master Commit: 83d9c8277b32003fceacf755df37ada1963c536c Parents: 67c170f Author: zombieJ <[email protected]> Authored: Wed Feb 15 17:27:38 2017 +0800 Committer: Hao Chen <[email protected]> Committed: Wed Feb 15 17:27:38 2017 +0800 ---------------------------------------------------------------------- .../app/dev/partials/alert/policyList.html | 22 +++++++++++--------- .../src/main/webapp/app/dev/public/css/main.css | 20 ++++++++++++++++++ .../webapp/app/dev/public/js/ctrls/alertCtrl.js | 21 ++++++++++++++++++- 3 files changed, 52 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/eagle/blob/83d9c827/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 6502b19..6351674 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 @@ -24,13 +24,22 @@ </h3> </div> <div class="box-body"> + <!-- Site Filter --> + <ul class="nav nav-pills with-border"> + <li><span>Site Filter:</span></li> + <li ng-class="{active: siteFilter === ''}" ng-click="updateSiteFilter('')"><a>All</a></li> + <li ng-class="{active: siteFilter === site.siteId}" ng-click="updateSiteFilter(site.siteId)" + ng-repeat="site in Site.list track by $index"> + <a>{{site.siteName || site.siteId}}</a> + </li> + </ul> + <div sort-table="policyList" ng-show="policyList.length"> <table class="table table-bordered"> <thead> <tr> <th sortpath="policyStatus" width="10"></th> <th sortpath="name" width="10%">Name</th> - <th width="150">Input Streams</th> <th>Description</th> <th width="85">Action</th> </tr> @@ -43,13 +52,6 @@ <td> <a ui-sref="policyDetail({name: item.name})">{{item.name}}</a> </td> - <td> - <ul class="no-margin list-unstyled"> - <li ng-repeat="stream in item.inputStreams track by $index"> - {{stream}} - </li> - </ul> - </td> <td>{{item.description}}</td> <td class="text-center"> <div class="btn-group btn-group-xs"> @@ -68,13 +70,13 @@ </table> </div> - <div class="callout callout-warning no-margin" ng-show="policyList._done && policyList.length === 0"> + <div class="callout callout-warning no-margin" ng-show="!loading && policyList.length === 0"> <h4>No Policy yet</h4> <p>You have not create policy yet. Click <a ui-sref="policyCreate()">here</a> to create a new policy.</p> </div> </div> - <div class="overlay" ng-if="!policyList._done"> + <div class="overlay" ng-if="loading"> <i class="fa fa-refresh fa-spin"></i> </div> http://git-wip-us.apache.org/repos/asf/eagle/blob/83d9c827/eagle-server/src/main/webapp/app/dev/public/css/main.css ---------------------------------------------------------------------- diff --git a/eagle-server/src/main/webapp/app/dev/public/css/main.css b/eagle-server/src/main/webapp/app/dev/public/css/main.css index 8583513..594e248 100644 --- a/eagle-server/src/main/webapp/app/dev/public/css/main.css +++ b/eagle-server/src/main/webapp/app/dev/public/css/main.css @@ -286,6 +286,26 @@ ul.stepGuide li > .title { width: initial; } +.box-body .nav-pills { + margin-bottom: 10px; +} +.box-body .nav-pills.with-border { + padding-bottom: 10px; + border-bottom: 1px solid #f4f4f4; +} + +.box-body .nav-pills > li { + border-radius: 3px; + overflow: hidden; +} + +.box-body .nav-pills > li > span, +.box-body .nav-pills > li > a { + display: inline-block; + border: 0; + padding: 5px 10px; +} + /* ======================================================================== * = Tab = * ======================================================================== */ http://git-wip-us.apache.org/repos/asf/eagle/blob/83d9c827/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 4ddff52..4b5cdf7 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 @@ -116,13 +116,32 @@ // ====================================================================================== eagleControllers.controller('policyListCtrl', function ($scope, $wrapState, PageConfig, Entity, Policy) { PageConfig.title = "Policies"; + $scope.loading = false; + var originPolicyList = []; $scope.policyList = []; + $scope.siteFilter = ''; + + $scope.updateSiteFilter = function (siteId) { + if (siteId !== undefined) $scope.siteFilter = siteId; + + if ($scope.siteFilter) { + $scope.policyList = $.grep(originPolicyList, function (policy) { + return policy.definition.siteId === $scope.siteFilter; + }); + } else { + $scope.policyList = originPolicyList; + } + }; function updateList() { var list = Entity.queryMetadata("policies"); + $scope.loading = true; + list._then(function () { - $scope.policyList = list; + $scope.loading = false; + originPolicyList = list; + $scope.updateSiteFilter(); }); } updateList();
