Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bulk task creation on paste #2273

Merged

Conversation

t-h-e
Copy link
Contributor

@t-h-e t-h-e commented May 21, 2023

Solves issue #1894

See tests in tests/javascript/unit/utils/textToTask.spec.js for all possible list structures that can be pasted to create multiple tasks in one go

t-h-e added 2 commits May 21, 2023 15:22
Signed-off-by: Stefan Forstenlechner <[email protected]>
@t-h-e t-h-e force-pushed the feature/bulk-task-creation branch from 0e8fe65 to 0b67c40 Compare May 21, 2023 13:23
@t-h-e
Copy link
Contributor Author

t-h-e commented May 21, 2023

Here is an example:
BatchTaskCreation

@codecov
Copy link

codecov bot commented May 21, 2023

Codecov Report

Merging #2273 (55438da) into master (62dbd69) will decrease coverage by 0.78%.
Report is 99 commits behind head on master.
The diff coverage is 22.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2273      +/-   ##
==========================================
- Coverage   27.33%   26.55%   -0.78%     
==========================================
  Files          60       62       +2     
  Lines        2923     3069     +146     
  Branches      744      681      -63     
==========================================
+ Hits          799      815      +16     
- Misses       2124     2254     +130     

@raimund-schluessler
Copy link
Member

@t-h-e Thank you very much. That looks very nice. The code looks good so far and I love the fact that you even provide a test. There are some lint errors that you can mostly fix with npm run lint:fix and I have some nitpicks. I still need to test it live though.

@raimund-schluessler raimund-schluessler added this to the 0.16.0 milestone May 22, 2023
remove unused css
remove non-useful comment

Signed-off-by: Stefan Forstenlechner <[email protected]>
@t-h-e
Copy link
Contributor Author

t-h-e commented May 22, 2023

Thanks for the comments. I configured eslint to be run by my IDE

@raimund-schluessler
Copy link
Member

@t-h-e Thanks a lot! I have a few minor code style related comments, and will try to find the time to test the functionality later this week.

stop paste event propagation the Vue way

Signed-off-by: Stefan Forstenlechner <[email protected]>
@t-h-e
Copy link
Contributor Author

t-h-e commented May 23, 2023

I have addressed your review comments. Let me know if there is anything else 😃

@raimund-schluessler
Copy link
Member

Sorry that it takes me so long. My Nextcloud dev env was broken, and it took me a while to fix it. I will hopefully have a look at the weekend latest.

@t-h-e
Copy link
Contributor Author

t-h-e commented Aug 8, 2023

Hi @raimund-schluessler just wanted to check in what the status is.
Side note: I run my Nextcloud dev setup in docker. So if there is an issue with Nextcloud, I can just remove the container and create a new one.

@raimund-schluessler
Copy link
Member

@jancborchardt Could you please add @t-h-e to nextcloud/tasks?

@raimund-schluessler
Copy link
Member

raimund-schluessler commented Aug 16, 2023

@t-h-e Thanks a lot for the contribution! I finally had time to the PR and it seems to work really nicely. The only problem I found is this:

  • Paste multiple tasks into the input field
  • See the CreateMultipleTasksDialog appear
  • Press Enter
    --> The app creates a single task with a the pasted tasks structure as name, instead of confirming the dialog and creating multiple tasks

It seems that the input field still has focus and then triggers a single task creation. If you could fix this, I think we could merge the PR. I think it should be possible to programmatically focus the Create Tasks button in the dialog, e.g. on mount.

@t-h-e
Copy link
Contributor Author

t-h-e commented Aug 27, 2023

It seems that the input field still has focus and then triggers a single task creation. If you could fix this, I think we could merge the PR. I think it should be possible to programmatically focus the Create Tasks button in the dialog, e.g. on mount.

Actually the focus is automatically on the first button in the dialog. The issue is, at least that is what it seems to me, that the button already reacts on keydown event. If afterwards the focus is set again to the input field in the cancel or close event, the keyup event is fired afterwards, which leads to the creation of an empty task.

As the first button seems to have the focus after showing the dialog, I prevent keydown and keyup events for that button. Not nice, but I could not find a better solution.

@t-h-e
Copy link
Contributor Author

t-h-e commented Aug 27, 2023

Actually you are right. Focusing Create Tasks button works 😄

@raimund-schluessler
Copy link
Member

Thanks a lot, it works a lot better now.

However, whether the task input field is cleared, depends on how the modal is closed. That might be a bit unexpected.

After creating the tasks, the input is:

  • cleared when clicking Close
  • not cleared when clicking on the X or outside the modal

After pasting text, but before creating tasks, the input is:

  • not cleared when clicking Cancel
  • cleared when clicking on the X or outside the modal

I would propose that the input field is always cleared after the tasks where created, but never cleared when canceling the task creation.

@raimund-schluessler
Copy link
Member

@jancborchardt Could you please add @t-h-e to nextcloud/tasks?

@jancborchardt Ping 🙂

@t-h-e t-h-e force-pushed the feature/bulk-task-creation branch from fd24801 to 55438da Compare August 28, 2023 19:11
@t-h-e
Copy link
Contributor Author

t-h-e commented Aug 28, 2023

I forgot a ! 🙈
See 55438da

@t-h-e
Copy link
Contributor Author

t-h-e commented Aug 28, 2023

I would propose that the input field is always cleared after the tasks where created, but never cleared when canceling the task creation.

Note that Firefox and Chrome behave differently. In Firefox it behaves now as you described. In Chrome, the pasted text is never placed in the input field.

EDIT: I have tried to change @paste.stop just to @paste, but that did not change the behaviour in either browser. If I change @paste.stop to @paste.stop.prevent, both browsers behave the same way. They then do not place the pasted text in the input. I actually prefer the Firefox behaviour that the text is in the input field. Which is nice, if the user did not intend to create multiple tasks.

@raimund-schluessler
Copy link
Member

It works well now, I would say we can merge it.

Note that Firefox and Chrome behave differently. In Firefox it behaves now as you described. In Chrome, the pasted text is never placed in the input field.

We might be able to fix this by explicitly setting the input field value to the pasted string after canceling.

@raimund-schluessler raimund-schluessler merged commit 55741e6 into nextcloud:master Aug 29, 2023
15 of 17 checks passed
@t-h-e t-h-e deleted the feature/bulk-task-creation branch August 30, 2023 05:46
@raimund-schluessler raimund-schluessler linked an issue Sep 19, 2023 that may be closed by this pull request
@brahimjarallah
Copy link

Here is an example: BatchTaskCreation BatchTaskCreation

why this feature doesn't work for me in nextcloud 27 ?

@raimund-schluessler
Copy link
Member

Because, as I wrote in the issue you created, and as you can see in the milestone, it is unreleased. It will be released with v0.16.0.

@RayBB
Copy link
Contributor

RayBB commented May 13, 2024

@t-h-e thanks for your hard work on this. I'm so happy to see it finally released :)

@jancborchardt
Copy link
Member

@raimund-schluessler @t-h-e sorry for missing the ping – @t-h-e you are added to the Nextcloud org and the Tasks contributors now. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adding a list of tasks at once [Feature Request] Add multiple tasks at once (bulk / batch)
5 participants