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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c29fc7f
Added dashboard support for links to external services.
paulianttila 257d8a5
Review comments changes and improved configuration file syntax.
paulianttila 1f79964
Removed useless NumberFormatException handling as suffix is text now
paulianttila a7dec56
More review changes
paulianttila 3ba5941
Fixed merge conflicts
paulianttila 3db68c0
Fixed merge problem
paulianttila 6bcd0d9
Changed component name to org.openhab.dashboard
paulianttila efbb419
Removed overlay support
paulianttila File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Dashboard | ||
|
||
The openHAB dashboard is a 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. | ||
|
||
## Link Configuration | ||
|
||
| Parameter name | Type | Description | | ||
|-----------------------------|---------|-----------------------------------------------------------------------------------------| | ||
| <unique-name>.link-name | String | Name which is shown in the openHAB dashboard. | | ||
| <unique-name>.link-url | String | URL to external service. | | ||
| <unique-name>.link-imageurl | String | URL to image which is shown in the dashboard. | | ||
|
||
Where `<unique-name>` is link unique identifier (see examples). | ||
|
||
## Image URL | ||
|
||
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 | ||
|
||
``` | ||
frontail.link-name=openHAB Log Viewer | ||
frontail.link-url=http://<server-adddress>:9001 | ||
frontail.link-imageurl=../static/image.png | ||
|
||
nodered.link-name=Node-RED | ||
nodered.link-url=http://<server-adddress>:1880 | ||
nodered.link-imageurl=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAACfCAIAAA...QmCC | ||
|
||
``` | ||
|
||
Note: **nodered** image data URL is not valid (it's shorten for the sake of clarity). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...hab.ui.dashboard/src/main/java/org/openhab/ui/dashboard/internal/ExternalServiceTile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Copyright (c) 2010-2017 by the respective copyright holders. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.openhab.ui.dashboard.internal; | ||
|
||
import org.openhab.ui.dashboard.DashboardTile; | ||
|
||
/** | ||
* The dashboard tile for external services. | ||
* | ||
* @author Pauli Anttila - Initial contribution | ||
*/ | ||
public class ExternalServiceTile implements DashboardTile { | ||
private String name; | ||
private String url; | ||
private String overlay; | ||
private String imageUrl; | ||
|
||
private ExternalServiceTile(DashboardTileBuilder builder) { | ||
this.name = builder.name; | ||
this.url = builder.url; | ||
this.overlay = builder.overlay; | ||
this.imageUrl = builder.imageUrl; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
@Override | ||
public String getOverlay() { | ||
return overlay; | ||
} | ||
|
||
@Override | ||
public String getImageUrl() { | ||
return imageUrl; | ||
} | ||
|
||
public static class DashboardTileBuilder { | ||
|
||
private String name; | ||
private String url; | ||
private String overlay; | ||
private String imageUrl; | ||
|
||
public DashboardTileBuilder withName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public DashboardTileBuilder withUrl(String url) { | ||
this.url = url; | ||
return this; | ||
} | ||
|
||
public DashboardTileBuilder withOverlay(String overlay) { | ||
this.overlay = overlay; | ||
return this; | ||
} | ||
|
||
public DashboardTileBuilder withImageUrl(String imageUrl) { | ||
this.imageUrl = imageUrl; | ||
return this; | ||
} | ||
|
||
public ExternalServiceTile build() { | ||
return new ExternalServiceTile(this); | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.