Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SitePicker: add HubId to filter to only sites within a hub #1346

Closed
russgove opened this issue Oct 31, 2022 · 5 comments
Closed

SitePicker: add HubId to filter to only sites within a hub #1346

russgove opened this issue Oct 31, 2022 · 5 comments
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Milestone

Comments

@russgove
Copy link
Contributor

Category

[x ] Enhancement

[ ] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 3.7 ]

Expected / Desired Behavior / Question

We should add an optional HubId to the sitePicker Control. If you want to search just for a site that is a member of the hub.

@ghost
Copy link

ghost commented Oct 31, 2022

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Oct 31, 2022
@kadu-jr
Copy link
Contributor

kadu-jr commented Nov 2, 2022

Looks like a fair addition. I'll try to implement it and get back to you over the weekend.

@NishkalankBezawada
Copy link
Contributor

Hello @russgove & @kadu-jr

We already have a property called "additionalQuery," which, if supplied, will be added as part of the AND operator in the search query. If mode is set to site or web, then it applies.

To obtain the sites that are linked to hub sites, simply enter the hubsite id in the property to the fetch the sites linked to a specific hubsite function.

Below is the sample query text

(DepartmentId:{Hub.Id} OR DepartmentId:Hub.Id) AND ContentClass:STS_Site AND SiteId<>{Hub.Id} 

So, in our case the query would be as below

(DepartmentId:{f9f37a78-a7f2-4d4d-a294-c5609559d664} OR DepartmentId:f9f37a78-a7f2-4d4d-a294-c5609559d664) AND SiteId<>{f9f37a78-a7f2-4d4d-a294-c5609559d664}

and the control code will be as below,

                <SitePicker
                  context={this.props.context}
                  label={'select sites'}
                  mode={'site'}
                  allowSearch={true}
                  multiSelect={false}
                  onChange={(sites) => { console.log(sites); }}
                  placeholder={'Select sites'}
                  searchPlaceholder={'Filter sites'} 
                  additionalQuery={'(DepartmentId:{f9f37a78-a7f2-4d4d-a294-c5609559d664} OR DepartmentId:f9f37a78-a7f2-4d4d-a294-c5609559d664) AND SiteId<>{f9f37a78-a7f2-4d4d-a294-c5609559d664}'}
                  />

Let me know if this helps.

Thanks,
Nishkalank Bezawada

@kadu-jr
Copy link
Contributor

kadu-jr commented Nov 3, 2022

Hi @NishkalankBezawada,

Yeah, I took a brief look at the code yesterday and realized that, indeed, the developer is already able to implement that. However, I think it would be a nice addition to have this option built-in, especially given that the component already has a 'mode' property and that the developer would need an additional query to fetch the hubId to insert in the query. I'm thinking about adding a 'associatedsites' option to the mode prop which does just that.

@joelfmrodrigues
Copy link
Collaborator

PR from @kadu-jr has been merged and will be in the next release. Thanks everyone

@AJIXuMuK AJIXuMuK mentioned this issue Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Projects
None yet
Development

No branches or pull requests

5 participants