Bug 37812 - Adjust Vue modals for Bootstrap 5
Summary: Adjust Vue modals for Bootstrap 5
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords: rel_24_11_candidate, RM_priority
Depends on: 35402
Blocks: 37939
  Show dependency treegraph
 
Reported: 2024-09-03 07:15 UTC by Jonathan Druart
Modified: 2024-09-23 09:58 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the display of the dialog boxes (Vue modals) for the ERM and preservation modules. (This is related to the OPAC and staff interface Bootstrap 5 upgrade in Koha 24.11.)
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 37812: Try to fix modal in the Preservation module (2.53 KB, patch)
2024-09-03 07:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 37812: Adjust modals from the Preservation module - bootstrap5 (18.24 KB, patch)
2024-09-10 14:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 37812: Adjust Dialog.vue component (7.54 KB, patch)
2024-09-10 14:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 37812: Prevent "underflow" when using comboboxes in bootstrap modals (1.93 KB, patch)
2024-09-17 11:03 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 37812: Improve consistency of modal styling in Dialog.vue (2.72 KB, patch)
2024-09-17 11:03 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 37812: Prevent non-functional close buttons by using vue event handlers (2.09 KB, patch)
2024-09-17 13:30 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 37812: Prevent initialisation failure by using modal methods, not plain show, hide (2.41 KB, patch)
2024-09-17 18:08 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 37812: Fix a modal in the ERM module (4.50 KB, patch)
2024-09-18 07:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 37812: Adjust modals from the Preservation module - bootstrap5 (18.29 KB, patch)
2024-09-18 21:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 37812: Adjust Dialog.vue component (7.59 KB, patch)
2024-09-18 21:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 37812: Prevent "underflow" when using comboboxes in bootstrap modals (1.98 KB, patch)
2024-09-18 21:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 37812: Improve consistency of modal styling in Dialog.vue (2.77 KB, patch)
2024-09-18 21:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 37812: Prevent non-functional close buttons by using vue event handlers (2.14 KB, patch)
2024-09-18 21:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 37812: Prevent initialisation failure by using modal methods, not plain show, hide (2.45 KB, patch)
2024-09-18 21:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 37812: Fix a modal in the ERM module (4.55 KB, patch)
2024-09-18 21:07 UTC, David Nind
Details | Diff | Splinter Review
Screenshots of dialog boxes for the preservation and ERM modules - before and after (272.67 KB, application/pdf)
2024-09-18 21:10 UTC, David Nind
Details
Bug 37812: Adjust modals from the Preservation module - bootstrap5 (18.35 KB, patch)
2024-09-19 06:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37812: Adjust Dialog.vue component (7.65 KB, patch)
2024-09-19 06:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37812: Prevent "underflow" when using comboboxes in bootstrap modals (2.04 KB, patch)
2024-09-19 06:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37812: Improve consistency of modal styling in Dialog.vue (2.83 KB, patch)
2024-09-19 06:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37812: Prevent non-functional close buttons by using vue event handlers (2.21 KB, patch)
2024-09-19 06:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37812: Prevent initialisation failure by using modal methods, not plain show, hide (2.52 KB, patch)
2024-09-19 06:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37812: Fix a modal in the ERM module (4.61 KB, patch)
2024-09-19 06:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37812: (QA follow-up) Prevent lots of cypress test failures by reinserting 'confirmation' class on modal header (1.10 KB, patch)
2024-09-19 13:41 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 37812: (QA follow-up) Prevent cypress test failure by adjusting selector in DataProviders_spec.ts (1.00 KB, patch)
2024-09-19 15:19 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 37812: (QA follow-up) Prevent cypress test failures by correcting modal selector, removing ambiguity of contains calls, replace by get with respective ids (3.62 KB, patch)
2024-09-19 15:19 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 37812: (QA follow-up) Add watchers for warning and confirmation prop and initialise modals with bootstrap methods on changes in Dialog.vue (4.86 KB, patch)
2024-09-19 17:07 UTC, Paul Derscheid
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2024-09-03 07:15:01 UTC
Modals in the Vue components (ERM, Preservation at least) are not displayed nicely.

From bug 37733 comment 0

"""
2. "Add to waiting list" modal is not centered

http://localhost:8081/cgi-bin/koha/preservation/waiting-list 

https://snipboard.io/mIBYkj.jpg

3. Confirmation box "Are you sure you want to remove this item" is not centered correctly

https://snipboard.io/ZgJFGC.jpg
"""
Comment 1 Jonathan Druart 2024-09-03 07:17:44 UTC
Created attachment 170956 [details] [review]
Bug 37812: Try to fix modal in the Preservation module

