var searchResultsGrid=mainContent.find("#search-results #search-results-grid" );
mainContent.find("#btn-basic-search" ).button("loading");
+ mainContent.find("#btn-advanced-search" ).button("loading");
$("#user-messages").html(mediumSpinnerImg());
"simpleGrid: gridViewModel,simpleGridTemplate:'search-results-view-grid-tmpl',pageLinksId:'search-results-view-grid-pagination'");
ko.applyBindings(self.resultViewModel,searchResultsGrid.get(0));
}
+ // FIXME something generic here !
+
+ $( "#main-content #search-filter-auto-groupId" ).autocomplete({
+ minLength: 1,
+ source: function(request, response){
+ var groupIds=[];
+ $(self.resultViewModel.artifacts()).each(function(idx,artifact){
+ if(artifact.groupId.startsWith(request.term)){
+ groupIds.push(artifact.groupId);
+ }
+ });
+ response(unifyArray(groupIds,true));
+ }
+ });
+
+ $( "#main-content #search-filter-auto-artifactId" ).autocomplete({
+ minLength: 1,
+ source: function(request, response){
+ var artifactIds=[];
+ $(self.resultViewModel.artifacts()).each(function(idx,artifact){
+ if(artifact.artifactId.startsWith(request.term)){
+ artifactIds.push(artifact.artifactId);
+ }
+ });
+ response(unifyArray(artifactIds,true));
+ }
+ });
+
+ $( "#main-content #search-filter-auto-version" ).autocomplete({
+ minLength: 1,
+ source: function(request, response){
+ var versions=[];
+ $(self.resultViewModel.artifacts()).each(function(idx,artifact){
+ if(artifact.version.startsWith(request.term)){
+ versions.push(artifact.version);
+ }
+ });
+ response(unifyArray(versions,true));
+ }
+ });
+
+
+
activateSearchResultsTab();
- mainContent.find("#btn-advanced-search-filter" ).show();
}
},
error: function(data) {
displayRestError(res);
},
complete:function() {
- $("#main-content #btn-basic-search" ).button("reset");
+ mainContent.find("##btn-basic-search" ).button("reset");
+ mainContent.find("#btn-advanced-search" ).button("reset");
removeMediumSpinnerImg("#user-messages");
}
}
);
}
+ // olamy not used as we cannot filter on className etc...
filterResults=function(){
var filtered=[];
for (var i=0;i<self.resultViewModel.artifacts().length;i++){
<button type="submit" id="btn-advanced-search" class="btn btn-primary"
data-bind="click: advancedSearch">${$.i18n.prop('search.artifact.search.form.btn.search')}</button>
- <button type="submit" id="btn-advanced-search-filter" class="btn btn-success hide"
- data-bind="click: filterResults">${$.i18n.prop('search.artifact.search.form.btn.search.filter')}</button>
-
</form>
</div>
<div class="pill-pane" id="search-osgi-form-pane">
</tr>
<tr>
{{each(i, columnDefinition) columns}}
- <th title="${ columnDefinition.title }" id="search-filter-auto-${ columnDefinition.id }"><input type="text" place-holder="filter"/></th>
+ <th title="${ columnDefinition.title }">
+ <input type="text" class="form-search" id="search-filter-auto-${ columnDefinition.id }" place-holder="filtering"/>
+ </th>
{{/each}}
</tr>
</thead>
return [];
}
+/**
+ * return an array with removing duplicate strings
+ * @param strArray an array of string
+ * @param sorted to sort or not
+ */
+unifyArray=function(strArray,sorted){
+ var res = [];
+ $(strArray).each(function(idx,str){
+ if ( $.inArray(str,res)<0){
+ res.push(str);
+ }
+ });
+ return sorted?res.sort():res;
+}
+
// utils
String.prototype.endsWith = function(str) {
return (this.match(str+"$")==str)