mirror of
https://github.com/holos-run/holos.git
synced 2026-03-19 16:54:58 +00:00
This patch refactors the API following the [API Best Practices][api] documentation. The UpdatePlatform method is modeled after a mutating operation described [by Netflix][nflx] instead of using a REST resource representation. This makes it much easier to iterate over the fields that need to be updated as the PlatformUpdateOperation is a flat data structure while a Platform resource may have nested fields. Nested fields are more complicated and less clear to handle with a FieldMask. This patch also adds a snapckbar message on save. Previously, the save button didn't give any indication of success or failure. This patch fixes the problem by adding a snackbar message that pop up at the bottom of the screen nicely. When the snackbar message is dismissed or times out the save button is re-enabled. [api]: https://protobuf.dev/programming-guides/api/ [nflx]: https://netflixtechblog.com/practical-api-design-at-netflix-part-2-protobuf-fieldmask-for-mutation-operations-2e75e1d230e4 Examples: FieldMask for ListPlatforms ``` grpcurl -H "x-oidc-id-token: $(holos token)" -d @ ${HOLOS_SERVER##*/} holos.platform.v1alpha1.PlatformService.ListPlatforms <<EOF { "org_id": "018f36fb-e3f7-7f7f-a1c5-c85fb735d215", "field_mask": { "paths": ["id","name"] } } EOF ``` ```json { "platforms": [ { "id": "018f36fb-e3ff-7f7f-a5d1-7ca2bf499e94", "name": "bare" }, { "id": "018f6b06-9e57-7223-91a9-784e145d998c", "name": "gary" }, { "id": "018f6b06-9e53-7223-8ae1-1ad53d46b158", "name": "jeff" }, { "id": "018f6b06-9e5b-7223-8b8b-ea62618e8200", "name": "nate" } ] } ``` Closes: #171
9 lines
126 B
JSON
9 lines
126 B
JSON
{
|
|
"update_mask": {
|
|
"paths": ["form"]
|
|
},
|
|
"update": {
|
|
"platform_id": "018f36fb-e3ff-7f7f-a5d1-7ca2bf499e94"
|
|
}
|
|
}
|