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

Add a new dialog class to replace the old one #2858

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sascha-karnatz
Copy link
Contributor

@sascha-karnatz sascha-karnatz commented May 2, 2024

Add a new dialog class with the same signature and the same properties as the old Dialog implementation. The new one is using the shoelace web components and is working with promises to allow the calling method to react to the user input in the dialog.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@sascha-karnatz sascha-karnatz force-pushed the dialog-success-promise branch 4 times, most recently from 4f4c5a8 to 04bebcc Compare May 3, 2024 13:27
app/assets/stylesheets/alchemy/shoelace.scss Outdated Show resolved Hide resolved
app/javascript/alchemy_admin/dialog.js Outdated Show resolved Hide resolved
app/javascript/alchemy_admin/dialog.js Outdated Show resolved Hide resolved
app/javascript/alchemy_admin/dialog.js Outdated Show resolved Hide resolved
app/javascript/alchemy_admin/dialog.js Outdated Show resolved Hide resolved
app/javascript/alchemy_admin/dialog.js Outdated Show resolved Hide resolved
@tvdeyen tvdeyen added this to the 7.2 milestone May 6, 2024
@sascha-karnatz sascha-karnatz changed the title WIP: Add a new dialog class to replace the old one Add a new dialog class to replace the old one May 6, 2024
app/javascript/alchemy_admin/dialog.js Outdated Show resolved Hide resolved
app/javascript/alchemy_admin/dialog.js Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.96%. Comparing base (0133ea7) to head (6e218f2).
Report is 224 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2858   +/-   ##
=======================================
  Coverage   95.96%   95.96%           
=======================================
  Files         232      232           
  Lines        6271     6271           
=======================================
  Hits         6018     6018           
  Misses        253      253           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sascha-karnatz sascha-karnatz marked this pull request as ready for review May 7, 2024 08:00
@sascha-karnatz sascha-karnatz requested a review from a team as a code owner May 7, 2024 08:00
@sascha-karnatz sascha-karnatz force-pushed the dialog-success-promise branch 3 times, most recently from c7e3773 to 9a600f2 Compare May 7, 2024 10:11
@tvdeyen
Copy link
Member

tvdeyen commented May 7, 2024

We need a remote form watcher that handles re-rendering of forms with validation errors

See

watch_remote_forms: ->
form = $('[data-remote="true"]', @dialog_body)
form.bind "ajax:success", (event) =>
xhr = event.detail[2]
content_type = xhr.getResponseHeader('Content-Type')
if content_type.match(/javascript/)
return
else
@dialog_body.html(xhr.responseText)
@init()
return
form.bind "ajax:error", (event, b, c) =>
statusText = event.detail[1]
xhr = event.detail[2]
@show_error(xhr, statusText)
return

dialog validation errors
dialog.validation.errors.not.shown.mp4

@sascha-karnatz sascha-karnatz marked this pull request as draft May 7, 2024 17:55
@sascha-karnatz sascha-karnatz force-pushed the dialog-success-promise branch 2 times, most recently from 8e4f75f to c4413e7 Compare May 13, 2024 16:32
@sascha-karnatz sascha-karnatz force-pushed the dialog-success-promise branch 2 times, most recently from 7a4e1cd to a505fa8 Compare June 27, 2024 12:44
Add a new dialog class with the same signature and the same properties as the old Dialog implementation. The new one is using the shoelace web components and is working with promises to allow the calling method to react to the user input in the dialog.
@sascha-karnatz sascha-karnatz force-pushed the dialog-success-promise branch 2 times, most recently from 98eb7aa to fc9ba6c Compare June 27, 2024 19:52
Try to extract the logic to render the content of the dialog and the error handing into a separate component.
@sascha-karnatz sascha-karnatz modified the milestones: 7.2, 7.3 Jun 27, 2024
Test the dialog class to ensure, that the Dialog is working.
Copy link

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
This PR will be closed in 7 days if no further activity happens.

@github-actions github-actions bot added Stale and removed Stale labels Aug 28, 2024
@tvdeyen tvdeyen modified the milestones: 7.3, 8.0 Sep 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
This PR will be closed in 7 days if no further activity happens.

@github-actions github-actions bot added Stale and removed Stale labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants