Skip to content

Commit 73b6984

Browse files
committed
Add status column in relation view table #688
Signed-off-by: Thomas Druez <tdruez@nexb.com>
1 parent d64307b commit 73b6984

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

scanpipe/templates/scanpipe/relation_list.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717

1818
<div class="container is-fluid mb-3">
1919
<div class="table-container">
20-
<table class="table is-bordered is-narrow is-hoverable is-fullwidth">
20+
<table class="table is-bordered is-narrow is-hoverable is-fullwidth" style="table-layout: fixed;">
2121
<thead>
2222
<tr>
23-
<th style="width: 45%">To resource</th>
24-
<th>
23+
<th>To resource</th>
24+
<th style="width:100px;">Status</th>
25+
<th style="width:145px;">
2526
<a href="?sort={% if "-" not in filter.data.sort %}-{% endif %}related_from__match_type" class="is-black-link">Match type</a>
2627
{% if "related_from__match_type" in filter.data.sort %}
2728
<i class="fa fa-sort-{% if "-" in filter.data.sort %}down{% else %}up{% endif %}"></i>
@@ -30,7 +31,7 @@
3031
{% include 'scanpipe/includes/match_type_filter_dropdown.html' %}
3132
</div>
3233
</th>
33-
<th style="width: 45%">From resource</th>
34+
<th>From resource</th>
3435
</tr>
3536
</thead>
3637
<tbody>
@@ -42,6 +43,7 @@
4243
<a href="{{ resource.get_absolute_url }}#viewer">{{ resource.path }}</a>
4344
</td>
4445
{% endif %}
46+
<td>{{ resource.status }}</td>
4547
<td>
4648
{{ relation.match_type }}
4749
{% if relation.extra_data.path_score %}
@@ -65,6 +67,7 @@
6567
<td class="break-all">
6668
<a class="has-text-danger" href="{{ resource.get_absolute_url }}#viewer">{{ resource.path }}</a>
6769
</td>
70+
<td>{{ resource.status }}</td>
6871
<td></td>
6972
<td></td>
7073
</tr>

scanpipe/views.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,10 @@ class ProjectErrorListView(
938938
]
939939

940940

941-
RelationRow = namedtuple("RelationRow", "to_resource match_type score from_resource")
941+
RelationRow = namedtuple(
942+
"RelationRow",
943+
field_names=["to_resource", "status", "match_type", "score", "from_resource"],
944+
)
942945

943946

944947
class CodebaseRelationListView(
@@ -967,11 +970,12 @@ def get_rows(qs):
967970
for resource in qs:
968971
relations = resource.related_from.all()
969972
if not relations:
970-
yield RelationRow(resource.path, "", "", "")
973+
yield RelationRow(resource.path, "", "", "", "")
971974
else:
972975
for relation in resource.related_from.all():
973976
yield RelationRow(
974977
resource.path,
978+
resource.status,
975979
relation.match_type,
976980
relation.extra_data.get("path_score", ""),
977981
relation.from_resource.path,

0 commit comments

Comments
 (0)