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

Summary

Details

Page properties
Content
... ... @@ -40,7 +40,7 @@
40 40   this.editor = false;
41 41   this.viewer = false;
42 42   this.rolesFilter = [];
43 - this.filterUrl = new URL(`${document.location.origin}/rest/v1/collabs?search=&offset=0&orderField=title&order=asc&favorite=&roles=`);
43 + this.filterUrl = new URL(`${document.location.origin}/rest/v1/collabs?search=&offset=0&orderField=title&order=asc&favorite=true&roles=`);
44 44   this.results = [];
45 45   }
46 46   toggleRoleFilter(roleName) {
... ... @@ -51,38 +51,22 @@
51 51   }
52 52   this[roleName] = !this[roleName];
53 53   this.filterUrl.searchParams.set('roles', this.rolesFilter.join("+"));
54 - // if search text then apply filter
55 - // else return filters result
56 56   }
57 57   setSearchText(e) {
58 58   this.searchText = e.target.value;
59 59   }
60 60   handleSearch() {
59 + console.log(this.searchText);
61 61   if(this.searchText !== "") {
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");
61 + this.fetchWikiSearch();
68 68   }
69 69   }
70 - hasActiveFilters() {
71 - // we only look at role filters for POC.
72 - return this.roles.length > 0;
73 - }
74 74   fetchWikiSearch() {
75 75   // request should be built from component, not from "external" dependency. Leave it here like this for POC.
76 - return handleXWikiSearch(this.searchText);
66 + handleXWikiSearch(this.searchText).then(results => this.results = results);
77 77   }
78 - fetchFilterSearch() {
79 - return new Promise((resolve) => {
80 - if(hasActiveFilters) {
81 - fetch(this.filterUrl).then(console.log);
82 - } else {
83 - resolve(null);
84 - }
85 - });
68 + buildFilter() {
69 + //https://wiki-dev.ebrains.eu/rest/v1/collabs?search=&offset=0&orderField=title&order=asc&favorite=true&roles=
86 86   }
87 87   getLink(xwikiDocSpace) {
88 88   return `/bin/view/${xwikiDocSpace.replaceAll('.', '/')}`;