|
| 1 | +# Dashboard create command |
| 2 | + |
| 3 | +## Overview |
| 4 | +Arduino Cloud CLI should allow users to create a dashboard starting from a cloud template. |
| 5 | + |
| 6 | +The following User story has been taken from the [RFC](https://arduino.atlassian.net/wiki/spaces/FTWEB/pages/2761064740/Arduino+Cloud+CLI). |
| 7 | +* User is able to launch a simple CLI command to create a Dashboard in Cloud |
| 8 | + * the new Dashboard to create is a logical copy of another existing “template” Dashboard |
| 9 | + * the newly created Dashboard is displaying variables coming from a Thing specified during creation |
| 10 | + |
| 11 | +## Problem |
| 12 | +An implementation for this command should be chosen. |
| 13 | + |
| 14 | +The RFC specifies that this command is going to work only for dashboards with a single thing. However, dashboards with multiple things are common and it would be better to introduce this feature from the beginning. |
| 15 | + |
| 16 | +The problem in supporting multiple things for a single dashboard lays in mapping the things described in the dashboard template to the actual things. |
| 17 | +Indeed, if a single thing is used, it can be passed as a simple flag into the command. |
| 18 | + |
| 19 | +## Constraints |
| 20 | + |
| 21 | +## Recommended Solution |
| 22 | + |
| 23 | +<!-- Title of the solution from the "Solutions" section you are recommending. --> |
| 24 | + |
| 25 | +## Solutions |
| 26 | + |
| 27 | +### Single thing support |
| 28 | + |
| 29 | +Let's take a simple example: |
| 30 | +```YAML |
| 31 | +id: home-security-alarm-dashboard |
| 32 | +name: Home Security Alarm |
| 33 | +widgets: |
| 34 | + - type: Messenger |
| 35 | + name: message_update |
| 36 | + variables: |
| 37 | + - thing_id: home-security-alarm |
| 38 | + variable_id: message_update |
| 39 | +``` |
| 40 | +In this example, the dashboard uses a single thing. So the command could easily be something like: |
| 41 | +
|
| 42 | +`arduino-cloud-cli dashboard create --name <dashname> --template <yamldashtemplfile> --thing-id <mythingid>` |
| 43 | + |
| 44 | +or even: |
| 45 | + |
| 46 | +`arduino-cloud-cli dashboard create --name <dashname> --template <yamldashtemplfile> --thing-override <home-security-alarm>=<mythingid>` |
| 47 | + |
| 48 | +### Multiple things support |
| 49 | + |
| 50 | +Let's take another dashboard template: |
| 51 | +```YAML |
| 52 | +id: home-security-alarm-dashboard |
| 53 | +name: Home Security Alarm |
| 54 | +widgets: |
| 55 | + - type: Messenger |
| 56 | + name: message_update |
| 57 | + variables: |
| 58 | + - thing_id: home-security-messenger |
| 59 | + variable_id: message_update |
| 60 | + - type: Switch |
| 61 | + name: light_alarm |
| 62 | + variables: |
| 63 | + - thing_id: home-security-alarm |
| 64 | + variable_id: light_alarm |
| 65 | +``` |
| 66 | +Here the mapping could be: |
| 67 | + |
| 68 | +`arduino-cloud-cli dashboard create --name <dashname> --template <yamldashtemplfile> --thing-override home-security-alarm=<mythingid1>,home-security-messenger=<mythingid2>` |
| 69 | + |
| 70 | +## Open Questions |
| 71 | + |
| 72 | +## Appendix |
| 73 | + |
| 74 | +<!-- Provide links to any relevant information. --> |
0 commit comments