Fixes #13: Fix search filter in Sentinel Dashboard sidebar
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
2f8a818d20
commit
f1b52a66b2
|
|
@ -2,19 +2,10 @@
|
|||
<div class="sidebar-nav navbar-collapse">
|
||||
<ul class="nav in" id="side-menu">
|
||||
<li class="sidebar-search">
|
||||
<!-- <div class="input-group custom-search-form">
|
||||
<input type="text" class="form-control" ng-model="searchApp"
|
||||
placeholder="搜索应用"> <span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button"
|
||||
>
|
||||
<i class="glyphicon glyphicon-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div> -->
|
||||
<div class="input-group" style="">
|
||||
<input type="text" class="form-control highlight-border" placeholder="应用名" ng-model="searchApp">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-secondary btn-default-inverse" type="button" ng-click="addSearchApp()">搜索</button>
|
||||
<button class="btn btn-secondary btn-default-inverse" type="button">搜索</button>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
|
|
@ -28,7 +19,7 @@
|
|||
首页</a>
|
||||
</li>
|
||||
|
||||
<li ng-class="{active: true}" ng-repeat="entry in apps | filter:searchApp">{{dropDown}}
|
||||
<li ng-class="{active: true}" ng-repeat="entry in apps | filter: { app: searchApp}">{{dropDown}}
|
||||
<a href="" ng-click="click($event)" collapse="{{collpaseall == 1}}" style="font-size: 16px;">
|
||||
<!--<i class="glyphicon glyphicon-chevron-right"></i>-->
|
||||
<!--<span class="fa arrow"></span>-->
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ angular.module('sentinelDashboardApp')
|
|||
// app
|
||||
AppService.getApps().success(
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
var initHashApp = $location.path().split('/')[3];
|
||||
if (data.code === 0) {
|
||||
let initHashApp = $location.path().split('/')[3];
|
||||
$scope.apps = data.data;
|
||||
$scope.apps.forEach(function (item) {
|
||||
if (item.app == initHashApp) {
|
||||
if (item.app === initHashApp) {
|
||||
item.active = true;
|
||||
}
|
||||
});
|
||||
|
|
@ -33,22 +33,25 @@ angular.module('sentinelDashboardApp')
|
|||
|
||||
// toggle side bar
|
||||
$scope.click = function ($event) {
|
||||
var element = angular.element($event.target);
|
||||
var entry = angular.element($event.target).scope().entry;
|
||||
let element = angular.element($event.target);
|
||||
let entry = angular.element($event.target).scope().entry;
|
||||
entry.active = !entry.active;
|
||||
|
||||
if (entry.active == false) {
|
||||
if (entry.active === false) {
|
||||
element.parent().children('ul').hide();
|
||||
} else {
|
||||
element.parent().parent().children('li').children('ul').hide();
|
||||
element.parent().children('ul').show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
$scope.addSearchApp = function () {
|
||||
var findApp = false;
|
||||
for (var i = 0; i < $scope.apps.length; i++) {
|
||||
if ($scope.apps[i].app == $scope.searchApp) {
|
||||
let findApp = false;
|
||||
for (let i = 0; i < $scope.apps.length; i++) {
|
||||
if ($scope.apps[i].app === $scope.searchApp) {
|
||||
findApp = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -56,7 +59,7 @@ angular.module('sentinelDashboardApp')
|
|||
if (!findApp) {
|
||||
$scope.apps.push({ app: $scope.searchApp });
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue