| ... |
... |
@@ -36,6 +36,7 @@ |
| 36 |
36 |
constructor() { |
| 37 |
37 |
super(); |
| 38 |
38 |
this.searchText = ""; |
|
39 |
+ this.prevSearchText = ""; |
| 39 |
39 |
this.administrator = false; |
| 40 |
40 |
this.editor = false; |
| 41 |
41 |
this.viewer = false; |
| ... |
... |
@@ -58,13 +58,22 @@ |
| 58 |
58 |
this.searchText = e.target.value; |
| 59 |
59 |
} |
| 60 |
60 |
handleSearch() { |
| 61 |
|
- if(this.searchText !== "") { |
|
62 |
+ if(this.searchText !== "" && this.searchText !== this.prevSearchText) { |
|
63 |
+ this.prevSearchText = this.searchText; |
| 62 |
62 |
Promise.all([ |
| 63 |
63 |
this.fetchWikiSearch(), |
| 64 |
64 |
this.fetchFilterSearch() |
| 65 |
|
- ]) |
|
67 |
+ ]).then(([wikiSearchResults, collabSearchResults]) => { |
|
68 |
+ console.log(wikiSearchResults, collabSearchResults); |
|
69 |
+ }); |
|
70 |
+ } else if (this.searchText === this.prevSearchText) { |
|
71 |
+ console.log("Only apply filter on results"); |
|
72 |
+ this.fetchFilterSearch().then(res => res.json()).then(this.filterResults) |
| 66 |
66 |
} else { |
| 67 |
67 |
console.log("no search text, should return filter search results if any"); |
|
75 |
+ this.fetchFilterSearch().then(res => res.json()).then(collabs => { |
|
76 |
+ console.log("Format and display collabs", collabs); |
|
77 |
+ }) |
| 68 |
68 |
} |
| 69 |
69 |
} |
| 70 |
70 |
hasActiveFilters() { |
| ... |
... |
@@ -84,6 +84,9 @@ |
| 84 |
84 |
} |
| 85 |
85 |
}); |
| 86 |
86 |
} |
|
97 |
+ filterResults(filteredCollabs) { |
|
98 |
+ console.log("filteredCollabs:", filteredCollabs, "search results:", this.results); |
|
99 |
+ } |
| 87 |
87 |
getLink(xwikiDocSpace) { |
| 88 |
88 |
return `/bin/view/${xwikiDocSpace.replaceAll('.', '/')}`; |
| 89 |
89 |
} |