microsoft-graph-toolkit icon indicating copy to clipboard operation
microsoft-graph-toolkit copied to clipboard

More filter in mgt-Tasks

Open kandari7 opened this issue 6 years ago • 11 comments

Is there any way in which I can filter task and show only the tasks which are not completed yet, and show only tasks up to specific number. For e.g. if I want to show only top 10 task to user.

currently the mgt-tasks fetches all the task which eventually impact the application performance.

kandari7 avatar Jul 14 '20 19:07 kandari7

Hello kandari7, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Jul 14 '20 19:07 ghost

Hi @kandari7, you can create a filter function via the taskFilter property to control which tasks are shown by the component.

let taskView = document.querySelector('mgt-tasks');
taskView.taskFilter = task => task.appliedCategories.category3 === true;

However, this will still fetch all tasks and I agree this can impact the app performance. The bigger issue with the tasks component is that it fatches all tasks for all folders, not just for the current view. On top of that, all tasks are refreshed when a task is changed (ex: completed).

There are several optimizations we should do on the Task component to improve performance, by ensuring only the necessary tasks for the current view are loaded (lazy loading folders and pages), and only update the modified tasks.

@shweaver-MSFT, I wonder if this is work that is already covered by the work you are doing for #423?

nmetulev avatar Jul 20 '20 16:07 nmetulev

@nmetulev, this is not covered by my upcoming changes. I'm doing a lot of refactoring, but not necessarily adding any new functionality. Adding a max-tasks or similar attribute would be a new feature.

shweaver-MSFT avatar Jul 20 '20 17:07 shweaver-MSFT

Sorry, I was asking about optimizing how tasks are loaded and how the API is used, not about adding the max-tasks feature. I imagine for the split between planner and todo, you will need to rewrite this anyway?

nmetulev avatar Jul 20 '20 22:07 nmetulev

It's a good time to do it, but not actually necessary for the split. The split out MGtTodo and MgtPlanner components are individually just as inefficient as the original 😅 I can look into it though. I've assigned myself to the issue so I don't forget.

shweaver-MSFT avatar Jul 20 '20 22:07 shweaver-MSFT

Great!!! hope to see more feature on mgt task and other components as well as this is emerging.

kandari7 avatar Jul 20 '20 22:07 kandari7

Hi any update on this feature request? I tried following the filter function suggestion above but was unsuccessful.

iorivera avatar Dec 03 '21 05:12 iorivera

This should work with taskFilter. Closing for now.

sebastienlevert avatar Aug 14 '23 17:08 sebastienlevert

@sebastienlevert, could you send us an example explaining how to use taskFilter?

Wagnerah avatar Sep 28 '23 19:09 Wagnerah

https://learn.microsoft.com/en-us/graph/toolkit/components/tasks#properties look at the end of this section.

sebastienlevert avatar Oct 02 '23 16:10 sebastienlevert

Thank you Sebastien!

Wagnerah avatar Oct 03 '23 18:10 Wagnerah