From 03c6b9749d1b3ef72561b1f6d53353429b5d624e Mon Sep 17 00:00:00 2001 From: sideonshore <118305257+sideonshore@users.noreply.github.com> Date: Tue, 20 Dec 2022 19:11:59 +0100 Subject: [PATCH] Update MMM-GrafanaChart.js added possibility to set "from" and "to" variables in the MM config file --- MMM-GrafanaChart.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MMM-GrafanaChart.js b/MMM-GrafanaChart.js index 903dd21..54c626c 100755 --- a/MMM-GrafanaChart.js +++ b/MMM-GrafanaChart.js @@ -3,6 +3,7 @@ * * By SvenSommer https://github.com/SvenSommer * MIT Licensed. + */ @@ -29,10 +30,10 @@ Module.register("MMM-GrafanaChart", { 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 + "&fullscreen&kiosk"; + 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"; } else{ - iframe.src = "http://" + this.config.host + ":" + this.config.port + "/dashboard-solo/db/" + this.config.dashboardname+ "?orgId=" + this.config.orgId + "&panelId=" + this.config.panelId;; + 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.setAttribute("timestamp", new Date().getTime()); return iframe; @@ -54,10 +55,10 @@ Module.register("MMM-GrafanaChart", { } if (this.config.version == "6") { - this.src = "http://" + this.config.host + ":" + this.config.port + "/d-solo/" + this.config.id + "/" + this.config.dashboardname + "?orgId=" + this.config.orgId + "&panelId=" + this.config.panelId + "&fullscreen&kiosk"; + this.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"; } else{ - this.src = "http://" + this.config.host + ":" + this.config.port + "/dashboard-solo/db/" + this.config.dashboardname+ "?orgId=" + this.config.orgId + "&panelId=" + this.config.panelId; + this.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; } Log.info("attempting to update dom for iFrameReload"); Log.info('/"this/" module is: ' + this);