Skip to content

Commit 9058654

Browse files
committed
Display Scan status and action in Product inventory table #230
Signed-off-by: tdruez <[email protected]>
1 parent 9003100 commit 9058654

File tree

4 files changed

+61
-61
lines changed

4 files changed

+61
-61
lines changed
Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,11 @@
11
<strong class="ms-1">{{ scan.runs.0.status|title }}</strong>
22
{% include 'component_catalog/includes/scan_status.html' with status=scan.runs.0.status only %}
33

4-
{% if compact_mode %}
5-
<ul class="list-inline mt-1 mb-0">
6-
{% if view_url %}
7-
<li class="list-inline-item" data-bs-toggle="tooltip" data-bs-title="View Scan results">
8-
<a class="text-dark" href="{{ view_url }}#scan" target="_blank">
9-
<i class="far fa-file-alt"></i>
10-
</a>
11-
</li>
12-
{% endif %}
13-
{% if scan.download_result_url %}
14-
<li class="list-inline-item" data-bs-toggle="tooltip" data-bs-title="Download Scan results">
15-
<a class="text-dark" href="{{ scan.download_result_url }}" target="_blank">
16-
<i class="fas fa-download"></i>
17-
</a>
18-
</li>
19-
{% endif %}
20-
{% if scan.delete_url %}
21-
<li class="list-inline-item" data-bs-toggle="tooltip" data-bs-title="Delete Scan">
22-
<a class="text-dark scan_delete_link" href="#scan-delete-modal" role="button" data-delete-url="{{ scan.delete_url }}" data-bs-toggle="modal">
23-
<i class="far fa-trash-alt"></i>
24-
</a>
25-
</li>
26-
{% endif %}
27-
</ul>
28-
{% else %}
29-
<div class="text-center">
30-
{% if scan.download_result_url %}
31-
<a class="btn btn-outline-dark btn-sm mt-2" href="{{ scan.download_result_url }}" target="_blank"><i class="fas fa-download"></i> Results</a>
32-
{% endif %}
33-
{% if scan.delete_url %}
34-
<a class="btn btn-outline-danger btn-sm mt-2 scan_delete_link" href="#scan-delete-modal" role="button" data-delete-url="{{ scan.delete_url }}" title="Delete" data-bs-toggle="modal"><i class="far fa-trash-alt"></i></a>
35-
{% endif %}
36-
</div>
37-
{% endif %}
4+
<div class="text-center">
5+
{% if scan.download_result_url %}
6+
<a class="btn btn-outline-dark btn-sm mt-2" href="{{ scan.download_result_url }}" target="_blank"><i class="fas fa-download"></i> Results</a>
7+
{% endif %}
8+
{% if scan.delete_url %}
9+
<a class="btn btn-outline-danger btn-sm mt-2 scan_delete_link" href="#scan-delete-modal" role="button" data-delete-url="{{ scan.delete_url }}" title="Delete" data-bs-toggle="modal"><i class="far fa-trash-alt"></i></a>
10+
{% endif %}
11+
</div>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<div class="progress" style="width: 100%; margin-bottom: 0; height: .5rem;">
22
{% if status == 'success' %}
3-
<div class="progress-bar {% if has_errors %}bg-warning{% else %}bg-success{% endif %}" role="progressbar" style="width: 100%" aria-label="Scan progress" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
3+
<div class="progress-bar {% if has_errors %}bg-warning{% else %}bg-success{% endif %}" title="{{ status|title }}" role="progressbar" style="width: 100%" aria-label="Scan progress" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
44
{% elif status == 'failure' or status == "stopped" or status == "stale" %}
5-
<div class="progress-bar bg-danger" role="progressbar" style="width: 100%" aria-label="Scan progress" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
5+
<div class="progress-bar bg-danger" title="{{ status|title }}" role="progressbar" style="width: 100%" aria-label="Scan progress" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
66
{% elif status == 'warning' %}
7-
<div class="progress-bar bg-warning" role="progressbar" style="width: 100%" aria-label="Scan progress" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
7+
<div class="progress-bar bg-warning" title="{{ status|title }}" role="progressbar" style="width: 100%" aria-label="Scan progress" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
88
{% elif status == 'running' %}
9-
<div class="progress-bar" role="progressbar" style="width: 40%" aria-label="Scan progress" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
9+
<div class="progress-bar" title="{{ status|title }}" role="progressbar" style="width: 40%" aria-label="Scan progress" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
1010
{% elif status == 'not_started' or status == 'queued' %}
11-
<div class="progress-bar" role="progressbar" style="width: 0" aria-label="Scan progress" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
11+
<div class="progress-bar" title="{{ status|title }}" role="progressbar" style="width: 0" aria-label="Scan progress" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
1212
{% endif %}
1313
</div>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{% include 'component_catalog/includes/scan_status.html' with status=scan.runs.0.status only %}
2+
3+
<ul class="list-inline mt-1 mb-0">
4+
{% if view_url %}
5+
<li class="list-inline-item" data-bs-toggle="tooltip" data-bs-title="View Scan results">
6+
<a class="text-dark" href="{{ view_url }}#scan" target="_blank">
7+
<i class="far fa-file-alt"></i>
8+
</a>
9+
</li>
10+
{% endif %}
11+
{% if scan.download_result_url %}
12+
<li class="list-inline-item" data-bs-toggle="tooltip" data-bs-title="Download Scan results">
13+
<a class="text-dark" href="{{ scan.download_result_url }}" target="_blank">
14+
<i class="fas fa-download"></i>
15+
</a>
16+
</li>
17+
{% endif %}
18+
{% if scan.delete_url %}
19+
<li class="list-inline-item" data-bs-toggle="tooltip" data-bs-title="Delete Scan">
20+
<a class="text-dark scan_delete_link" href="#scan-delete-modal" role="button" data-delete-url="{{ scan.delete_url }}" data-bs-toggle="modal">
21+
<i class="far fa-trash-alt"></i>
22+
</a>
23+
</li>
24+
{% endif %}
25+
</ul>

