From 5150319ffe30e445216f75bd3b9c89755aac9d84 Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Tue, 28 Sep 2021 19:10:24 +0200 Subject: [PATCH 1/4] Draft dashboard create solutions --- designs/0001-dashboard-create.md | 74 ++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 designs/0001-dashboard-create.md diff --git a/designs/0001-dashboard-create.md b/designs/0001-dashboard-create.md new file mode 100644 index 00000000..33d70886 --- /dev/null +++ b/designs/0001-dashboard-create.md @@ -0,0 +1,74 @@ +# Dashboard create command + +## Overview +Arduino Cloud CLI should allow users to create a dashboard starting from a cloud template. + +The following User story has been taken from the [RFC](https://arduino.atlassian.net/wiki/spaces/FTWEB/pages/2761064740/Arduino+Cloud+CLI). +* User is able to launch a simple CLI command to create a Dashboard in Cloud + * the new Dashboard to create is a logical copy of another existing “template” Dashboard + * the newly created Dashboard is displaying variables coming from a Thing specified during creation + +## Problem +An implementation for this command should be chosen. + +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. + +The problem in supporting multiple things for a single dashboard lays in mapping the things described in the dashboard template to the actual things. +Indeed, if a single thing is used, it can be passed as a simple flag into the command. + +## Constraints + +## Recommended Solution + + + +## Solutions + +### Single thing support + +Let's take a simple example: +```YAML +id: home-security-alarm-dashboard +name: Home Security Alarm +widgets: + - type: Messenger + name: message_update + variables: + - thing_id: home-security-alarm + variable_id: message_update +``` +In this example, the dashboard uses a single thing. So the command could easily be something like: + +`arduino-cloud-cli dashboard create --name --template --thing-id ` + +or even: + +`arduino-cloud-cli dashboard create --name --template --thing-override =` + +### Multiple things support + +Let's take another dashboard template: +```YAML +id: home-security-alarm-dashboard +name: Home Security Alarm +widgets: + - type: Messenger + name: message_update + variables: + - thing_id: home-security-messenger + variable_id: message_update + - type: Switch + name: light_alarm + variables: + - thing_id: home-security-alarm + variable_id: light_alarm +``` +Here the mapping could be: + +`arduino-cloud-cli dashboard create --name --template --thing-override home-security-alarm=,home-security-messenger=` + +## Open Questions + +## Appendix + + \ No newline at end of file From 6e548cc5fda3c9dce985352a80730d5f7ee71d9f Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Tue, 28 Sep 2021 19:15:16 +0200 Subject: [PATCH 2/4] Improve commands readability --- designs/0001-dashboard-create.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/designs/0001-dashboard-create.md b/designs/0001-dashboard-create.md index 33d70886..1b2e1f55 100644 --- a/designs/0001-dashboard-create.md +++ b/designs/0001-dashboard-create.md @@ -39,11 +39,15 @@ widgets: ``` In this example, the dashboard uses a single thing. So the command could easily be something like: -`arduino-cloud-cli dashboard create --name --template --thing-id ` +```sh +arduino-cloud-cli dashboard create --name --template --thing-id +``` or even: -`arduino-cloud-cli dashboard create --name --template --thing-override =` +```sh +arduino-cloud-cli dashboard create --name --template --thing-override = +``` ### Multiple things support @@ -65,10 +69,12 @@ widgets: ``` Here the mapping could be: -`arduino-cloud-cli dashboard create --name --template --thing-override home-security-alarm=,home-security-messenger=` +```sh +arduino-cloud-cli dashboard create --name --template --thing-override home-security-alarm=,home-security-messenger= +``` ## Open Questions ## Appendix - \ No newline at end of file + From dbdeb8c01481ab6012f76a28295fd6b8f440fc80 Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Thu, 30 Sep 2021 15:53:01 +0200 Subject: [PATCH 3/4] Adapt to new docs template --- designs/0001-dashboard-create.md | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/designs/0001-dashboard-create.md b/designs/0001-dashboard-create.md index 1b2e1f55..320b7676 100644 --- a/designs/0001-dashboard-create.md +++ b/designs/0001-dashboard-create.md @@ -1,5 +1,9 @@ # Dashboard create command +## Review Period + +Best before October, 5, 2021. + ## Overview Arduino Cloud CLI should allow users to create a dashboard starting from a cloud template. @@ -9,20 +13,14 @@ The following User story has been taken from the [RFC](https://arduino.atlassian * the newly created Dashboard is displaying variables coming from a Thing specified during creation ## Problem -An implementation for this command should be chosen. +**An implementation for this command should be chosen.** -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. +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.** The problem in supporting multiple things for a single dashboard lays in mapping the things described in the dashboard template to the actual things. Indeed, if a single thing is used, it can be passed as a simple flag into the command. -## Constraints - -## Recommended Solution - - - -## Solutions +## Implementation alternatives ### Single thing support @@ -72,9 +70,3 @@ Here the mapping could be: ```sh arduino-cloud-cli dashboard create --name --template --thing-override home-security-alarm=,home-security-messenger= ``` - -## Open Questions - -## Appendix - - From 6639f71273e2577a37e250b4593b3c579c4d9878 Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Mon, 4 Oct 2021 15:43:22 +0200 Subject: [PATCH 4/4] Mark "multiple things support" as accepted solution --- designs/0001-dashboard-create.md | 47 ++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/designs/0001-dashboard-create.md b/designs/0001-dashboard-create.md index 320b7676..f62c2037 100644 --- a/designs/0001-dashboard-create.md +++ b/designs/0001-dashboard-create.md @@ -20,11 +20,12 @@ The RFC specifies that this command is going to work only for dashboards with a The problem in supporting multiple things for a single dashboard lays in mapping the things described in the dashboard template to the actual things. Indeed, if a single thing is used, it can be passed as a simple flag into the command. -## Implementation alternatives +## Accepted solution -### Single thing support +It has been decided to implement the **Multiple things support** solution because it was the most future-proof. +### Multiple things support -Let's take a simple example: +Let's take a dashboard template: ```YAML id: home-security-alarm-dashboard name: Home Security Alarm @@ -32,41 +33,47 @@ widgets: - type: Messenger name: message_update variables: - - thing_id: home-security-alarm + - thing_id: home-security-messenger variable_id: message_update + - type: Switch + name: light_alarm + variables: + - thing_id: home-security-alarm + variable_id: light_alarm ``` -In this example, the dashboard uses a single thing. So the command could easily be something like: +Here we are going to use a flag, that could be called `override`, which takes as parameter a map to be defined with the following structure: `=,..` + +Following the example, the command will be something like: ```sh -arduino-cloud-cli dashboard create --name --template --thing-id +arduino-cloud-cli dashboard create --name --template --thing-override home-security-alarm=,home-security-messenger= ``` -or even: -```sh -arduino-cloud-cli dashboard create --name --template --thing-override = -``` +## Alternative solutions +### Single thing support -### Multiple things support +This is the simplest solution but it's very limiting. -Let's take another dashboard template: +Let's take a simple example: ```YAML id: home-security-alarm-dashboard name: Home Security Alarm widgets: - type: Messenger name: message_update - variables: - - thing_id: home-security-messenger - variable_id: message_update - - type: Switch - name: light_alarm variables: - thing_id: home-security-alarm - variable_id: light_alarm + variable_id: message_update ``` -Here the mapping could be: +In this example, the dashboard uses a single thing. So the command could easily be something like: ```sh -arduino-cloud-cli dashboard create --name --template --thing-override home-security-alarm=,home-security-messenger= +arduino-cloud-cli dashboard create --name --template --thing-id +``` + +or even: + +```sh +arduino-cloud-cli dashboard create --name --template --thing-override = ```