Open mohsin-r opened 2 months ago
Ideas from a rarely-Vue and non-RESPECT dev.
That's a LOT of files. Is it possible to just have a generic "config-ui" template that can be passed some sort of metadata definition object that tells it how to assemble itself?
I had this idea in the beginning, where you'd pass in your schema into the component and it would auto build out the UI. Then the app would work even if we revamped the schema for whatever reason. Its difficult to say whether this is worth a shot, mainly because there are a ton of small edge cases that are coded in into the individual templates. You'd need a bunch of ifs for specific cases. For example, for every object you just need inputs for its fields, but then for extents, you also need the extent picker and linking between the map and config extent. Similarly, how would a generic editor code in an autolegend where you have a relationship between the layer and legend configs? We also have some lists that get converted to object key-value pairs, and so on. So the feeling I have is RAMP is too complex to have a generic nested object parsing UI template. This refactor attempts to take a middle ground, where boilerplate at the input level is abstracted out but we still parse the objects individually, if that makes sense.
Does Respect Editor do anything similar to what your proposing? Or alternately can this approach be applied to the Respect Editor? Thought here is we should strive to have a unified development approach to both editors
The feel of Respect is very different to this. The templates for each type of editor (map, image, slideshow, chart, etc.) are very different and there isn't really any duplicate/boilerplate code. Additionally, the RAMP schema is far more complex than the Storylines schema (and hence has a lot more inputs). The other thing is RESPECT is meant to be a standalone app, whereas this works as something that can be both standalone and embedded into something else. All these factors mean that unified development approach may not make sense. However, I agree that we should have this editor and the Highchart Editor be similar in their development approach.
A lot of the above thoughts are half-baked, so feel free to retort if anything is nonsense.
RAMP4 Config Editor: Input and i18n refactor
What is this?
The original code for the config editor was written in a rush. As such, the inputs have a lot of duplicate code. Now that we are working towards switching all inputs from hardcoded English to
i18n
, this seems like a ripe opportunity to refactor input code and make it cleaner. This involves creating our own custominput.vue
andcheckbox.vue
which has the code for handling all input types, the header, and the small information icon. Then, each input simply calls these components. Therefore, the number of lines of code for each input goes from approximately 4-5 -> 1-2. Another aspect of this refactor would be to update allv-model
code to the new recommendeddefineModel()
method.Progress
This will track which files have completed the switch to
i18n
and custom input components.