add a button to restore original search results after have applying some filtering

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295215 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-02-29 18:52:02 +00:00
parent 3ec57c570a
commit e257441e6e
2 changed files with 7 additions and 1 deletions

View File

@ -724,7 +724,9 @@ $(function() {
advancedSearch=function(){ advancedSearch=function(){
self.search("restServices/archivaServices/searchService/searchArtifacts"); self.search("restServices/archivaServices/searchService/searchArtifacts");
} }
removeFilter=function(){
self.resultViewModel.artifacts(self.resultViewModel.originalArtifacts);
}
this.search=function(url){ this.search=function(url){
var mainContent=$("#main-content"); var mainContent=$("#main-content");
@ -756,11 +758,13 @@ $(function() {
displayWarningMessage( $.i18n.prop("search.artifact.noresults")); displayWarningMessage( $.i18n.prop("search.artifact.noresults"));
return; return;
} else { } else {
self.resultViewModel.originalArtifacts=artifacts;
self.resultViewModel.artifacts(artifacts); self.resultViewModel.artifacts(artifacts);
if (!searchResultsGrid.attr("data-bind")){ if (!searchResultsGrid.attr("data-bind")){
searchResultsGrid.attr("data-bind", searchResultsGrid.attr("data-bind",
"simpleGrid: gridViewModel,simpleGridTemplate:'search-results-view-grid-tmpl',pageLinksId:'search-results-view-grid-pagination'"); "simpleGrid: gridViewModel,simpleGridTemplate:'search-results-view-grid-tmpl',pageLinksId:'search-results-view-grid-pagination'");
ko.applyBindings(self.resultViewModel,searchResultsGrid.get(0)); ko.applyBindings(self.resultViewModel,searchResultsGrid.get(0));
ko.applyBindings(self,mainContent.find("#remove-filter-id" ).get(0));
} }
activateSearchResultsTab(); activateSearchResultsTab();

View File

@ -267,6 +267,8 @@
<div id="search-results" class="tab-pane"> <div id="search-results" class="tab-pane">
<a href="#" class="btn btn-warning" data-bind="click: removeFilter" id="remove-filter-id">remove filter</a>
<table class="table table-striped table-bordered" id="search-results-grid"> <table class="table table-striped table-bordered" id="search-results-grid">
</table> </table>
<div id="search-results-view-grid-pagination"></div> <div id="search-results-view-grid-pagination"></div>