We certainly need more as ERM module also use modals. And the Dialog
component seems to have more elements affected.
Comment 2 Martin Renvoize (ashimema) 2024-09-03 09:06:52 UTC
I also started converting some from dialog to actual modal in Bug 37605 - Why do the vue apps use 'dialog' in place of modals?
Comment 3 Jonathan Druart 2024-09-10 14:47:11 UTC
Created attachment 171252 [details] [review]
Bug 37812: Adjust modals from the Preservation module - bootstrap5
Comment 4 Jonathan Druart 2024-09-10 14:47:13 UTC
Created attachment 171253 [details] [review]
Bug 37812: Adjust Dialog.vue component
Comment 5 Jonathan Druart 2024-09-10 14:49:50 UTC
This is how we should fix it IMO.

However there are still quite a lot of work to do.

https://snipboard.io/TJ9zek.jpg => OK
https://snipboard.io/MQHoCt.jpg => Dropdown list's options are hidden behind the modal's footer
https://snipboard.io/5ru41B.jpg => Could be better styled

Do we want to go with toasts? (it's not introduced in Koha yet so I don't know if it's a good idea).

There are also some "close"/"x" buttons that does not close/hide the modal. However the code is similar with other places where it is working... ?

For discussion, please help!
Comment 6 Jonathan Druart 2024-09-10 14:50:57 UTC
And I forgot this one: https://snipboard.io/rY90KF.jpg
Comment 7 Jonathan Druart 2024-09-10 14:51:22 UTC
This must be part of 24.11. At least the preservation module is unusable.
Comment 8 Jonathan Druart 2024-09-17 09:16:45 UTC
(In reply to Jonathan Druart from comment #5)
> Do we want to go with toasts? (it's not introduced in Koha yet so I don't
> know if it's a good idea).

Moved the discussion to its own bug, see bug 37939.
Comment 9 Paul Derscheid 2024-09-17 09:55:31 UTC
How can I trigger this modal?
> https://snipboard.io/MQHoCt.jpg => Dropdown list's options are hidden behind the modal's footer
Comment 10 Paul Derscheid 2024-09-17 11:03:15 UTC Comment hidden (obsolete)
Comment 11 Paul Derscheid 2024-09-17 11:03:18 UTC Comment hidden (obsolete)
Comment 12 Paul Derscheid 2024-09-17 13:30:56 UTC Comment hidden (obsolete)
Comment 13 Jonathan Druart 2024-09-17 14:31:06 UTC
(In reply to Paul Derscheid from comment #12)
> Created attachment 171625 [details] [review] [review]
> Bug 37812: Prevent non-functional close buttons by using vue event handlers

Can you explain why some are working and others not?
Comment 14 Paul Derscheid 2024-09-17 15:03:51 UTC
My suspicion that this has never worked is growing.

I just rebuilt webpack using the old webpack config and without the last patch applied it doesn't work as expected either.

I think what's happening is the following. Where the modals are in use they always hinge on a variable being defined (checked via v-if), if that variable is altered after an API call, the modal closes automatically.

I need to look at more cases, so take this w/ a grain a salt.
Comment 15 Paul Derscheid 2024-09-17 18:08:10 UTC Comment hidden (obsolete)
Comment 16 Paul Derscheid 2024-09-17 18:11:08 UTC
You were right joubu, it's not what I said in comment #14.

It's so easy to miss and I kept looking in the wrong place.

The simple reason that this failed in TrainsShow.vue was that the modal needs to be properly initialised by either data-bs-toggle="modal" or $(<id>).modal('show'), not plain $(<id>).show().

I finally saw the issue after I noticed that the backdrop was missing which screamed init failure.
Comment 17 Jonathan Druart 2024-09-18 04:27:30 UTC
Great, thanks a lot, Paul. Everything is working nicely now!

The only thing I noticed it that the "warning" Dialogs do not close when clicking outside of the dialog. Not blocker ofc.
Comment 18 Paul Derscheid 2024-09-18 07:19:36 UTC
Strange, I'll take a look at that in a bit.
Comment 19 Jonathan Druart 2024-09-18 07:23:17 UTC Comment hidden (obsolete)
Comment 20 Jonathan Druart 2024-09-18 07:23:38 UTC
I think we are good for now.
Comment 21 David Nind 2024-09-18 21:07:12 UTC
Created attachment 171690 [details] [review]
Bug 37812: Adjust modals from the Preservation module - bootstrap5

Signed-off-by: David Nind <david@davidnind.com>
Comment 22 David Nind 2024-09-18 21:07:15 UTC
Created attachment 171691 [details] [review]
Bug 37812: Adjust Dialog.vue component

Signed-off-by: David Nind <david@davidnind.com>
Comment 23 David Nind 2024-09-18 21:07:18 UTC
Created attachment 171692 [details] [review]
Bug 37812: Prevent "underflow" when using comboboxes in bootstrap modals

Signed-off-by: David Nind <david@davidnind.com>
Comment 24 David Nind 2024-09-18 21:07:21 UTC
Created attachment 171693 [details] [review]
Bug 37812: Improve consistency of modal styling in Dialog.vue

- Use modal-header for content, modal-footer for acknowledgement in alert type modal.
- Conditionally render modal-body if message or inputs available.
- Use modal footer for interactions and hide top border if body wasn't rendered.

Signed-off-by: David Nind <david@davidnind.com>
Comment 25 David Nind 2024-09-18 21:07:24 UTC
Created attachment 171694 [details] [review]
Bug 37812: Prevent non-functional close buttons by using vue event handlers

Signed-off-by: David Nind <david@davidnind.com>
Comment 26 David Nind 2024-09-18 21:07:27 UTC
Created attachment 171695 [details] [review]
Bug 37812: Prevent initialisation failure by using modal methods, not plain show, hide

Signed-off-by: David Nind <david@davidnind.com>
Comment 27 David Nind 2024-09-18 21:07:30 UTC
Created attachment 171696 [details] [review]
Bug 37812: Fix a modal in the ERM module

Signed-off-by: David Nind <david@davidnind.com>
Comment 28 David Nind 2024-09-18 21:10:18 UTC
Created attachment 171697 [details]
Screenshots of dialog boxes for the preservation and ERM modules - before and after

Testing notes using KTD:

1. Enable the ERM and preservation modules
   . ERMModule = Enable
   . PreservationModule = Enable
2. Set up the preservation module for testing:
   2.1 Go to Preservation > Settings.
   2.2 For general settings:
       - Status for item added to waiting list: Not for loan
   2.3 For Processings:
       - Add three processing steps called Step 1, Step 2, and Step 3:
         . Add new processing
         . Processing name: name of the step (Step 1, Step 2, and Step 3)
         . Submit
   2.4 Add some items to the waiting list:
       - Waiting list > Add to waiting list
       - Use these barcodes: 39999000011418, 39999000000559, 39999000006155
   2.5 Create a new train:
       - Trains > New train
       - Name: Train 1
       - Description: Description
       - Default processing: Step 1
   2.6 Add an item to a train - from the waiting list:
       - Waiting list > Add to waiting list
       - Immediatly after adding to the waiting list, select Add last 1 items to a train (unfer the "1 new items added." message)
       - Select a train and click Save
3. Set up the ERM module for testing:
   3.1 Add a new agreement (Agreements > New agreement > add some information for the required fields)
   3.2 Add a new license (Licenses > New license > add some information for the required fields)
   3.3 Add a new package (eHoldings > Local > Packages > New package > add some information for the required fields)
   3.4 Add a new title (eHoldings > Local > Titles > New title > add some information for the required fields)
   3.5 Add a new data provider (eUsage > Data providers > New data provider > add some information for the required fields)
   3.6 Create a report (eUsage > Reports > select the create report tab > add some information for the required fields > enter a report name and save the report)
4. Check these examples and note the display issues for the preservation module (see the before and after screenshots attachment to see the differences):
   4.1 Delete a train (Trains > Delete (from the actions column))
   4.2 Add a new item to a train – not in the waiting list (Trains > Add items (from the actions column) > enter an invalid barcode such as 12345)
   4.3 Remove an item from a train (Trains > select a train from the list of trains > Items > press the delete icon for an item)
   4.4 Add items to the waiting list (Waiting list > Add to waiting list)
   4.5 Remove an item from the waiting list (Waiting list > Remove (from the actions column))
   4.6 Remove a processing step (Settings > Processings > select Remove this processing for a step)
5. Check these examples and note the display issues for the ERM module (see the before and after screenshots attachment to see the differences):
   5.1 Delete an agreement
   5.2 Delete a license
   5.3 Delete a package
   5.4 Delete a title
   5.5 Delete a data provider
   5.6 Run a saved report
6. Apply the patches.
7. Rebuild the modules: yarn build
8. Restart everything: restart_all
9. Check the items in steps 4 and5, these should now display as they should and work as expected (see the before and after screenshots attachment).
Comment 29 Martin Renvoize (ashimema) 2024-09-19 06:40:27 UTC
Created attachment 171702 [details] [review]
Bug 37812: Adjust modals from the Preservation module - bootstrap5

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 30 Martin Renvoize (ashimema) 2024-09-19 06:40:30 UTC
Created attachment 171703 [details] [review]
Bug 37812: Adjust Dialog.vue component

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 31 Martin Renvoize (ashimema) 2024-09-19 06:40:33 UTC
Created attachment 171704 [details] [review]
Bug 37812: Prevent "underflow" when using comboboxes in bootstrap modals

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 32 Martin Renvoize (ashimema) 2024-09-19 06:40:35 UTC
Created attachment 171705 [details] [review]
Bug 37812: Improve consistency of modal styling in Dialog.vue

- Use modal-header for content, modal-footer for acknowledgement in alert type modal.
- Conditionally render modal-body if message or inputs available.
- Use modal footer for interactions and hide top border if body wasn't rendered.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 33 Martin Renvoize (ashimema) 2024-09-19 06:40:38 UTC
Created attachment 171706 [details] [review]
Bug 37812: Prevent non-functional close buttons by using vue event handlers

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 34 Martin Renvoize (ashimema) 2024-09-19 06:40:41 UTC
Created attachment 171707 [details] [review]
Bug 37812: Prevent initialisation failure by using modal methods, not plain show, hide

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 35 Martin Renvoize (ashimema) 2024-09-19 06:40:43 UTC
Created attachment 171708 [details] [review]
Bug 37812: Fix a modal in the ERM module

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 36 Martin Renvoize (ashimema) 2024-09-19 06:42:21 UTC
Great teamwork here, thanks to all involved.

Passing QA
Comment 37 Jonathan Druart 2024-09-19 06:53:56 UTC
(In reply to Paul Derscheid from comment #18)
> Strange, I'll take a look at that in a bit.

Maybe we should wait for you to have a look before pushing this one.
Comment 38 Paul Derscheid 2024-09-19 10:49:42 UTC
Just FYI, I know what the problem is with comment #18. Here it's the same thing as before. The modal is not properly initialised via the modal methods.

I'm currently working on this, but I get a lot of cypress test failures, that I'm trying to fix first.
Comment 39 Martin Renvoize (ashimema) 2024-09-19 11:51:27 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 40 Paul Derscheid 2024-09-19 12:46:50 UTC
Ah, that shouldn't have been pushed yet, will cause some cypress tests to fail because they were not adjusted after one of my patches.

That's what I meant by comment #38.
Comment 41 Paul Derscheid 2024-09-19 13:41:53 UTC
Created attachment 171758 [details] [review]
Bug 37812: (QA follow-up) Prevent lots of cypress test failures by reinserting 'confirmation' class on modal header
Comment 42 Paul Derscheid 2024-09-19 13:42:15 UTC
That fixes 7/11.

4 to go.
Comment 43 Paul Derscheid 2024-09-19 15:19:54 UTC
Created attachment 171780 [details] [review]
Bug 37812: (QA follow-up) Prevent cypress test failure by adjusting selector in DataProviders_spec.ts
Comment 44 Paul Derscheid 2024-09-19 15:19:56 UTC
Created attachment 171781 [details] [review]
Bug 37812: (QA follow-up) Prevent cypress test failures by correcting modal selector, removing ambiguity of contains calls, replace by get with respective ids
Comment 45 Paul Derscheid 2024-09-19 15:20:46 UTC
That's all cypress tests fixed. But there's still one thing to do, to initialise the modal in Dialog.vue with the bootstrap methods.
Comment 46 Paul Derscheid 2024-09-19 17:07:34 UTC
Created attachment 171786 [details] [review]
Bug 37812: (QA follow-up) Add watchers for warning and confirmation prop and initialise modals with bootstrap methods on changes in Dialog.vue

- Use more targeted selectors in cypress tests Trains.ts, WaitingList.ts.
- Await result of accept_callback, then close modal.
Comment 47 Paul Derscheid 2024-09-19 17:08:39 UTC
That was the last one! Ready to push (after a sanity check, of course).

All cypress tests still pass locally for me.
Comment 48 Martin Renvoize (ashimema) 2024-09-20 08:17:06 UTC
Follow-ups pushed, thanks Paul.
Comment 49 Jonathan Druart 2024-09-23 09:52:42 UTC
Owen, Martin, I am wondering if the change "Submit" => "Save" for modals is correct. For instance we have "Add items to waiting list" and a "Save" button. Wasn't "Submit" more correct?
Comment 50 Jonathan Druart 2024-09-23 09:58:42 UTC
(In reply to Jonathan Druart from comment #49)
> Owen, Martin, I am wondering if the change "Submit" => "Save" for modals is
> correct. For instance we have "Add items to waiting list" and a "Save"
> button. Wasn't "Submit" more correct?

So... the edit train form has "Submit" (I would have expected "Save"). Went to the "normal Koha" and found that adding a library has "Submit" and editing a bib record has "Save". I guess at this point we just don't care, right? :D