Commit 08454bde by Jason Song Committed by GitHub

Merge pull request #394 from lepdou/search_item

filter item
parents 6153339b cf54598d
...@@ -38,6 +38,10 @@ directive_module.directive('apollonspanel', ...@@ -38,6 +38,10 @@ directive_module.directive('apollonspanel',
scope.switchView = switchView; scope.switchView = switchView;
scope.toggleItemSearchInput = toggleItemSearchInput;
scope.searchItems = searchItems;
scope.loadCommitHistory = loadCommitHistory; scope.loadCommitHistory = loadCommitHistory;
scope.toggleTextEditStatus = toggleTextEditStatus; scope.toggleTextEditStatus = toggleTextEditStatus;
...@@ -60,6 +64,8 @@ directive_module.directive('apollonspanel', ...@@ -60,6 +64,8 @@ directive_module.directive('apollonspanel',
function initNamespace(namespace, viewType) { function initNamespace(namespace, viewType) {
namespace.showSearchInput = false;
namespace.sourceItems = namespace.items;
namespace.isPropertiesFormat = namespace.format == 'properties'; namespace.isPropertiesFormat = namespace.format == 'properties';
namespace.isTextEditing = false; namespace.isTextEditing = false;
namespace.instanceViewType = namespace_instance_view_type.LATEST_RELEASE; namespace.instanceViewType = namespace_instance_view_type.LATEST_RELEASE;
...@@ -384,6 +390,23 @@ directive_module.directive('apollonspanel', ...@@ -384,6 +390,23 @@ directive_module.directive('apollonspanel',
return result; return result;
} }
function toggleItemSearchInput(namespace) {
namespace.showSearchInput = !namespace.showSearchInput;
}
function searchItems(namespace) {
var searchKey = namespace.searchKey.toLowerCase();
var items = [];
namespace.sourceItems.forEach(function (item) {
var key = item.item.key;
if (key && key.toLowerCase().indexOf(searchKey) >= 0){
items.push(item);
}
});
namespace.items = items;
}
function lockCheck(namespace) { function lockCheck(namespace) {
if (namespace.lockOwner && scope.currentUser != namespace.lockOwner) { if (namespace.lockOwner && scope.currentUser != namespace.lockOwner) {
scope.lockOwner = namespace.lockOwner; scope.lockOwner = namespace.lockOwner;
......
...@@ -113,6 +113,13 @@ ...@@ -113,6 +113,13 @@
<img src="img/submit.png" class="ns_btn"> <img src="img/submit.png" class="ns_btn">
</a> </a>
<button type="button" class="btn btn-info btn-sm"
ng-show="namespace.viewType == 'table'"
ng-click="toggleItemSearchInput(namespace)">
<span class="glyphicon glyphicon-filter"></span>
过滤配置
</button>
<button type="button" class="btn btn-primary btn-sm" <button type="button" class="btn btn-primary btn-sm"
ng-show="namespace.viewType == 'table' && namespace.hasModifyPermission" ng-show="namespace.viewType == 'table' && namespace.hasModifyPermission"
ng-click="createItem(namespace)"> ng-click="createItem(namespace)">
...@@ -120,6 +127,7 @@ ...@@ -120,6 +127,7 @@
新增配置 新增配置
</button> </button>
</div> </div>
</div> </div>
</header> </header>
...@@ -138,9 +146,12 @@ ...@@ -138,9 +146,12 @@
</textarea> </textarea>
<!--table view--> <!--table view-->
<div class="namespace-view-table"> <div class="namespace-view-table" ng-show="namespace.viewType == 'table'">
<table class="table table-bordered table-striped text-center table-hover"
ng-show="namespace.viewType == 'table' && namespace.items.length > 0"> <div class="col-md-8 col-lg-offset-2" style="padding-top: 15px; padding-bottom: 10px" ng-show="namespace.showSearchInput">
<input type="text" class="form-control" placeholder="输入key过滤" ng-model="namespace.searchKey" ng-change="searchItems(namespace)">
</div>
<table class="table table-bordered table-striped text-center table-hover">
<thead> <thead>
<tr> <tr>
<th> <th>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment