-
Notifications
You must be signed in to change notification settings - Fork 17
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
Configuration interface for packages #7
Comments
We discussed a couple of options:
|
My vote would be option 2. |
Got any proposals for a schema? Bonus points if there's already tooling around for manipulating it. My two cents would be could we also support YAML please? |
Before diving into this, I think we should make up our minds how we want to interface with the settings. Will it only be for the web configurator or do we also want the UI on the goggles to use the same infrastructure. Regarding format, I think we should decide for one format, I have no hard feelings for either JSON or YAML, I just don't see the need for supporting multiple formats - at least not from the get go. I suggest the following widget to start with:
A settings component would consist of two files, one schema where it is defined which values there are available and one file where the settings are saved to, this should be a simple key/value store. The schema file could also consist of services that need to be restarted once settings have been changed. This could look like so (Example as JSON, but could be anything): {
"settings": {
"key_checkbox": {
"widget": "checkbox"
},
"key_select": {
"widget": "select",
"options": [
{
"key": "key_1",
"value": "value_1"
},
{
"key": "key_2",
"value": "value_2"
}
]
},
"key_range": {
"widget": "range",
"min": 0,
"max": 10,
"step": 1
},
"key_text": {
"widget": "text",
"allowed": "abcdefghij",
"minLength": 0,
"maxLength": 10
},
},
"services": [
"service_1",
"service_2",
]
} settings file: {
"key_checkbox": true,
"key_select": "key_2",
"key_range": 2,
"key_text": "abc"
} |
Structural:
Types (definitely "stretch goals"):
Services should really be units. Script type units should be started rather than restarted. Eg. one can define a config to upload screensaver images and the unit started is a script that converts them to the framebuffer formats and copies them in place. Where should we ask packages to store the definition and the config? Regarding JSON vs YAML: they're interoperable and there's easy tooling to convert between the two. If we must have one, then I prefer YAML for the far superior manual authoring experience. But that's just my personal preference, happy to go with whatever the group decision comes to. |
Having given it another thought in relation to linking to package READMEs, here's my thinking: How about we define a package.yaml schema that includes control metadata, extended metadata (README URL), the dinit unit(s) and configuration definition for the configurator. This package.yaml can be used both by a supplied Makefile that uses it to generate the control file for ipk purposes as well as the yaml itself being included in the control directory so that it can be picked up by the configurator from the installed packages index? Please tell me if I've been writing too many Helm charts lately and have gone mad. |
We can do that, how do we solve the multi lingo issue here? Makes no sense to do this via app translation interface, so each package would need to provide it's own translation files then.
Yeah, we can add arbitrary types later on, I would like to start with a set of bare minimum and go from there.
I am not entirely sure which implications this would have on the configuration interface?
How about:
OK, let's go with YAML - we can add JSON later once we have a solid MVP.
Yeah, that's fine with me. |
Noting a few things during the CLI implementation:
Re multi lingo: I think we can support it, but we can't demand it, because the configurator might get an arbitary number of languages. Same with readme's etc. |
wtfos-package-configuration is mostly done, but a few thoughts came up during implementation:
We could also say that wtfos-package-config needs to know about the things right now in schema.json and any other metadata is a separate concern. Looking for feedback. |
https://github.com/fpv-wtf/wtfos-package-config Version 0.1.0 (not in repo) ipk published. Would appreciate a review. Also I didn't apply any of the changes proposed in the previous post yet. |
To summarize this a little bit:
TODOs:
|
Note: I'd like to get rid of wtfos-package-config altogether. There is not point in attempting to port the validation rules over, as react-jsonschema-form should do the validating by itself. And at that point wtfos-package-config wouldn't do anything except save to a file. We can use the same paths, i.e. /opt/etc/package-config/$package-name/config.json for the output though. And store the schema and json in the same folder. |
Configuration interface on package detail page is now implemented via react-jsonschema-form. |
The UI could offer extended configuration options for packages that have them.
We know already @bri3d needs a way to select the font for msp-osd and @funnel needs a way to switch between PAL/NTSC.
On the other hand we can also expect there to eventually be an interface on the Goggles themselves for this, so I think this needs quite a bit of thought put into it how to actually handle it.
The text was updated successfully, but these errors were encountered: