microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
945 stars 303 forks source link

mgt-file-list component should have filterFiles property to be able to use a custom filter #2874

Closed eduardpaul closed 8 months ago

eduardpaul commented 10 months ago

Proposal: Add filterFiles property to mgt-file-list so custom filter function could be provided by consumer

Description

As a consumer of this component i should be able to decide if specific document should be shown or not (currently only file extensions are supported). Using a filter function could solve most scenarios.

Rationale

Preferred Solution

Implement filterFiles property following the filterTasks implementation from to-do component.

Additional Context

Probably I will try to implement it myself any time soon.

sebastienlevert commented 10 months ago

Thanks for your suggestion! We'd love to work with you on this request. Right now, the filterTasks on the to-do component does the filtering on the client side, which is OK for tasks as the amount of data is limited, but challenging for a file list. Today, we already support providing one of multiple file queries, but these won't support advanced filtering, and the search endpoints on the drive items is being deprecated, so this doesn't help in the future (https://devblogs.microsoft.com/microsoft365dev/transition-to-microsoft-graph-search-endpoint-for-onedrive-and-sharepoint/).

That being said, there are valid scenarios and would love your feedback. Is it more of a "search" scenario that could leverage an improved version of our search results component? Would client-side filtering "enough" for this concept? Let's brainstorm!

eduardpaul commented 10 months ago

@sebastienlevert totally agree with you that client side filtering is not the best option to filter out results and it could be a pain when it comes to paginating results from graph api.

Our scenario is more about file management where we want to hide specific files (system files) from the end user and allow them to browse through folders and upload files. In SharePoint Online we are handling this by filtering certain content types in the list views. In this case, client-side filtering of file-list will do the trick.

One thing I'm not sure about is if it makes sense that the file-list component should have the file upload option. For example it generates an inconsistency with the configuration: if you activate upload and configure filequeries you will be showing documents from one place but the upload will be done in your onedrive. And as you pointed out, listing files (read-only scenarios with search, filtering,....) could be covered by a search-result component.

Probably in the long term it would be better to have a "file-explorer" or "file-manager" component with some basic add/upload, delete, move, copy and paste functionality that you could point to a specific library, folder,. and replace file-list with search result component.

sebastienlevert commented 10 months ago

To your last point, we have been having a long-standing PR that does exactly what you are mentioning (minus the file filtering). https://github.com/microsoftgraph/microsoft-graph-toolkit/pull/2564

It might be useful to look at this branch (very outdated to be honest) and see if this could help with your scenario.

Now back to the file filter scenario, I think it makes sense for "light" filters, maybe not large complex filters... I think we could document this caveat and I'd agree it deliver some scenarios... We're happy for you to send a PR and we'll happily review and help with the process!

sebastienlevert commented 8 months ago

At the moment, this is not something we're likely to prioritize. That being said, the Graph Toolkit is an open source project and we'll be happy to support and review if you want to contribute to its codebase! Please let us know if you'd be happy to help and implement this capability. If not, it's absolutely fine, we'll go and close the issue and might re-open it later if we reconsider our priorities. Thanks!

microsoft-github-policy-service[bot] commented 8 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.