CleverCloud / clever-components

Collection of Web Components by Clever Cloud
https://www.clever-cloud.com/doc/clever-components/
Apache License 2.0
220 stars 19 forks source link

cc-addon-credentials: use a state API #1108

Open florian-sanders-cc opened 3 months ago

florian-sanders-cc commented 3 months ago

Context

We've recently modified most of our components handling API data to standardize their API.

We did not modify the cc-addon-credentials component at the time because it was being modified to integrate materia-kv and because it's current API design was a little bit trickier to migrate.

The component is given a "type" which corresponds to an "AddonType" and it's also given "credentials" which is an array of different credential types.

Credentials must be given to the component even when it is in loading state (you pass credentials with no values). The component goes into skeleton when credential values are null / undefined.

What is weird about the current design is that there is no relationship between the type and the credentials. This means devs can pass a port credential which will be displayed even for a materia-kv product where it does not make sense.

Should the component maintain the list of credentials to apply for every addon type it can handle?