product_portfolio/templates/product_portfolio/tabs/tab_inventory.html

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,31 @@
6262
</span>
6363
{{ filter_productcomponent.form.review_status }}
6464
</th>
65-
<th style="width: 106px;">
65+
<th style="width: 75px;">
6666
<span class="help_text" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="{{ help_texts.is_deployed }}">
67-
{% trans 'Deployed' %}
67+
{% trans 'Dep.' %}
6868
</span>
6969
{{ filter_productcomponent.form.is_deployed }}
7070
</th>
71-
<th style="width: 100px;">
71+
<th style="width: 75px;">
7272
<span class="help_text" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="{{ help_texts.is_modified }}">
73-
{% trans 'Modified' %}
73+
{% trans 'Mod.' %}
7474
</span>
7575
{{ filter_productcomponent.form.is_modified }}
7676
</th>
7777
{% if product.dataspace.enable_vulnerablecodedb_access %}
78-
<th style="width: 75;">
78+
<th style="width: 75px;">
7979
<span class="help_text" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="{{ help_texts.risk_score }}">
8080
{% trans 'Risk' %}
8181
</span>
8282
{{ filter_productcomponent.form.weighted_risk_score }}
8383
</th>
8484
{% endif %}
85+
{% if display_scan_features %}
86+
<th style="width: 90px;">
87+
{% trans 'Scan' %}
88+
</th>
89+
{% endif %}
8590
</tr>
8691
</thead>
8792
<tbody>
@@ -138,24 +143,20 @@
138143
{% endif %}
139144
</td>
140145
{% endif %}
141-
</tr>
142-
{% if relation.package and display_scan_features %}
143-
<tr class="{{ rowcolors }} extra-details">
144-
<td colspan="100" class="ps-4">
145-
<div class="col-2 p-0">
146-
{% if relation.scan %}
147-
<strong>{% trans 'Scan' %}:</strong> {% include 'component_catalog/includes/scan_progress.html' with scan=relation.scan view_url=relation.package.get_absolute_url compact_mode=True only %}
148-
{% else %}
149-
{% with relation.package.download_url as download_url %}
150-
<span{% if download_url %} data-bs-toggle="modal" data-bs-target="#scan-package-modal" data-package-scan-url="{% url 'component_catalog:package_scan' user.dataspace relation.package.uuid %}"{% endif %}>
151-
<button type="button" class="btn btn-outline-dark btn-sm{% if not download_url %} disabled{% endif %}" data-bs-toggle="tooltip" title="{% if download_url %}{% trans 'Submit Scan Request' %}{% else %}{% trans 'Download URL not available' %}{% endif %}"><i class="fas fa-barcode"></i> Scan</button>
152-
</span>
153-
{% endwith %}
154-
{% endif %}
155-
</div>
146+
{% if display_scan_features %}
147+
<td>
148+
{% if relation.scan %}
149+
{% include 'product_portfolio/tables/scan_progress_cell.html' with scan=relation.scan view_url=relation.package.get_absolute_url compact_mode=True only %}
150+
{% elif relation.package %}
151+
{% with relation.package.download_url as download_url %}
152+
<span{% if download_url %} data-bs-toggle="modal" data-bs-target="#scan-package-modal" data-package-scan-url="{% url 'component_catalog:package_scan' user.dataspace relation.package.uuid %}"{% endif %}>
153+
<button type="button" class="btn btn-outline-dark btn-sm{% if not download_url %} disabled{% endif %}" data-bs-toggle="tooltip" title="{% if download_url %}{% trans 'Submit Scan Request' %}{% else %}{% trans 'Download URL not available' %}{% endif %}"><i class="fas fa-barcode"></i> Scan</button>
154+
</span>
155+
{% endwith %}
156+
{% endif %}
156157
</td>
157-
</tr>
158-
{% endif %}
158+
{% endif %}
159+
</tr>
159160
{% if relation.package.download_url %}
160161
<tr class="{{ rowcolors }} extra-details">
161162
<td colspan="100" class="ps-4 text-break">

0 commit comments

Comments
 (0)