feat: move lists between namespaces #1430

Merged
konrad merged 3 commits from feature/move-list into main 2022-01-29 21:12:46 +00:00
Owner

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.

Frontend implementation of https://kolaente.dev/vikunja/api/pulls/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.
konrad added 1 commit 2022-01-23 15:58:01 +00:00
continuous-integration/drone/pr Build is passing Details
6442e86362
feat: move lists between namespaces
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://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!

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://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! > Beep boop, I'm a bot.
konrad requested review from dpschen 2022-01-23 17:05:09 +00:00
dpschen approved these changes 2022-01-23 19:50:12 +00:00
@ -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

spread this directly in `newNamespace`
Author
Owner

You mean spreading the contents of archivedFromNamespace directly instead of using a new variable?

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.

Yes or even creating the object directly inline with the commit.
Author
Owner

Done.

Done.
konrad marked this conversation as resolved
@ -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?

Why the switch to data attributes?
Author
Owner

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.

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 was nk updated?

What I don't understand is, why did the original line work `@end="e => saveListPosition(e, nk)"` / why was `nk` updated?
Author
Owner

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.

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.

That makes sense =) Thanks for explaining.
dpschen marked this conversation as resolved
dpschen reviewed 2022-01-27 12:56:15 +00:00
@ -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.

Quick thought: I think for the frontend we should save the "special ids" in some constant and import them when we use them.
dpschen marked this conversation as resolved
konrad added 1 commit 2022-01-29 20:58:52 +00:00
continuous-integration/drone/pr Build was killed Details
a3f7e1a850
chore: remove const and spread contents directly
konrad added 1 commit 2022-01-29 21:02:05 +00:00
continuous-integration/drone/pr Build is passing Details
278842bd19
Merge branch 'main' into feature/move-list
konrad merged commit c98ab42e75 into main 2022-01-29 21:12:46 +00:00
konrad deleted branch feature/move-list 2022-01-29 21:12:46 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.