diff --git a/docs/content/doc/usage/errors.md b/docs/content/doc/usage/errors.md index 1ff2ea801..fc364ee7e 100644 --- a/docs/content/doc/usage/errors.md +++ b/docs/content/doc/usage/errors.md @@ -73,29 +73,30 @@ This document describes the different errors Vikunja can return. | ErrorCode | HTTP Status Code | Description | |-----------|------------------|----------------------------------------------------------------------------| -| 4001 | 400 | The project task text cannot be empty. | -| 4002 | 404 | The project task does not exist. | -| 4003 | 403 | All bulk editing tasks must belong to the same project. | -| 4004 | 403 | Need at least one task when bulk editing tasks. | -| 4005 | 403 | The user does not have the right to see the task. | -| 4006 | 403 | The user tried to set a parent task as the task itself. | -| 4007 | 400 | The user tried to create a task relation with an invalid kind of relation. | -| 4008 | 409 | The user tried to create a task relation which already exists. | -| 4009 | 404 | The task relation does not exist. | -| 4010 | 400 | Cannot relate a task with itself. | -| 4011 | 404 | The task attachment does not exist. | -| 4012 | 400 | The task attachment is too large. | -| 4013 | 400 | The task sort param is invalid. | -| 4014 | 400 | The task sort order is invalid. | -| 4015 | 404 | The task comment does not exist. | -| 4016 | 400 | Invalid task field. | -| 4017 | 400 | Invalid task filter comparator. | -| 4018 | 400 | Invalid task filter concatinator. | -| 4019 | 400 | Invalid task filter value. | -| 4020 | 400 | The provided attachment does not belong to that task. | -| 4021 | 400 | This user is already assigned to that task. | -| 4022 | 400 | The task has a relative reminder which does not specify relative to what. | -| 4023 | 409 | Tried to create a task relation which would create a cycle. | +| 4001 | 400 | The project task text cannot be empty. | +| 4002 | 404 | The project task does not exist. | +| 4003 | 403 | All bulk editing tasks must belong to the same project. | +| 4004 | 403 | Need at least one task when bulk editing tasks. | +| 4005 | 403 | The user does not have the right to see the task. | +| 4006 | 403 | The user tried to set a parent task as the task itself. | +| 4007 | 400 | The user tried to create a task relation with an invalid kind of relation. | +| 4008 | 409 | The user tried to create a task relation which already exists. | +| 4009 | 404 | The task relation does not exist. | +| 4010 | 400 | Cannot relate a task with itself. | +| 4011 | 404 | The task attachment does not exist. | +| 4012 | 400 | The task attachment is too large. | +| 4013 | 400 | The task sort param is invalid. | +| 4014 | 400 | The task sort order is invalid. | +| 4015 | 404 | The task comment does not exist. | +| 4016 | 400 | Invalid task field. | +| 4017 | 400 | Invalid task filter comparator. | +| 4018 | 400 | Invalid task filter concatinator. | +| 4019 | 400 | Invalid task filter value. | +| 4020 | 400 | The provided attachment does not belong to that task. | +| 4021 | 400 | This user is already assigned to that task. | +| 4022 | 400 | The task has a relative reminder which does not specify relative to what. | +| 4023 | 409 | Tried to create a task relation which would create a cycle. | +| 4024 | 400 | The provided filter expression is invalid. | ## Team diff --git a/docs/content/doc/usage/filters.md b/docs/content/doc/usage/filters.md new file mode 100644 index 000000000..b7885efc9 --- /dev/null +++ b/docs/content/doc/usage/filters.md @@ -0,0 +1,67 @@ +--- +title: "Filters" +date: 2024-03-09T19:51:32+02:00 +draft: false +type: doc +menu: + sidebar: + parent: "usage" +--- + +# Filter Syntax + +To filter tasks via the api, you can use a query syntax similar to SQL. + +This document is about filtering via the api. To filter in Vikunja's web ui, check out the help text below the filter query input. + +{{< table_of_contents >}} + +## Available fields + +The available fields for filtering include: + +* `done`: Whether the task is completed or not +* `priority`: The priority level of the task (1-5) +* `percentDone`: The percentage of completion for the task (0-100) +* `dueDate`: The due date of the task +* `startDate`: The start date of the task +* `endDate`: The end date of the task +* `doneAt`: The date and time when the task was completed +* `assignees`: The assignees of the task +* `labels`: The labels associated with the task +* `project`: The project the task belongs to (only available for saved filters, not on a project level) + +You can date math to set relative dates. Click on the date value in a query to find out more. + +All strings must be either single-word or enclosed in `"` or `'`. This extends to date values like `2024-03-11`. + +## Operators + +The available operators for filtering include: + +* `!=`: Not equal to +* `=`: Equal to +* `>`: Greater than +* `>=`: Greater than or equal to +* `<`: Less than +* `<=`: Less than or equal to +* `like`: Matches a pattern (using wildcard `%`) +* `in`: Matches any value in a list + +To combine multiple conditions, you can use the following logical operators: + +* `&&`: AND operator, matches if all conditions are true +* `||`: OR operator, matches if any of the conditions are true +* `(` and `)`: Parentheses for grouping conditions + +## Examples + +Here are some examples of filter queries: + +* `priority = 4`: Matches tasks with priority level 4 +* `dueDate < now`: Matches tasks with a due date in the past +* `done = false && priority >= 3`: Matches undone tasks with priority level 3 or higher +* `assignees in [user1, user2]`: Matches tasks assigned to either "user1" or "user2 +* `(priority = 1 || priority = 2) && dueDate <= now`: Matches tasks with priority level 1 or 2 and a due date in the past + + diff --git a/frontend/src/components/date/dateRanges.ts b/frontend/src/components/date/dateRanges.ts index 648f001b4..556c21c1f 100644 --- a/frontend/src/components/date/dateRanges.ts +++ b/frontend/src/components/date/dateRanges.ts @@ -19,3 +19,28 @@ export const DATE_RANGES = { 'thisYear': ['now/y', 'now/y+1y'], 'restOfThisYear': ['now', 'now/y+1y'], } + +export const DATE_VALUES = { + 'now': 'now', + 'startOfToday': 'now/d', + 'endOfToday': 'now/d+1d', + + 'beginningOflastWeek': 'now/w-1w', + 'endOfLastWeek': 'now/w-2w', + 'beginningOfThisWeek': 'now/w', + 'endOfThisWeek': 'now/w+1w', + 'startOfNextWeek': 'now/w+1w', + 'endOfNextWeek': 'now/w+2w', + 'in7Days': 'now+7d', + + 'beginningOfLastMonth': 'now/M-1M', + 'endOfLastMonth': 'now/M-2M', + 'startOfThisMonth': 'now/M', + 'endOfThisMonth': 'now/M+1M', + 'startOfNextMonth': 'now/M+1M', + 'endOfNextMonth': 'now/M+2M', + 'in30Days': 'now+30d', + + 'startOfThisYear': 'now/y', + 'endOfThisYear': 'now/y+1y', +} diff --git a/frontend/src/components/date/datepickerWithRange.vue b/frontend/src/components/date/datepickerWithRange.vue index be9e70683..da35d013f 100644 --- a/frontend/src/components/date/datepickerWithRange.vue +++ b/frontend/src/components/date/datepickerWithRange.vue @@ -75,14 +75,15 @@

{{ $t('input.datemathHelp.canuse') }} - - {{ $t('input.datemathHelp.learnhow') }} -

+ + {{ $t('input.datemathHelp.learnhow') }} + + +
+ + + +
+ + + + + diff --git a/frontend/src/components/input/AutocompleteDropdown.vue b/frontend/src/components/input/AutocompleteDropdown.vue new file mode 100644 index 000000000..64545214d --- /dev/null +++ b/frontend/src/components/input/AutocompleteDropdown.vue @@ -0,0 +1,232 @@ + + +