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

Way of having info modals for table rows #380

Open
jotaviobiondo opened this issue Aug 28, 2022 · 5 comments
Open

Way of having info modals for table rows #380

jotaviobiondo opened this issue Aug 28, 2022 · 5 comments

Comments

@jotaviobiondo
Copy link
Contributor

Currently some of the default pages, like ETS, Process, etc. have clickable rows that shows a modal with more detailed information. Right now, as far as I can see in the code there's no way of having this for custom pages.

There are plans for having such feature?

I was thinking that the PageBuilder could have a callback for defining some configuration for showing a modal. Maybe having 2 ways of configuring it:

  1. simple way with minimal config that just shows the complete row data in a tabular way (like in the ETS info modal)
  2. more configurable way for building a custom modal, like we have for rendering the page

I would be happy to help with an PR, but probably need to discuss the API for this, since its a big change 😄

@josevalim
Copy link
Member

The modals that we have on the other pages are generic and meant to be triggered from any other page. If your goal is to support a modal only within a single page, then it should be much easier and I would probably apply some hardcoded logic to that. Something like ?modal=current and that invokes an event or a callback on the page. :)

@jotaviobiondo
Copy link
Contributor Author

Hmm, to do that and be able to conditionally render the modal, it would require to create a custom component to be rendered in the PageBuilder.render_page/1, right?

If thats so, it should probably work fine :)

@josevalim
Copy link
Member

I am not quite sure because I haven't used the dashboard for a while. :) So feel free to give whatever comes to your mind a try :)

@jotaviobiondo
Copy link
Contributor Author

Hahah got it! Thanks for the help! :)

@alexcastano
Copy link
Member

After working on #401, I had some ideas related to this issue. We can define a Modal behaviour to be implemented for the current modals, but also for external modals. Modals are based on a string decoding of the param info. If we have a list of Modal we can try to decode until we find one which can handle the current format.

External modals can be passed as an option in the router. Another option could be a Protocol, but not sure if it is the best option here.

@josevalim if you think it is worth the idea I will give it a try, or you have a better suggestion :)

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

No branches or pull requests

3 participants