feat: search in quick actions #943

Merged
konrad merged 10 commits from feature/search-in-quick-actions into main 2021-11-13 20:26:03 +00:00
Owner

This PR enhances the global search bar adds support for the quick add magic filters to scope the search.

Related discussion: https://community.vikunja.io/t/searching-for-a-specific-task-within-a-specific-list/280

This PR enhances the global search bar adds support for the quick add magic filters to scope the search. Related discussion: https://community.vikunja.io/t/searching-for-a-specific-task-within-a-specific-list/280
konrad added 5 commits 2021-11-03 20:44:52 +00:00
konrad was assigned by dpschen 2021-11-04 11:25:29 +00:00
konrad requested review from dpschen 2021-11-09 18:50:25 +00:00
dpschen requested changes 2021-11-11 01:42:45 +00:00
@ -125,1 +123,3 @@
lists = (allLists.filter(l => {
const {list} = this.parsedQuery
lists = list === null ? [] : (allLists.filter(l => {

There is too much happening in this tenary which makes it hard to read.

There is too much happening in this tenary which makes it hard to read.
Author
Owner

I've moved one out, hope it is clearer now.

I've moved one out, hope it is clearer now.
konrad marked this conversation as resolved
@ -236,18 +238,23 @@ export default {
return cmds
},
parsedQuery() {

nice!

nice!
konrad marked this conversation as resolved
@ -285,1 +311,4 @@
}
}
this.taskSearchTimeout = setTimeout(async () => {

Having this timeout deep hidden inside the searchTasks makes it hard to follow.
We should use a common pattern debounce for these cases.

Having this timeout deep hidden inside the searchTasks makes it hard to follow. We should use a common pattern debounce for these cases.
dpschen marked this conversation as resolved
@ -317,2 +341,4 @@
const {assignees} = this.parsedQuery
this.teamSearchTimeout = setTimeout(async () => {

Not happy with this deep nesting here (hard to follow what happens).
Tried to untangle it a bit with async, but still not happy (untested):

const {assignees} = this.parsedQuery

this.teamSearchTimeout = setTimeout(async () => {
    // search team for each assignee
    const teamServicePromises = assignees.map((t) => this.teamService.getAll({}, {s: t}))
    const teamServiceResult = await Promise.all(teamServicePromises)
    this.foundTeams = teamServiceResult.flatMap(team => {
        team.title = team.name
        return team
    })
}, 150)

While working on this I always had to think of proposal pipeline operator...
Then I found https://www.freecodecamp.org/news/pipe-and-compose-in-javascript-5b04004ac937/ 🤔 😆

Not happy with this deep nesting here (hard to follow what happens). Tried to untangle it a bit with async, but still not happy (untested): ```js const {assignees} = this.parsedQuery this.teamSearchTimeout = setTimeout(async () => { // search team for each assignee const teamServicePromises = assignees.map((t) => this.teamService.getAll({}, {s: t})) const teamServiceResult = await Promise.all(teamServicePromises) this.foundTeams = teamServiceResult.flatMap(team => { team.title = team.name return team }) }, 150) ``` While working on this I always had to think of [proposal pipeline operator](https://github.com/tc39/proposal-pipeline-operator)... Then I found https://www.freecodecamp.org/news/pipe-and-compose-in-javascript-5b04004ac937/ 🤔 😆
Author
Owner

Maybe we could use something like this: https://vueuse.org/shared/useDebounceFn/#usage

Maybe we could use something like this: https://vueuse.org/shared/useDebounceFn/#usage

That component is a prime candidate for using the composition api.
Let's do this later in another issue =)

For now: what do you think about the above as a temporary solution?

That component is a prime candidate for using the composition api. Let's do this later in another issue =) For now: what do you think about the above as a temporary solution?
Author
Owner

For now: what do you think about the above as a temporary solution?

I think that makes sense, refactored it.

> For now: what do you think about the above as a temporary solution? I think that makes sense, refactored it.
konrad marked this conversation as resolved
@ -48,0 +48,4 @@
getLabelsByExactTitles(state) {
return labelTitles => Object
.values(state.labels)
.filter(({title}) => {
.filter(({title}) => labelTitles.some(l => l.toLowerCase() === title.toLowerCase())
``` .filter(({title}) => labelTitles.some(l => l.toLowerCase() === title.toLowerCase()) ```
Author
Owner

Done.

Done.
konrad marked this conversation as resolved
konrad added 2 commits 2021-11-13 16:03:01 +00:00
continuous-integration/drone/pr Build is passing Details
66eafd6ac9
chore: simplify tenary
konrad added 1 commit 2021-11-13 16:09:38 +00:00
continuous-integration/drone/pr Build is passing Details
2ce847004b
chore: simplify filtering labels by title
Member

Hi konrad!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://943-featuresearch-in-quick-actions--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.

Have a nice day!

Beep boop, I'm a bot.

Hi konrad! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://943-featuresearch-in-quick-actions--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/. Have a nice day! > Beep boop, I'm a bot.
konrad added 2 commits 2021-11-13 19:56:23 +00:00
dpschen approved these changes 2021-11-13 19:58:50 +00:00
konrad merged commit 0fe433891a into main 2021-11-13 20:26:03 +00:00
konrad deleted branch feature/search-in-quick-actions 2021-11-13 20:26:03 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.