I have come up with a unique solution to the problem of external javascript libraries being used within WebReports or Dashboards on systems without Internet Access.
@selimgoksu You are correct, it is the computer that has WebReports loaded in the browser that needs internet access, not the WebReports server itself, which makes this normally not a big deal.
As far as I know the solution I have come up with is the only method by which you can easily share a single copy of an external javascript library between dashboards in multiple sites in the BigFix Console as well as between multiple WebReports servers.
The solution is based upon the concept used for the “Parameterized Fixlet Library” and Parameterized Fixlets.
You import a specially crafted BigFix Task into the BigFix console that contains the Javascript library within it. See this example: https://github.com/jgstew/bigfix-content/blob/master/fixlet/javascript/Shared%20Javascript%20Library%20-%20d3.min.js%20-%203.5.17.bes
Then you use a session relevance query that gets the source from the BigFix Task and puts it in the Dashboard and/or WebReport. I also have the session relevance fall back to getting the Javascript library from the internet so that it will still work if the BigFix task is missing:
When you actually use the session relevance within a WebReport or Dashboard, it looks like this:
<?Relevance (html it) of ( ( unique value of (it as string) of ( html tag ("script", attr list of ("title", item 0 of it & " " & item 1 of it), (html it) of item 2 of it ) ) of (name of mime fields whose(name of it ends with ".js") of it, mime field "version" of it, value of mime fields whose(name of it ends with ".js") of it) of bes tasks whose(exists mime fields "version" whose(it="3.5.17") of it AND name of it starts with "Shared Javascript Library" AND exists mime fields "d3.min.js" of it) ) | "%3Cscript src=%22https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.js%22 integrity=%22sha256-gfQwA6PlkZsLqWu4bU4hXPrbTqzixm0B5MdvBLI+Oas=%22 crossorigin=%22anonymous%22>%3C/script>" ) ?>
Which would replace <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.js" integrity="sha256-gfQwA6PlkZsLqWu4bU4hXPrbTqzixm0B5MdvBLI+Oas=" crossorigin="anonymous"></script>
in my existing dashboards.
When the WebReport or Dashboard is loaded, the <?Relevance ?>
results are placed inline in the HTML before it is actually ever seen by the Browser, so the Browser actually sees just a normal script tag that contains the entire contents of the javascript library within it, or it gets a script tag that references the internet javascript CDN if the task doesn’t exist in the console.
The added benefit of this approach is that it should cause the browser to render the Dashboard/WebReport faster.
Another benefit to this approach is that when you are debugging a Console Dashboard, you can “view source” in the console, copy all of the HTML, then open it in another browser like Chrome, which allows you to use Chrome’s javascript debugging tools to make sense of what is going on. I have found this approach invaluable.
The same concept should apply to CSS, but with slightly different usage.