mozilla / firefox-code-coverage-frontend

The Firefox code coverage diff viewer allows determining code coverage changes for added lines per changeset.
https://firefox-code-coverage.herokuapp.com/
Mozilla Public License 2.0
9 stars 19 forks source link

[WIP] Add a directory coverage viewer. #222

Open jankeromnes opened 6 years ago

jankeromnes commented 6 years ago

Fixes #176.

This is a rough prototype showing per-directory coverage data:

directory-coverage

It hijacks Routes by replacing FileViewerContainer with a new DirectoryViewerContainer component when the requested file path ends with / (I'd like to find a cleaner solution to identify directories from files), and it uses an ActiveData query to aggregate coverage by sub-file and sub-folder (I'd like to switch to the faster https://coverage.staging.moz.tools/v2/path endpoint).

TODO:


This change is Reviewable

armenzg commented 6 years ago

Exciting! I've requested a PR deployment (it should be active for 5 days since the last push).

Give me a heads up when you think this is closer to being ready to be reviewed.

marco-c commented 6 years ago

Find a cleaner way to differentiate between "file" and "directory" (than relying on the final /)

This would be for free when you do:

Use Bastien's new https://coverage.staging.moz.tools/v2/path endpoint

jankeromnes commented 6 years ago

Thanks for the feedback!

Instead of re-implementing a full separate DirectoryViewerContainer component (with similar sub-components as FileViewerContainer), I think there is a way to make FileViewerContainer also fetch https://coverage.staging.moz.tools/v2/path, and then differentiate between file and directory in the render() method directly.

This would address the first three items in the checklist.

jankeromnes commented 6 years ago

This new commit is still very much work-in-progress, but it makes FileViewerContainer fetch the new /v2/path endpoint, and adds a bit of UI according to the results:

coverage-side-by-side

This could allow comparing ActiveData results with our new backend (but today, I don't think they are any revisions in common between both, so instead I'm fetching /v2/path without a revision, which I believe gives me the latest available data).

EDIT: Note that I'll soon remove the pointless "raw file" view of the directory. I just kept it temporarily in order to compare results between hg.m.o / ActiveData / coverage.moz.tools (and for example, /v2/path is missing some folders/files for which it has no data. Maybe we still want to list them in our view?)