Report viewer: Allow loading results by URL #910
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When integrating with other software (TMS in my case), it’s useful to be able to send users to a URL that will automatically load the results, without having to recompile the report viewer on the live server every time (to make use of overview.json). This pull request introduces a new
file
query parameter, which, if provided, makes the report viewer load the results from the given URL. Similarly to the drag-and-drop upload, the URL can point to both ZIPs and JSONs; since the URL may not have an appropriate extension, let the browser figure out the type based on the HTTP headers. Browsers can figure out the MIME type of drag-and-drop files as well (usually based on the extension), so migrate also the drag-and-drop to MIME-based type determination, dropping thegetFileExtension
function. Also improve error handling: instead of just logging to the browser console, present the error usingalert
– not a five-star UX, but still much better than nothing.