Add documentation for adding a widget icon#41
Conversation
There was a problem hiding this comment.
Hey Rutger! Thanks a lot for this contribution!
And this API was actually broken recently (during the 1.18 beta phase), as we still didn't had anyone using it (only two internal extensions that were still in beta as well).
The standard changed from snake_case to camelCase, so the new fields are called iframeUrl and iframeIcon. You can find the whole schema in this file of the Cockpit repository.
You can find the discussion about those changes as well as the new features that were added here.
|
Hey @rafaellehmkuhl , Thanks for your answer :). Check, very cool pull request you added, did not know this was in the works. This gives some possibilities for my own extension. Should I also add documentation for the joystick mapping suggestions? |
If you'd like to cover the surrounding feature set, you can document some or all of the undocumented aspects of the external integrations topic :-) |
Feel free to choose how to proceed. If you want to just finish this one with the instructions for the icon and url, which is the basic support, that's fine. If you want to document the whole API, even better! |
|
Thanks for your replies. I will look into covering the whole cockpit_extras.json file. |
…ps to your cockpit_extras endpoint
e0dbbd4 to
4624200
Compare
|
Hey @rafaellehmkuhl , Could you have a look at my recent changes? I have documented the new cockpit_extras API according to the schema you sent me and I used some other pieces of text/information I found in different Blue Robotics repositories. I think it would be nice to have some screenshots of the joystick mapping suggestions, do you have any at hand by chance? |
Super cool @rutger-seascape! That's a really nice start! I took a look and I will try to wrote down the suggestions till friday. Sorry. for the delay. I usually try to do it in the same day but we are kind of in a rush right now with the stable release. And @ES-Alexander is the responsible for the docs, so I'm sure he will have some suggestions as well! |
|
@rutger-seascape I got some spare time and was starting my review but unfortunately there is (again) a Github incident happening right now and I'm not being able to push the comments in the review. Will try again in the next hours. |
ES-Alexander
left a comment
There was a problem hiding this comment.
Agreed that this is a great start - thanks!
I've given some comments on the high level structure and some missing contextualisation.
Given the "no relevant docs" state this is based over, the threshold for this getting approved is basically just "fit the style/intent of the docs, and don't mislead users", so I'm not planning to ask for exhaustive coverage of everything involved (though by the looks of things you've already largely achieved full coverage anyway!) :-)
|
|
||
| The Cockpit-focused endpoint should including a name, version, iframe URL, and an optional URL for | ||
| configuration of each widget: | ||
| #### Configuring cockpit_extras.json |
There was a problem hiding this comment.
This heading is several levels too high to be in this location, but I actually think the problem is the location. There are several examples here that go beyond what normal users would need to know or care about, so I suggest moving this whole section to its own file (e.g. /content/development/external-integrations/index.md, with the images in the same folder), which can then link back to relevant points in this file from each subsection.
This location can then be used to link out to that file, for developers who want to explore the detailed breakdown/examples, without it affecting the standard users.
| You can make your BlueOS Extension interact with different elements within the Blue Robotics software suite by configuring | ||
| the `cockpit_extras.json` file. Keys are typed in `lowerCamelCase`. We recommend to type id values in `kebab-case`. |
There was a problem hiding this comment.
HTTP servers do not need to be from BlueOS Extensions - they could also be served by the computer running Cockpit, for example, or accessed via the internet (for operating conditions where that is viable).
If this gets introduced specifically as an example of making a BlueOS Extension integrate with Cockpit then that's potentially ok, but if it's intended just as a description of the functionality then it will need to be more general about the possible options.
| ``` | ||
|
|
||
| ##### Minimal configuration | ||
| A minimal `cockpit_extras.json` file can be seen below. This file does not add any extra functionality yet. |
There was a problem hiding this comment.
It seems worthwhile describing the key functionalities (e.g. custom iframe widget integrations, custom Actions, and custom joystick button mapping suggestions) before providing an example like this, but that can potentially be at the top of the page.
| ##### Widget configuration | ||
| You can add widgets to Cockpit based on your BlueOS Extension by adding a widget configuration. | ||
|
|
||
| | Attribute | Type | Required | Note | |
There was a problem hiding this comment.
If the table has no notes, it shouldn't include a column for them.
| | `iconUrl` | `string` | no[^1] | | | ||
| | `iframeIcon` | `string` | no[^1] | | |
There was a problem hiding this comment.
| | `iconUrl` | `string` | no[^1] | | | |
| | `iframeIcon` | `string` | no[^1] | | | |
| | `iconUrl` | `string` | one of | | | |
| | `iframeIcon` | `string` | one of | | |
Undecided if this is cleaner than the footnote approach. If you'd prefer to maintain the footnote then the word should still be changed (e.g. to "maybe" or "partial" or similar).
| Each joystick profile tracks its own set of applied and ignored suggestions independently. | ||
|
|
||
| ###### Joystick Mapping Suggestion Group | ||
| [Joystick Mapping Suggestions](#joystick-mapping-suggestion) must be contained in a Joystick Mapping Suggestion Group. This allows you to suggest multiple mappings based on what hardware is mounted for example. |
There was a problem hiding this comment.
| [Joystick Mapping Suggestions](#joystick-mapping-suggestion) must be contained in a Joystick Mapping Suggestion Group. This allows you to suggest multiple mappings based on what hardware is mounted for example. | |
| [Joystick Mapping Suggestions](#joystick-mapping-suggestion) must be contained in a Joystick Mapping Suggestion Group. This allows you to suggest multiple mappings based on what hardware is connected, for example. |
Co-authored-by: ES-Alexander <sandman.esalexander@gmail.com>
|
Hey @rafaellehmkuhl and @ES-Alexander , Thanks for your response, feedback and images!
No problem, it has been wild recently...
I did this and I also added an overview page to the development section but it feels a bit sparse right now, any suggestions? I have tried to incorporate the other comments as well, can you let me know what you think? |
ES-Alexander
left a comment
There was a problem hiding this comment.
Nice improvements, thanks!
it feels a bit sparse right now
Not too concerned about that - we've got to start somewhere, and extra content can always be filled in when there's time and motivation/resourcing to do so.
The development overview can likely take inspiration from the BlueOS-docs one, but I think that's better left for a later PR so we can get these docs in sooner :-)
I have tried to incorporate the other comments as well, can you let me know what you think?
Generally reasonable - nice work :-)
I've just added a few more comments around cohesion and trying to more logically differentiate what a user vs a developer would care about knowing.
| @@ -643,27 +643,7 @@ an endpoint listing the available widgets: | |||
| } | |||
| ``` | |||
|
|
|||
There was a problem hiding this comment.
I think all of this can go in the new development section, with an explanation that "External services can automatically share web interface URLs for Cockpit to turn into IFrame widgets, along with other features."
| +++ | ||
|
|
||
| ## Configuring cockpit_extras.json | ||
| You can make HTTP servers interact with different elements within the Blue Robotics software suite by creating a `/register_service` endpoint, click [here](@/usage/advanced/index.md#automatic-external-iframes) to view it's documentation. This endpoint serves a `cockpit_extras.json` file that will be explained in this section. HTTP servers can be served by [BlueOS Extensions](https://blueos.cloud/docs/stable/development/extensions/), the Cockpit host computer or by the internet (for operating conditions where that is viable). |
There was a problem hiding this comment.
| You can make HTTP servers interact with different elements within the Blue Robotics software suite by creating a `/register_service` endpoint, click [here](@/usage/advanced/index.md#automatic-external-iframes) to view it's documentation. This endpoint serves a `cockpit_extras.json` file that will be explained in this section. HTTP servers can be served by [BlueOS Extensions](https://blueos.cloud/docs/stable/development/extensions/), the Cockpit host computer or by the internet (for operating conditions where that is viable). | |
| ## Informing Cockpit of Features | |
| External applications and services can share a variety of integration features with Cockpit using a HTTP server. | |
| It should include a [`register_service`](https://blueos.cloud/docs/latest/development/extensions/#web-interface-http-server) JSON endpoint, with a path to a Cockpit-focused JSON endpoint, e.g. | |
| `/register_service` | |
| ```json | |
| { | |
| ... | |
| "extras":{ | |
| "cockpit":"/cockpit_extras.json" | |
| } | |
| } | |
| \``` <-- remove the "\", had to add it for the review suggestion to work | |
| This is often relevant for [BlueOS Extensions](https://blueos.cloud/docs/stable/development/extensions/) that need active interaction while the vehicle is being operated, but can also be provided by programs on the Cockpit host computer, or via the internet (for operating conditions where that is viable). |
| | Attribute | Type | Required | Note | | ||
| |-----------------|----------|----------|-------------------------------------------------------------------------------------------| | ||
| | `name` | `string` | yes | | | ||
| | `messageType` | `string` | yes | Click [here](https://github.com/patrickelectric/mavlink-json) to view the allowed types | |
There was a problem hiding this comment.
| | `messageType` | `string` | yes | Click [here](https://github.com/patrickelectric/mavlink-json) to view the allowed types | | |
| | `messageType` | `string` | yes | [Allowed types](https://github.com/patrickelectric/mavlink-json) | |
"Click here" links add text with minimal value - it's preferable to just add links to the the text they apply to :-)
There was a problem hiding this comment.
I agree, I was not sure of how to do it naturally. Your way sounds good.
Co-authored-by: ES-Alexander <sandman.esalexander@gmail.com>
…ection and restructure the paragraph Co-authored-by: ES-Alexander <sandman.esalexander@gmail.com>
…that is now described there Co-authored-by: ES-Alexander <sandman.esalexander@gmail.com>
Ah okay, that sounds good. Thanks again for the kind words and feedback. I have updated the pull request with the requested changes, can you let me know what you think? |


🔎 PREVIEW 🔍
Documents: