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.4
edited by bougault
on 2022/11/17 12:51
Change comment: There is no comment for this version
To version 27.6
edited by bougault
on 2022/11/17 13:00
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -51,23 +51,39 @@
51 51   }
52 52   this[roleName] = !this[roleName];
53 53   this.filterUrl.searchParams.set('roles', this.rolesFilter.join("+"));
54 - console.log(this.filterUrl.toString());
54 + // if search text then apply filter
55 + // else return filters result
55 55   }
56 56   setSearchText(e) {
57 57   this.searchText = e.target.value;
58 58   }
59 59   handleSearch() {
60 - console.log(this.searchText);
61 61   if(this.searchText !== "") {
62 - this.fetchWikiSearch();
62 + Promise.all([
63 + this.fetchWikiSearch(),
64 + this.fetchFilterSearch()
65 + ])
66 + } else {
67 + console.log("no search text, should return filter search results if any");
63 63   }
64 64   }
70 + hasActiveFilters() {
71 + // we only look at role filters for POC.
72 + return this.roles.length > 0;
73 + }
65 65   fetchWikiSearch() {
66 66   // request should be built from component, not from "external" dependency. Leave it here like this for POC.
67 - handleXWikiSearch(this.searchText).then(results => this.results = results);
76 + return handleXWikiSearch(this.searchText);
68 68   }
69 -
70 -
78 + fetchFilterSearch() {
79 + return new Promise((resolve) => {
80 + if(hasActiveFilters) {
81 + fetch(this.filterUrl).then(console.log);
82 + } else {
83 + resolve(null);
84 + }
85 + });
86 + }
71 71   getLink(xwikiDocSpace) {
72 72   return `/bin/view/${xwikiDocSpace.replaceAll('.', '/')}`;
73 73   }