feat/alphabetical-sort #1162
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
5 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#1162
Loading…
Reference in New Issue
No description provided.
Delete Branch ":feat/alphabetical-sort"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Alphabetical sorting.
Disables re-ordering when applied.
Does not work with the search button as expected, but neither do the filters tbh... Works fine with the search in the filters menu.
I know we talked about having a dropdown but since this is pretty much finished I thought I'd submit a PR. I am a bit short on time these days but may submit a new PR to add the dropdown ( should be simple enough )
Yes! This is happening :D
Fix linting issues with build
Hi! Thanks for the PR.
A few nits, but looks good overall.
Please also fix the lint errors, you should be able to run
yarn lint --fix
to fix most of them.@ -493,0 +503,4 @@
this.params.sort_by = getDefaultParams().sort_by
this.sortAlphabetically = false
} else {
this.params.sort_by = ['title']
Please use a const for that.
@ -373,6 +373,7 @@
"includeNulls": "Zahrnout úkoly, které nemají nastavenou hodnotu",
"requireAll": "Vyžaduje aby všechny filtry odpovídaly, aby se úkol zobrazil",
"showDoneTasks": "Zobrazit dokončené úkoly",
"sortAlphabetically": "Sort Alphabetically",
This will be synced from crowdin automatically - please don't include it in this PR, only the string in
en.json
.@ -263,0 +265,4 @@
// task,
// ...this.tasks,
// ]
// this.tasks = tasks
Why did you comment this? If it is not used, remove it.
@ -264,0 +270,4 @@
this.reloadTasksWithCurrentFilterAndSorting()
},
reloadTasksWithCurrentFilterAndSorting(){
this.loadTasks(undefined, undefined, undefined, true)
This should use the default params instead of
undefined
.Default parameters will overwrite the current filtering,searching etc, no?
Idea here is to preserve it
That's actually the idea behind the default paramters. If they are set, it will first look for the params in the data variables of the component and use them. The function parameters are only meant to override that.
Passing in
undefined
is, well, undefined behaviour.Do you mean something like this:
Where DEFAULT PARAMS are:
No, I mean the default parameters for the variables as they are declared in the function. You should call
this.loadTasks
with just the page function parameter specified (the first)Sure but this would break the behavior since I need forceLoading ( the 4th parameter to be set ). undefined means take the default, it was my bad for passing undefined for page but otherwise it should be this.loadTasks(1, undefined, undefined, true)
Please pass in
''
for the search param andnull
for the params param so it matches the function declaration: https://kolaente.dev/vikunja/frontend/src/branch/main/src/components/tasks/mixins/taskList.js#L41-L46@Michaelpalacce @konrad
Thanks for this pull request.
This will collide with #816 if we merge it.
@dpschen Would this require a rewrite once #816 is merged or "only" a few conflicts?
I think currently only the import
EDIT: to be clear: the filepath of that import. So nothing major.
and the changed changed stuff in
src/views/list/views/List.vue
is conflicting.The latter has changed a lot in my branch.
Hi Michaelpalacce!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://1162-featalphabetical-sort--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!
@ -262,2 +263,3 @@
this.tasks = tasks
updateTaskList() {
this.$store.commit(HAS_TASKS, true)
this.reloadTasksWithCurrentFilterAndSorting()
Still not quite happy with reloading everything. This gives a very noticable load flickering. I get why it is nessecary though. Maybe only reload if there are filters set and otherwise prepend the task as done already?
The sorting should probably happen on client and server side.
This way the client can sort already what he is aware of and fetches an update.
Since this would require a bit of work, I think we should do this in another PR and keep the current logic of prepending new tasks to the list.
So should I do reload only if filters and/or sorts are set ?
I think that would be a good idea.
It looks like this breaks the test. Please take a look.
@ -190,6 +195,7 @@ import NamespaceService from '@/services/namespace'
import EditLabels from '@/components/tasks/partials/editLabels.vue'
import {objectToSnakeCase} from '@/helpers/case'
import {getDefaultParams} from '../../tasks/mixins/taskList'
Use
@
@ -225,2 +228,4 @@
},
methods: {
isAlphabeticalSorting() {
return this.sorting.find( sortBy => sortBy === 'title' ) !== undefined
Import declared const
ALPHABETICAL_SORT
I don't really know much of cypress, to fix it. Seems like something basic but I cannot tell exactly what the issue is
@Michaelpalacce:
Something went wrong in 5808a8980b002f898ee4504f37a8491419268424.
Seems like all files were formatted.
Oh wow.. I'll ammend this as soon as possible
If you did this, mark me.
I can check if I can find out anything about the failing test.
But might be tricky: some tests are flaky right now :/
I'm not super into Cypres aswell.
5808a8980b
to1b6d50860c
@ -491,2 +500,4 @@
this.change()
},
// @TODO - Improve logic to work for all sorts ideally.
setSortAlphabetically() {
Use computed setter and getter and remove
@change
:@ -82,3 +82,3 @@
item-key="id"
:component-data="{
class: { 'dragging-disabled': !canWrite },
class: { 'dragging-disabled': !canWrite || !canDrag },
The
canDrag
is misleading here because dragging could also be disabled ifcanWrite
is false (and thus the invertiontrue
).Make
isAlphabeticalSorting
a computed and you don't have to double invert it (sinceits result is inverted inside the computed).
@ -225,2 +229,4 @@
},
methods: {
isAlphabeticalSorting() {
return this.sorting.find( sortBy => sortBy === ALPHABETICAL_SORT ) !== undefined
Please use
params.sort_by
=> This way we do not need to introduce a newthis.sorting
variable in the mixin.@ -262,1 +264,3 @@
this.tasks = tasks
updateTaskList( task ) {
if ( this.isAlphabeticalSorting() ) {
this.reloadTasksWithCurrentFilterAndSorting()
Instead of putting this in a new function just make a comment:
@ -263,0 +266,4 @@
this.reloadTasksWithCurrentFilterAndSorting()
}
else {
const tasks = [
Merge this:
Okay I changed some small stuff in my branch.
I don't have the right to push to your branch @Michaelpalacce.
My Changes
Making the new option work aswell might be not too complex to add here but I would prefere to improve the general loading implementation instead of wasting time by making the current implementation more complex for a single case / filter.
<filters>
component. It was grouped in the field under "Show done tasks" which doesn't really make sense. I also removed the divs with the.control
class since they didn't change the layout and didn't add any semantics.Since I see this branch as a quick win to make alphabetical sorting work I think we shouldn't waste time for complex special cases. Because of that I'm fine with merging after @Michaelpalacce cherry picked my added commits.
@konrad: Anything to add?
@dpschen yes it was decided that this will be done only for list view for now.
Also I also don't have access to your branch ( can't even see it. )
If you want I can give you access to mine so you can push any changes you want?
Thanks! Pushed the changes =)
Fine by me once the CI passes.
Thanks again @Michaelpalacce!
No problem... Feels like I just slowed you guys down more than anything lol
Thank you all, and @Michaelpalacce in particular, for this :)