From 1067827fb2597105823221b86ca951bacfc89544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=20Kl=C3=A4rner?= Date: Sat, 29 May 2021 23:06:52 +0200 Subject: [PATCH] make protocol configurable --- MMM-GrafanaChart.js | 5 +++-- README.md | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/MMM-GrafanaChart.js b/MMM-GrafanaChart.js index a68d599..61fa61f 100755 --- a/MMM-GrafanaChart.js +++ b/MMM-GrafanaChart.js @@ -9,6 +9,7 @@ Module.register("MMM-GrafanaChart", { // Default module config. defaults: { + protocol: "http", height:"100%", width:"100%", scrolling:"no", @@ -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; diff --git a/README.md b/README.md index 4395c33..cd33a61 100755 --- a/README.md +++ b/README.md @@ -90,6 +90,10 @@ The following properties can be configured: + + protocol + Protocol used to access grafana. 'http' or 'https' are valid options.
Default value:"http" + width Width of the displayed chart. '150 px' or '50 %' are valid options.
Default value:"100%"