Dashiki's on-wiki config pages do sometimes duplicate JSON code. Either different pages duplicate identical or very similar blocks of code, or different sections in the same config page duplicate some code.
An example is annotations: Each metric/graph in all Dashiki dashboards can potentially have its own annotations page. But the same annotation (same event) might affect several metrics in several dashboards or graphs. The way we have it now, we have to write the annotation once for each annotations page. This can be a problem in maintenance, see: T142408
It would be interesting to have a way of "including" or "nesting" config pages in one another. mediawiki-storage is the library that Dashiki uses to grab JSON config pages for metrics, dashboards and annotations configuration. This could be the piece of code that transparently manages this includes/nestings. For example:
{ "someField": { /* A big object */ }, "someOtherField": { /* The same big object (identical) */ } }
Could be rewritten as:
{ "someField": "#import(anotherConfigPage)", "someOtherField": "#import(anotherConfigPage)" }
Things to take into account:
- Nesting imports. mediawiki-storage should detect loops and raise an error.
- It would be awesome if the imports were also easily followable by humans, not only mediawiki-storage. So that as person that is reading/editing a config page with an import, can easily navigate to the imported page.
- Maybe some sort of parameter passing could be interesting? Like: "#import(configPage, param1, param2, ..., paramN)", and in the imported page: "#param1". This might be dreaming too far though...