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">
|
<div class="sidebar-nav navbar-collapse">
|
||||||
<ul class="nav in" id="side-menu">
|
<ul class="nav in" id="side-menu">
|
||||||
<li class="sidebar-search">
|
<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="">
|
<div class="input-group" style="">
|
||||||
<input type="text" class="form-control highlight-border" placeholder="应用名" ng-model="searchApp">
|
<input type="text" class="form-control highlight-border" placeholder="应用名" ng-model="searchApp">
|
||||||
<span class="input-group-btn">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -28,7 +19,7 @@
|
||||||
首页</a>
|
首页</a>
|
||||||
</li>
|
</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;">
|
<a href="" ng-click="click($event)" collapse="{{collpaseall == 1}}" style="font-size: 16px;">
|
||||||
<!--<i class="glyphicon glyphicon-chevron-right"></i>-->
|
<!--<i class="glyphicon glyphicon-chevron-right"></i>-->
|
||||||
<!--<span class="fa arrow"></span>-->
|
<!--<span class="fa arrow"></span>-->
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ angular.module('sentinelDashboardApp')
|
||||||
// app
|
// app
|
||||||
AppService.getApps().success(
|
AppService.getApps().success(
|
||||||
function (data) {
|
function (data) {
|
||||||
if (data.code == 0) {
|
if (data.code === 0) {
|
||||||
var initHashApp = $location.path().split('/')[3];
|
let initHashApp = $location.path().split('/')[3];
|
||||||
$scope.apps = data.data;
|
$scope.apps = data.data;
|
||||||
$scope.apps.forEach(function (item) {
|
$scope.apps.forEach(function (item) {
|
||||||
if (item.app == initHashApp) {
|
if (item.app === initHashApp) {
|
||||||
item.active = true;
|
item.active = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -33,22 +33,25 @@ angular.module('sentinelDashboardApp')
|
||||||
|
|
||||||
// toggle side bar
|
// toggle side bar
|
||||||
$scope.click = function ($event) {
|
$scope.click = function ($event) {
|
||||||
var element = angular.element($event.target);
|
let element = angular.element($event.target);
|
||||||
var entry = angular.element($event.target).scope().entry;
|
let entry = angular.element($event.target).scope().entry;
|
||||||
entry.active = !entry.active;
|
entry.active = !entry.active;
|
||||||
|
|
||||||
if (entry.active == false) {
|
if (entry.active === false) {
|
||||||
element.parent().children('ul').hide();
|
element.parent().children('ul').hide();
|
||||||
} else {
|
} else {
|
||||||
element.parent().parent().children('li').children('ul').hide();
|
element.parent().parent().children('li').children('ul').hide();
|
||||||
element.parent().children('ul').show();
|
element.parent().children('ul').show();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
$scope.addSearchApp = function () {
|
$scope.addSearchApp = function () {
|
||||||
var findApp = false;
|
let findApp = false;
|
||||||
for (var i = 0; i < $scope.apps.length; i++) {
|
for (let i = 0; i < $scope.apps.length; i++) {
|
||||||
if ($scope.apps[i].app == $scope.searchApp) {
|
if ($scope.apps[i].app === $scope.searchApp) {
|
||||||
findApp = true;
|
findApp = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +59,7 @@ angular.module('sentinelDashboardApp')
|
||||||
if (!findApp) {
|
if (!findApp) {
|
||||||
$scope.apps.push({ app: $scope.searchApp });
|
$scope.apps.push({ app: $scope.searchApp });
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue