Skip to content

Commit

Permalink
make protocol configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
klaernie committed Apr 2, 2023
1 parent a8294c6 commit 1067827
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions MMM-GrafanaChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Module.register("MMM-GrafanaChart", {
// Default module config.
defaults: {
protocol: "http",
height:"100%",
width:"100%",
scrolling:"no",
Expand All @@ -28,9 +29,9 @@ Module.register("MMM-GrafanaChart", {
iframe.height = this.config.height;
iframe.scrolling = this.config.scrolling;
if (this.config.version == "6") {
iframe.src = "http://" + this.config.host + ":" + this.config.port + "/d-solo/" + this.config.id + "/" + this.config.dashboardname + "?orgId=" + this.config.orgId + "&panelId=" + this.config.panelId + "&from=" + this.config.from + "&to=" + this.config.to + "&fullscreen&kiosk";
iframe.src = this.config.protocol + "://" + this.config.host + ":" + this.config.port + "/d-solo/" + this.config.id + "/" + this.config.dashboardname + "?orgId=" + this.config.orgId + "&panelId=" + this.config.panelId + "&from=" + this.config.from + "&to=" + this.config.to + "&fullscreen&kiosk";
} else{
iframe.src = "http://" + this.config.host + ":" + this.config.port + "/dashboard-solo/db/" + this.config.dashboardname+ "?orgId=" + this.config.orgId + "&panelId=" + this.config.panelId + "&from=" + this.config.from + "&to=" + this.config.to;;
iframe.src = this.config.protocol + "://" + this.config.host + ":" + this.config.port + "/dashboard-solo/db/" + this.config.dashboardname+ "?orgId=" + this.config.orgId + "&panelId=" + this.config.panelId + "&from=" + this.config.from + "&to=" + this.config.to;;
}
iframe.setAttribute("timestamp", new Date().getTime());
return iframe;
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ The following properties can be configured:
</tr>
<thead>
<tbody>
<tr>
<td><code>protocol</code></td>
<td>Protocol used to access grafana. <code>'http'</code> or <code>'https'</code> are valid options. <br><b>Default value:<code>"http"</code></b></td>
</tr>
<tr>
<td><code>width</code></td>
<td>Width of the displayed chart. <code>'150 px'</code> or <code>'50 %'</code> are valid options. <br><b>Default value:<code>"100%"</code></b></td>
Expand Down

0 comments on commit 1067827

Please sign in to comment.