diff --git a/README.md b/README.md index f76e0e5..52979b9 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,10 @@ needs read access to the directory. # Changelog +## Version 2.0.2 + +* Fix file not found error when Grafana configured with "serve_from_sub_path = true". + ## Version 2.0.1 * Fix errors related to crypto.randomUUID on http servers. diff --git a/docker-compose.yaml b/docker-compose.yaml index 0eb9518..599dfec 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,9 +7,11 @@ services: context: ./.config args: grafana_image: ${GRAFANA_IMAGE:-grafana} - grafana_version: ${GRAFANA_VERSION:-9.0.0} + grafana_version: ${GRAFANA_VERSION:-10.4.2} environment: - GF_SECURITY_ALLOW_EMBEDDING=true + - GF_SERVER_ROOT_URL=%(protocol)s://%(domain)s:3000/grafana/ + - GF_SERVER_SERVE_FROM_SUB_PATH=true ports: - 3000:3000/tcp volumes: diff --git a/package.json b/package.json index 30b66ec..d96471d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scadavis-synoptic-panel", - "version": "2.0.1", + "version": "2.0.2", "description": "SCADA-like synoptic panel from SCADAvis.io", "scripts": { "build": "webpack -c ./webpack.config.ts --env production", diff --git a/src/module.ts b/src/module.ts index 3695f62..1cb7b97 100644 --- a/src/module.ts +++ b/src/module.ts @@ -2,7 +2,9 @@ import { PanelPlugin } from '@grafana/data'; import { ScadavisPanel } from './ScadavisPanel'; import { ScadavisPanelOptions } from './types'; import { UploadSVG } from './SvgFilePicker'; - +declare global { + let grafanaBootData: any; +} export const plugin = new PanelPlugin(ScadavisPanel).setPanelOptions(builder => { return builder .addTextInput({ diff --git a/src/plugin.json b/src/plugin.json index 2f0ff85..153ae25 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -33,7 +33,7 @@ "path": "img/scadavis-power.png" } ], - "version": "2.0.1", + "version": "2.0.2", "updated": "%TODAY%" }, "dependencies": { diff --git a/src/synoptic/index.ts b/src/synoptic/index.ts index 4b14d9a..6ad4993 100644 --- a/src/synoptic/index.ts +++ b/src/synoptic/index.ts @@ -769,14 +769,14 @@ export class ScadaVis { if (this.iframeparams.indexOf('scrolling') >= 0) { scrolling = ''; } - + const subUrl = grafanaBootData?.appSubUrl || grafanaBootData?.settings?.appSubUrl || ''; iframehtm = '`; + ` src="${subUrl}/public/plugins/scadavis-synoptic-panel/synoptic/synoptic.html">`; if (this.container.innerHTML !== undefined) { (this.container as HTMLDivElement).appendChild(this.createElementFromHTML(iframehtm) as Node); } else {