Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for dashboard links to external services. #185

Merged
merged 8 commits into from Aug 18, 2017

Conversation

@paulianttila
Copy link
Contributor

@paulianttila paulianttila commented Aug 12, 2017

Signed-off-by: Pauli Anttila pauli.anttila@gmail.com

Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
Copy link
Member

@martinvw martinvw left a comment

Looks great! @kaikreuzer can you also take a look?

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Thanks, a nice feature!
Just some suggestions on how to further improve it :-)

@@ -0,0 +1,34 @@
# Dashboard tiles
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

-> Just "Dashboard"

@@ -0,0 +1,34 @@
# Dashboard tiles

OpenHAB dashboard is landing page for the user where all openHAB UI's can be found. Dashboard support also links to external services. Links can be added to dashboard by ```conf/services/dashboard.cfg``` configuration file.
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

-> openHAB

Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

-> UIs

Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

-> to the dashboard by editing the...

Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

Please put every sentence in a new line to make diffing and reviewing easier.

|-----------------|---------|-----------------------------------------------------------------------------------------|
| link-nameX | String | Name which is shown in the openHAB dashboard. |
| link-urlX | String | URL to external service. |
| link-overlayX | String | Image overlay icon. Supported values are empty (no icon), "html5", "android" or "apple" |
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

Actually many more. If I remember right, all icons from https://icomoon.io/#preview-free should work as an overlay.

Copy link
Contributor Author

@paulianttila paulianttila Aug 13, 2017

Dashboard embedded web/fonts/icomoon.ttf seems to contain only html5, android and apple icons.

Copy link
Member

@kaikreuzer kaikreuzer Aug 16, 2017

I wonder if in that case this feature at all makes sense - the overlay was used in the past, but as everything ended up using the HTML5 overlay, we removed it. So it is rather in there as some legacy, which we might not want to promote again through a new feature. Wdyt?

Copy link
Contributor Author

@paulianttila paulianttila Aug 17, 2017

It's totally fine for me to remove this feature. If more icons would be supported, this feature make more sense as well.

Copy link
Member

@kaikreuzer kaikreuzer Aug 17, 2017

Ok, so may I ask you to remove the overlay support here for the external tiles as a last change before merging? Thanks :-)

| link-overlayX | String | Image overlay icon. Supported values are empty (no icon), "html5", "android" or "apple" |
| link-imageurlX | String | URL to image. |

Where X is link unique number (see examples). All configuration parameters need to start with ```org.openhab.ui.dashboard:``` prefix.
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

We should change the service pid from org.openhab.ui.dashboard to org.openhab.dashboard. With that change, the pid is derived from the filename and you can leave out the prefix in the file:

link-name1=openHAB Log Viewer
link-url1=http://localhost:9001
link-overlay1=
link-imageurl1=http://localhost:8080/static/image.png

Would be much nicer!

Copy link
Contributor Author

@paulianttila paulianttila Aug 13, 2017

That was the missing piece. I was wondering why some of the configuration files works without prefix.


## Image URL

