[GSoC] EPSS History(Chart+Table)#2328
Conversation
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com> Refactor css for tooltip Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
|
@tdruez your input is welcomed on the choice of billboard.js (vs. libraries already in use in ScanCode.io?) |
|
@pombredanne We use billboard.js in SCIO as well. |
pombredanne
left a comment
There was a problem hiding this comment.
@Samk1710 Thanks... you'll need to resolve merge conflicts. And here are a few things to review.
| @@ -0,0 +1,58 @@ | |||
| import json | |||
There was a problem hiding this comment.
Please add the copyright and license header
| cves = { | ||
| alias_obj.alias | ||
| for alias_obj in advisory.aliases.all() | ||
| if alias_obj.alias.startswith("CVE-") |
There was a problem hiding this comment.
Why this check on the prefix? Is there a better way?
| for alias_obj in advisory.aliases.all() | ||
| if alias_obj.alias.startswith("CVE-") | ||
| } | ||
| if advisory.advisory_id and advisory.advisory_id.startswith("CVE-"): |
| ref_obj = AdvisoryReference.objects.create(url=json_data[0]["references"][0]["url"]) | ||
|
|
||
| for i, data in enumerate(json_data): | ||
| is_latest = i == 0 |
There was a problem hiding this comment.
not sure I get what this means: this would be true only on the 1st iteration, and is_latest seems to say the opposite?
|
|
||
| advisory.references.add(ref_obj) | ||
|
|
||
| severity = data["severities"][0] |
There was a problem hiding this comment.
could you instead iterate on severities? this would be cleaner IMHO.
| const data = getHistoryData(); | ||
| if (!data.length) return; | ||
|
|
||
| toggleDisplay(chartWrap); |
There was a problem hiding this comment.
what is chartwrap? and tablewrap?
| if (chartWrap.style.display === "none" || epssChartInstance) return; | ||
|
|
||
| const history = []; | ||
| const map = new Map(data.map(h => [new Date(h.published_at + "T00:00:00").setHours(0,0,0,0), h])); |
There was a problem hiding this comment.
What does this variable contain? map feels a pretty non descriptive name.
| const history = []; | ||
| const map = new Map(data.map(h => [new Date(h.published_at + "T00:00:00").setHours(0,0,0,0), h])); | ||
|
|
||
| const end = new Date(data[data.length - 1].published_at + "T00:00:00").setHours(0,0,0,0); |
There was a problem hiding this comment.
I would prefer that all these data handling and data preparation happen in Python and not here in the JS code.
| @@ -0,0 +1,13 @@ | |||
| about_resource: billboard-3.18.0.pkgd.min.js | |||
There was a problem hiding this comment.
Please also include the non-minified version... also the js is NOT part of the zip you list at all, but part of the npm at https://registry.npmjs.org/billboard.js/-/billboard.js-3.18.0.tgz instead. Please use that version, not some random thing fetched from a CDN.
Also where is d3 coming from in all this?
There was a problem hiding this comment.
The minified JS bundles D3... Is this really a good thing?
Copyright (c) 2017 ~ present NAVER Corp.
billboard.js project is licensed under the MIT license
billboard.js, JavaScript chart library
@Version 3.18.0
All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
- @types/d3-selection ^3.0.11
- @types/d3-transition ^3.0.9
- d3-axis ^3.0.0
- d3-brush ^3.0.0
- d3-drag ^3.0.0
- d3-dsv ^3.0.1
- d3-ease ^3.0.1
- d3-hierarchy ^3.1.2
- d3-interpolate ^3.0.1
- d3-scale ^4.0.2
- d3-selection ^3.0.0
- d3-shape ^3.2.0
- d3-time-format ^4.1.0
- d3-transition ^3.0.1
- d3-zoom ^3.0.0
|
|
||
| # editors | ||
| .vscode | ||
| *.code-workspace |


Resolves
Tasks Done:
Test log excerpt:
Billboard links: