feat: move lists between namespaces #1430
No reviewers
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
3 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#1430
Loading…
Reference in New Issue
No description provided.
Delete Branch "feature/move-list"
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?
Frontend implementation of vikunja/api#1096
I've implemented this re-using the drag and drop part of rearranging the list position in the menu. The only problem we have is there's no way to check if a namespace is read-only and disable dropping a list into it. I hope to solve this in the future on the api but for now you can drop a list into it and get an error message. I felt like properly handling the error and restoring the list and its position given this will change anyway.
Hi konrad!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://1430-featuremove-list--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!
@ -253,0 +249,4 @@
// because now all archived lists are sorted after the active ones. This is fine because they are sorted
// later when showing them anyway, and it makes the merging happening here a lot easier.
const archivedFromNamespace = namespace.lists.filter(l => l.isArchived)
const lists = [
spread this directly in
newNamespace
You mean spreading the contents of
archivedFromNamespace
directly instead of using a new variable?Yes or even creating the object directly inline with the commit.
Done.
@ -262,2 +265,2 @@
async saveListPosition(e, namespaceIndex) {
const listsActive = this.activeLists[namespaceIndex]
async saveListPosition(e) {
const namespaceId = parseInt(e.to.dataset.namespaceId)
Why the switch to data attributes?
Because I need to get the attributes of the target element. The
@drop
handler is called from the source element, hence it won't contain the new data if I'd pass it in directly like@drop="e => saveListPosition(e, namespaceId)"
.This is in line with how we're passing the data when moving tasks between kanban buckets.
What I don't understand is, why did the original line work
@end="e => saveListPosition(e, nk)"
/ why wasnk
updated?It was not updated, but is wasn't possible to move a list between namespaces (solved with sortable.js groups for each namespace). So
nk
was always the same for all lists in a namespace.That makes sense =) Thanks for explaining.
@ -138,3 +138,2 @@
loadNamespacesIfFavoritesDontExist(ctx) {
// The first namespace should be the one holding all favorites
if (ctx.state.namespaces[0].id !== -2) {
// The first or second namespace should be the one holding all favorites
Quick thought:
I think for the frontend we should save the "special ids" in some constant and import them when we use them.