andymchugh / andrewbmchugh-flow-panel

Apache License 2.0
38 stars 2 forks source link

load the svg from the filesystem #125

Open hellt opened 2 weeks ago

hellt commented 2 weeks ago

Hi @andymchugh first of all, hats down for the awesome work you did with this plugin. We are transitioning to it from the flowchart plugin that is not compatible with the newest grafana releases.

I wonder, would it be possible for a plugin to load the svg using the file url scheme, like file:///some/path?

We package our grafana dashboards in containers, and it would be handy to have the SVG to be part of the container so that no external URL requests are made. I can embed the svg in the dashboard json, but then I loose the ability to preview the SVG when compared to a local file. Ty!

ADD1: ah, I see, the http request is sent by the browser, so it needs to be accessible by the browser. At the same time there is no variable that would set to the window.location to get the current URL used by the browser.

Seems like the only way to handle this is to make the plugin load the files that are available on disk, if that is possible.

RafaelAybar commented 2 weeks ago

@andymchugh Maybe could be more interesting to allow private git repositories. As a corporate feature, could fix the "where" issue when you want to keep the Diagram updated easily. Maybe another box with Git creds

andymchugh commented 2 weeks ago

Thanks for the feedback. I don't believe this is possible though. Under the hood it uses 'fetch' so it is compatible with file urls, it's just so sandboxed I don't think there's a way for you to get through.

As for the other comment on git credentials, that's not a space it can go into. There's no way to safely store them.

From a maintenance perspective I think the only sensible solution is to keep your svgs and yaml in a repo so you do have the ability to view and edit them. If you can't serve them up from a web-browser view of that repo then you have to take the hit of copy/pasting them into the panels.

If you think there is a grafana disk area you could write to and I could access then I'd be open to looking into it. Just not aware of one myself.