-
Notifications
You must be signed in to change notification settings - Fork 705
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
Design packaging API for configurable UI components #4365
Comments
I've been giving this a thought, that I'm dumping here. Maybe it is material to discuss in this document? 😃 TLDREach plugin can expose a new endpoint named Ubiquitous language
Features
Drawbacks
Let's see a detailed example step by step. Creating Carvel package install
Another example for Helm's {
"operations": {
"HelmRepositoriesService.AddPackageRepository": {
"type": "object",
"properties": {
"customDetail.filterRule": {
"type": "object",
"description": "Filter rule",
"properties": {
"jq": {
"type": "string",
"description": "Whether there is view state information to use"
},
"variables": {
"type": "object",
"additionalProperties": {"type": "string"}
}
}
},
"customDetail.ociRepositories": {
"type": "array",
"description": "OCI repositories",
"items": {
"type": "string"
}
},
"customDetail.dockerRegistrySecrets": {
"type": "array",
"description": "Docker registry secrets",
"items": {
"type": "string"
},
"binding": "context.NamespaceSecrets"
}
}
}
}
} I haven't added too much information about the "why" of some stuff here, but this is just a proposal, food for discussion. |
Thanks for taking a look at this Rafa! It'll be great to finally start working on a solution to this problem. A couple of questions:
Personally, I'd create a separate document: I know this is related to the new API, but that existing doc is hard to navigate now - it may be best to leave that doc as the original packaging/repositories/resources APIs, and suggest new work in separate docs. See what you think, fine either way. |
+1 to create a separate document to discuss it. |
Thanks for the answer Michael!
Please notice that in my examples I don't mention where the definitions come from, just the end result returned by the endpoint. There are three pieces of data (per field) that we don't have in the
Maybe developers of a certain plugin should only define somewhere those three things and getting the rest from the
I've worked with many CMSs, and been before in scenarios where just some customization wants to be made at certain points of the layout. In those cases, there are many approaches possible, but I see two as the more feasible:
Otherwise we might need to return the specification for all fields (including the default ones), and in case of repeating (or diverting from default if a field is modified) it might be error prone? Anyway, I will add the proposal to a new design document as starting point for discussion with all stakeholders. |
Sounds great. Thanks Rafa! |
I have been involved in several frameworks for forms and UIs in previous projects, and a static schema-based approach never fits the bill and is consistently a work in progress. My preference would be to just open the content to plugins to do whatever they need (hopefully following best practices regarding styling etc...). if we go with a schema approach, there are a few common issues: conditional fields, cross-field dependencies, bindings. A solution that we have implemented in a previous project with Greg is similar to schema-driven but dynamically. That is instead of returning a schema just once, the UI interacts with a backend. For simple custom UIs, this solution is basically the same as the schema-driven solution proposed (schema is fetched only once). |
otherwise, have you looked at this: https://jsonforms.io/ ? |
Thanks for sharing your previous experience Dimitri, really helpful to hear from someone who's been through that process a few times. Definitely looks like a field that people have investigated pretty thoroughly - I immediately like the separate schema and ui-schema of jsonforms. Look forward to hearing what you find with your investigation Rafa. |
FTR: we did an initial implementation of our basic form using jsonforms: #3526 (comment) |
We don't need a fully fledged CMS or UI framework. Initially it would suffice with customizing existing forms by changing, adding and hiding fields. This is, customizing the core functionality of Kubeapps. In a later phase we could tackle extending the UI with more bells and whistles.
JSON schema seems a good fit for our case in the sense that could cover many of those situations.
I'm not a big fan of having backend plugins tightly coupled with the UI. For now we only need some changes to existing forms, and depending data will not be that dynamic (fixed enums, service accounts, secrets?). It should be enough with a plugin exposing the incremental schema at one point, and the UI details on another one.
The above is just an example to show the idea, but it could be that we have an initial, complete huge form with conditions e.g. depending on the field "type" (Helm, Kapp or Flux).
Yep, I've been investigating it together with react-jsonschema-form. |
Design document available here. |
I've requested access :P (My vmware google account apparently doesn't have access) |
Document has now public permissions for commenting 😄 |
Anything pending to close this issue? |
Yes, saw the issue still opened this morning. |
Description:
Moving discussion from Antonio's comment on 4346. Since inception, we've planned to provide, eventually, a way for packaging plugins to provide custom UI fields for forms such as the create/update installed package, or create/update app repository.
Antonio said:
I think everyone agrees on providing an implementation-agnostic json schema like this (as opposed to embedding react components or something that may work for Kubeapps now, but isn't helpful to other potential clients as Antonio mentions). We just need to ensure features such as dependentRequired meet any needs we have for conditional form fields, as well as support in react-jsonschema for our Kubeapps client etc.
The text was updated successfully, but these errors were encountered: