Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

Context Search - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


Changes for page Context Search

Last modified by bougault on 2023/02/20 16:29

From version 27.54
edited by bougault
on 2022/11/17 14:21
Change comment: There is no comment for this version
To version 27.40
edited by bougault
on 2022/11/17 13:53
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -58,21 +58,11 @@
58 58   setSearchText(e) {
59 59   this.searchText = e.target.value;
60 60   }
61 - handleSearch(textSearch) {
62 - if(this.searchText !== "" || textSearch) {
61 + handleSearch() {
62 +
63 + if(this.searchText !== "") {
63 63   if(this.searchText !== this.prevSearchText) {
64 - this.clearResults();
65 65   this.prevSearchText = this.searchText;
66 - this.fetchWikiSearch().then(results => {
67 - console.log(results);
68 - this.resultsCache = results;
69 - if(this.hasActiveFilters()) {
70 - this.fetchFilterSearch().then(this.filterResults);
71 - } else {
72 - this.results = results;
73 - }
74 - })
75 - /*
76 76   Promise.all([
77 77   this.fetchWikiSearch(),
78 78   this.fetchFilterSearch()
... ... @@ -81,14 +81,10 @@
81 81   this.resultsCache = wikiSearchResults;
82 82   console.log(wikiSearchResults, collabSearchResults);
83 83   });
84 - */
85 85   } else if (this.searchText === this.prevSearchText && this.hasActiveFilters()) {
86 86   this.fetchFilterSearch().then(this.filterResults)
87 - } else {
88 - this.results = this.resultsCache;
89 89   }
90 90   } else {
91 - this.clearResults();
92 92   console.log("no search text, should return filter search results if any");
93 93   this.fetchFilterSearch().then(collabs => {
94 94   console.log("Format and display collabs", collabs);
... ... @@ -113,13 +113,10 @@
113 113   });
114 114   }
115 115   filterResults = (filteredCollabs) => {
102 + console.log("filteredCollabs:", filteredCollabs, "search results:", this.results);
116 116   const collabSpaces = filteredCollabs.map(collab => `Collabs.${collab.name}`);
117 117   this.results = this.resultsCache.filter(result => collabSpaces.some(space => result.space.startsWith(space)));
118 118   }
119 - clearResults() {
120 - this.results = [];
121 - this.resultsCache = [];
122 - }
123 123   getLink(xwikiDocSpace) {
124 124   return `/bin/view/${xwikiDocSpace.replaceAll('.', '/')}`;
125 125   }
... ... @@ -128,7 +128,7 @@
128 128  <div>
129 129   <div>
130 130   <input @change="${this.setSearchText}" type="text" placeholder="Search..." />
131 - <button @click="${() => this.handleSearch(true)}">Search</button>
114 + <button @click="${this.handleSearch}">Search</button>
132 132   </div>
133 133   <div>
134 134   <label><input type="checkbox" @change="${() => this.toggleRoleFilter('administrator')}" .checked="${this.administratorFilter}"/> Administrator</label>