Image URL support several URL formats. URL support direct http links to local or Internet servers, but also the "data" URL scheme (RFC2397) is supported. See e.g. [https://www.base64-image.de](https://www.base64-image.de) to convert images to base64 coded data.
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

Who needs access to the links? The server or the browser? Should be clarified.

## Example configuration file
```
org.openhab.ui.dashboard:link-name1=openHAB Log Viewer
org.openhab.ui.dashboard:link-url1=http://localhost:9001
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

If the answer to my question above is "the browser", your examples are pretty misleading - "localhost" won't really get you far...

org.openhab.ui.dashboard:link-name1=openHAB Log Viewer
org.openhab.ui.dashboard:link-url1=http://localhost:9001
org.openhab.ui.dashboard:link-overlay1=
org.openhab.ui.dashboard:link-imageurl1=http://localhost:8080/static/image.png
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

To avoid localhost, a relative url like ../static/image.png is probably better.

@@ -153,4 +162,30 @@ protected HttpServlet createServlet() {
return new DashboardServlet(configurationAdmin, indexTemplate, entryTemplate, warnTemplate, setupTemplate,
tiles);
}

private void addTilesToExternalServices(Map<String, Object> properties) {
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

I'd prefer addTilesForExternalServices

*
* @author Pauli Anttila - Initial contribution
*/
public class DashboardTileImp implements DashboardTile {
Copy link
Member

@kaikreuzer kaikreuzer Aug 12, 2017

Could we fina a better class name? How about ExternalServiceTile?

Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
@paulianttila
Copy link
Contributor Author

@paulianttila paulianttila commented Aug 13, 2017

Thanks @martinvw and @kaikreuzer for review. Hopefully all review comments are now fixed. I also improved configuration file syntax.

Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
Copy link
Member

@kaikreuzer kaikreuzer left a comment

Sorry @paulianttila, another PR just got merged which now causes merge conflicts :-(
As you have to touch it again anyhow, let me add some further minor comments. Thanks!


Browser fetch image from image URL. URL can be direct http link or data URIs according to [RFC2397](https://tools.ietf.org/html/rfc2397). If data URIs are used, browser should support them as well. All five major browsers (Chrome, Firefox, IE, Opera and Safari) support data URIs . See e.g. [https://www.base64-image.de](https://www.base64-image.de) to convert images to base64 coded data.

## Example configuration file
Copy link
Member

@kaikreuzer kaikreuzer Aug 15, 2017

please add an empty line after the header

@@ -0,0 +1,34 @@
# Dashboard

openHAB dashboard is landing page for the user where all openHAB UIs can be found. Dashboard support also links to external services. Links can be added to the dashboard by editing the ```conf/services/dashboard.cfg``` configuration file.
Copy link
Member

@kaikreuzer kaikreuzer Aug 15, 2017

Could you put every sentence in a new line?

Copy link
Member

@kaikreuzer kaikreuzer Aug 15, 2017

Maybe change to "The openHAB dashboar is a landing page..."

Copy link
Member

@kaikreuzer kaikreuzer Aug 15, 2017

You can use single backticks when highlighting code inline (no need to have three backticks).

Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
@kaikreuzer
Copy link
Member

@kaikreuzer kaikreuzer commented Aug 18, 2017

Thanks for the update, but you missed the removal of overlays from the documentation...

Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
@kaikreuzer
Copy link
Member

@kaikreuzer kaikreuzer commented Aug 18, 2017

Ah, I think we now have it 👍

@kaikreuzer kaikreuzer merged commit ef8d0df into openhab:master Aug 18, 2017
1 check passed
@@ -0,0 +1,34 @@
# Dashboard
Copy link
Member

@kaikreuzer kaikreuzer Aug 18, 2017

@ThomDietrich Any suggestion where this page might best fit in on docs.openhab.org and whether we should automatically pick the page up from here, or simply copy the content over to openhab-docs?

Copy link
Member

@ThomDietrich ThomDietrich Aug 19, 2017

I'll open an issue for this.

@openhab-bot
Copy link
Collaborator

@openhab-bot openhab-bot commented Nov 30, 2017

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/how-to-add-additional-links-apps-to-the-openhab-8080-start-index-page/36770/9

@kaikreuzer kaikreuzer added this to the 2.2 milestone Dec 15, 2017
Rosi2143 pushed a commit to Rosi2143/openhab-core that referenced this issue Dec 26, 2020
openhab#469)

* Adding description on using sendCommand/postUpdate

The use of sendCommand and postUpdate in rules is explained with an emphasis on discouraging the generic method sendCommand(Item,arg) over the method Item.sendCommand(arg) that provides much more reliable type conversions. Details as to the background have been added
Signed-off-by: lipp.markus@gmail.com (github: LightIsLife)

* Adding description on using sendCommand/postUpdate fixes openhab#185 openhab#469

Addressing comments by @rkoshak on commit 042dae745cb7f830d8c757e5d09a08e46c949dde
Signed-off-by: lipp.markus@gmail.com (github: LightIsLife)

* Updating language/editorial changes

Some editorial changes throughout, and added more consistency in the use of "" where new_state has to be a string (in actions) and no quotation marks where this is not mandated (in methods).
Signed-off-by: Markus Lipp <lipp.markus@gmail.com> (github: LightIsLife)

* Addressing comments made

Addressing all comments by @ThomDietrich: sentences are shortened and simplifies, heading capitalized and modified, text overall slightly shortened, etc

* fixed typo

just fixing a few typos

* made sentences shorter

Sentences shortened to address comments received

* one line per sentence reformatting

Adjustment as per style convention to each sentence begins on its own line

* Add some further clarification

Signed-off-by: Thomas Dietrich <thomas.dietrich@tu-ilmenau.de> (github: ThomDietrich)

* moved section to scripts, deleted details

Addressing comments by @ThomDietrich. 
Moved the whole new section (Manipulating item states) into exisiting section "Scripts"
Deleted the paras under "Details"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants