NatLabRockies / NatLabRockies/OpenStudio

OpenStudio Results Report html is sometimes Garbled

Open
#5,584 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Triage
Dominant language
C++
Stars
646
Forks
237
Avg merge
3d 11h
Merged PRs (30d)
10

Description

Description

When I open the OpenStudio Results report (and sometimes the EnergyPlus Results report) html files using a web browser, the report loses formatting and the table of contents gets stuck in one place.

It can also happens if a report is already open, and I try to open another report.

Please also see this issue: https://github.com/openstudiocoalition/OpenStudioApplication/issues/833

Current Behavior

The report loses formatting and the table of contents gets stuck in one place

Expected Behavior

The report should be easy to read with clickable table of contents links.

Steps to reproduce
  1. Open report
  2. Open another report
  3. Close report
  4. Open report again

or

require 'openstudio'
include OpenStudio::Model
m = Model.new
# m = Model.load('path/to/model.osm').get
[...]
Possible Solution

"I found the problem! The Bootstrap CSS is being loaded from an absolute file path in a temporary directory:"

C:/Users/user/AppData/Local/Temp/osmodel-a9c5-3260-be30-4e1f-1760122122-0/...

"This temporary directory gets cleaned up or changes between runs, which is why the styling works "sometimes" - it only works when that exact temp folder still exists. When you open the HTML file later or from a different location, the CSS file can't be found."

"Solution: Replace the local file paths with CDN links"

"Replace the section links with these CDN versions:"

<title>OpenStudio Results</title> <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dimple/2.3.0/dimple.latest.min.js"></script>

"This way, the styling will always load consistently regardless of where the HTML file is located or whether the temp directory still exists."

Operating System affected

Windows 11

Environment

Windows 11

Version of OpenStudio

3.10

Context

It is frustrating to open the report and find the formatting all garbled.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the OpenStudio Results report HTML generation and inspect its links for Bootstrap CSS and the JavaScript dependencies shown in the issue. Reproduce the problem with the listed Windows report-opening steps or the Ruby example, then verify that reports retain formatting and clickable table-of-contents links after being reopened.

Written by the indexing model from the issue text.

Assessment

Tech stack
bootstrap, css, d3, html, javascript, jquery, ruby
Domain
desktop, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.