Navigation Menu

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> openHAB

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> UIs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> to the dashboard by editing the...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer addTilesForExternalServices

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put every sentence in a new line?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Ah, I think we now have it 👍

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open an issue for this.

@openhab-bot
Copy link
Collaborator

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
@kaikreuzer kaikreuzer added the enhancement An enhancement or new feature of the Core label Dec 15, 2017
Rosi2143 pushed a commit to Rosi2143/openhab-core that referenced this pull request 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"
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 11, 2023
* Added dashboard support for links to external services.

Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
GitOrigin-RevId: ef8d0df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants