zio-zmx
zio-zmx copied to clipboard
Define base classes for config dialogs
Picking this up from the ZMX channel.
While we are prototyping the first config dialogues, we should spend some time to create a proper datastructure / handler for config dialogues in general.
We have now introduced Command
s to model the manipulation of the applications state, for example we have the
AddDiagramor the
UpdateDiagram` command, both of which modify the diagrams within the application state. We have already changed the application, so that the displayed diagrams are taken from the config and the configurable elements within a single diagram view are populated from the config as well.
Now we would like a Configure...
button within the diagram view, which
- would pop up a dialogue displaying the current values of all configurable elements for that view
- let´s the user edit the values
- if the user submits the changes creates an
UpdateConfig
command and passes it to the application´s command handler - The command handler updates the application state and the laminar magic will update the UI for us
More generally, whenever we display a configurable view, we want a Configure...
button. The config should be modelled as a case class [T]
, so the dialogue could be viewed as a function T => T
On top of that, a modification should generate one or more commands, so we could model that with T => Chunk[Command]
In other words, if we define a ModalDialogue[T]
we can implement the logic how the dialogue is overlayed over the UI, the dataflow and just leave open the concrete implementation of the form and the mapping to the commands.
That would give us the same user experience for all dialogues and a single place to change the behavior of the dialogues in general.
Groundwork is done in #347, needs some more polishing