Open cnotv opened 1 year ago
Whatever we design here needs to be documented in Storybook so we ensure we have a consistent modal experience.
As outcome of the conversation:
Basic requirement for the issue is:
Another point which needs to be addressed, some modals allow HTML and some others not. By default for i18n we often use markup in it.
@gaktive at the current state we keep creating new modal styles, e.g. inactive modal, so I'm adding more take aways.
Design will be reviewed as part of the code refactoring process since we do not have a defined one and is complex for the designer to understand the current state.
One of the conditions of moving to Vue 3 is tied to requiring a new modal component -- https://github.com/rancher/dashboard/issues/9537
However, we should wait to work on that once we standardize what the modals should look like so we have an easier port. We should discuss this soon so we can get off Vue 2.
@gaktive this issues is on triage since long, so we omit the redesign and we'll stick to just ask how to align the buttons and that's it.
A full redesign discussion can be done later after we'll publish it in the style-guide.
@richard-cox since we don't want to get stuck with this issue and we rather want to find a solution, the final goal will also be to don't actually change these 50+ use cases of this.$modal(componentName)
There's a risk here of breaking extensions that consume these modals, so care needs to be taken since Epinio, Rancher Desktop, Opni, Kubewarden, etc. depend on these.
Key target: use GenericPrompt
as the standard pattern to use (i.e, buttons in the bottom right).
As part of this work, we need to look at all the modals since it sounds like by digging into this, you almost start.
@cnotv & @richard-cox to provide input.
Added notes from the remarks of @richard-cox. As I mentioned, it's impossible to foresee the outputted markup and styling by just reading the code, so it would require to actually implement an initial modal.
If we want to simplify in steps, we may starts by creating an actual component without have an actual use, then create separated migrations in chunks, although this will have to turn into an epic.
@cnotv there were some wires crossed there.
this.$modal
) and convert all the above cases to use itthis.$modal
)
- Given the above it feels like we need to understand how all modals are used, then understand the impact of the required changes (it may be further reaching and harder to do than just fixing the usages of
this.$modal
)
Technical implementation of the modal has been already described in the issue under Two different patterns adopted
and used in the code as displayed in the lists Existence of several modals components
.
Two different patterns adopted
covers the same underlying modal. GenericPrompt
referenced by actions is just a component that's shown inside of the PromptModal
referenced in markup.
Would you be able to confirm
My question's regarding the scope of this ticket rather than how a new modal might look. Is it to either...?
- Create a new root modal (containing the single this.$modal) and convert all the above cases to use it
- Convert the custom locations to use the generic components
- Another approach
The idea is to have a common layout, which can be used later, a single component, which allows the 2 different approaches to be requested and a way to override the default layout. There should be a common ground for all of them and provide all the possible solutions: callback, async, etc.
The technical details are obviously something which is ongoing during development. There will be a Storybook for the component and layout, plus unit tests to verify the functionalities.
Description
Create a single modal component with slots to extend current functionalities.
As outcome we want:
this.$modal(componentName)
functionNotes
A second round research to identify all of the cases is still required! Example of cases which may still cause issues:
Context
This issues presents different challenges.
Style inconsistencies between the modals
Examples:
The standard we're initially looking at with buttons in the bottom right:
GenericPrompt
We have these other patterns, to give context about what variances we have and what we need to move from:
AddonConfigConfirmationDialog
PromptRemove
Existence of several modals components
Code-wise we have several components without a common base and sometimes in other paths:
./shell/components
Any path but found with
this.$modal
./shell/dialog
Two different patterns adopted
We currently request modals in 2 different flavors: as action, with the same modal and as markup, with custom versions.
Action
In some cases the modal are requested with an action as in
GenericPrompt
, e.g.:PROS
Markup
In other cases the modals/prompts are placed directly in the markup several time 🤔 (there's more than these 3 in the screenshot)
PROS
default
andhome
)