-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a risk_score field and display the values in the UI #98
Signed-off-by: tdruez <[email protected]>
- Loading branch information
Showing
9 changed files
with
113 additions
and
30 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
component_catalog/migrations/0010_component_risk_score_package_risk_score.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 5.0.9 on 2024-11-08 13:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('component_catalog', '0009_componentaffectedbyvulnerability_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='component', | ||
name='risk_score', | ||
field=models.DecimalField(decimal_places=2, help_text='Risk score between 0.00 and 10.00, where higher values indicate greater vulnerability risk for the package.', max_digits=4, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='package', | ||
name='risk_score', | ||
field=models.DecimalField(decimal_places=2, help_text='Risk score between 0.00 and 10.00, where higher values indicate greater vulnerability risk for the package.', max_digits=4, null=True), | ||
), | ||
] |
11 changes: 11 additions & 0 deletions
11
component_catalog/templates/component_catalog/includes/risk_score_badge.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% if risk_score %} | ||
<span class="badge | ||
{% if risk_score >= 8.0 %}bg-danger | ||
{% elif risk_score >= 6.0 %}bg-warning-orange | ||
{% elif risk_score >= 3.0 %}bg-warning | ||
{% else %}bg-secondary | ||
{% endif %} | ||
"> | ||
risk {{ risk_score }} | ||
</span> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters