Skip to content

Commit 1f6db43

Browse files
authored
Refine the consistency of Product import actions #241 (#268)
Signed-off-by: tdruez <[email protected]>
1 parent 4e3b875 commit 1f6db43

26 files changed

+386
-196
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ Release notes
109109
Owner not found in the Dataspace are now automatically created.
110110
https://github.com/aboutcode-org/dejacode/issues/239
111111

112+
- Updated the label of the following Product actions.
113+
The labels were updated everywhere in the UI (page title, documentation,
114+
import log, etc...) for consistency:
115+
- Import data from Scan -> Import ScanCode scan results
116+
- Load Packages from SBOMs -> Import SBOM
117+
- Import Packages from manifests -> Import Package manifests
118+
- Pull ScanCode.io Project data -> Import ScanCode.io project
119+
Improve the rendering and layout of the Import related forms for consistency,
120+
simplicity, and readability.
121+
https://github.com/aboutcode-org/dejacode/issues/241
122+
112123
### Version 5.2.1
113124

114125
- Fix the models documentation navigation.

component_catalog/templates/component_catalog/includes/scan_status.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<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>
44
{% elif status == 'failure' or status == "stopped" or status == "stale" %}
55
<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>
6+
{% 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>
68
{% elif status == 'running' %}
79
<div class="progress-bar" role="progressbar" style="width: 40%" aria-label="Scan progress" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
810
{% elif status == 'not_started' or status == 'queued' %}

dejacode/static/css/dejacode_bootstrap.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,12 @@ div.awesomplete {
590590
[data-bs-theme=dark] .awesomplete > ul {
591591
background: var(--bs-black);
592592
}
593-
594593
#div_id_component .awesomplete {
595594
display: inline-block !important;
596595
}
596+
label.requiredField {
597+
font-weight: bolder;
598+
}
597599

598600
/* -- Products comparison -- */
599601
body.product-comparison tr.unchanged {

dje/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def pull_project_data_from_scancodeio(scancodeproject_uuid):
197197
)
198198

199199
if scancode_project.type == scancode_project.ProjectType.LOAD_SBOMS:
200-
notification_verb = "Load Packages from SBOMs"
200+
notification_verb = "Import SBOM"
201201
else:
202202
notification_verb = "Import packages from ScanCode.io"
203203

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{% if form.errors %}
2-
<div class="alert alert-danger alert-dismissible" role="alert">
3-
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
2+
<div class="alert alert-danger" role="alert">
43
<p class="m-0">Please correct the error{{ form.errors|pluralize }} below.</p>
54
</div>
65
{% endif %}

dje/tests/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from django.conf import settings
1515
from django.contrib.auth import get_user_model
1616
from django.contrib.auth.models import Permission
17+
from django.core.files.uploadedfile import TemporaryUploadedFile
1718
from django.db import DEFAULT_DB_ALIAS
1819
from django.db import connections
1920
from django.test.runner import DiscoverRunner
@@ -124,3 +125,20 @@ def assertMaxQueries(self, num, func=None, *args, using=DEFAULT_DB_ALIAS, **kwar
124125

125126
with context:
126127
func(*args, **kwargs)
128+
129+
130+
def wrap_as_temp_uploaded_file(file_path):
131+
"""Wrap an existing file as a Django TemporaryUploadedFile"""
132+
temp_file = TemporaryUploadedFile(
133+
name=file_path.name,
134+
content_type="application/json",
135+
size=file_path.stat().st_size,
136+
charset="utf-8",
137+
)
138+
139+
# Read and copy file content into the temporary file
140+
with open(file_path, "rb") as f:
141+
temp_file.write(f.read())
142+
143+
temp_file.seek(0) # Reset pointer after writing
144+
return temp_file

docs/reference-1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Reference 1 - Declared License Expression and License Clarity Scoring
55
=====================================================================
66

77
When you scan a Package from DejaCode, you can view the Scan Results in a
8-
:guilabel:`Action` tab on the Package details user view. DejaCode presents a selection of
8+
:guilabel:`Actions` tab on the Package details user view. DejaCode presents a selection of
99
scan details with an emphasis on license detection. You can also download the
1010
complete :guilabel:`Scan Results` in .json format.
1111

docs/tutorial-1.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Alternatively, you can conveniently download one of the provided examples from
2929
the following
3030
`GitHub repository <https://github.com/aboutcode-org/dejacode/tree/main/docs/sboms/>`_.
3131

32-
On the Product details page, from the :guilabel:`Action` dropdown, select
33-
:guilabel:`Load Packages from SBOMs`:
32+
On the Product details page, from the :guilabel:`Actions` dropdown, select
33+
:guilabel:`Import SBOM`:
3434

3535
* Click the :guilabel:`Choose File` button on the **SBOM file or zip archive** field.
3636
* Select your SBOM (.cdx.json or .spdx.json) and click the :guilabel:`Open` button.

docs/tutorial-2.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Click the green :guilabel:`Add` button.
2121

2222
DejaCode presents the new Package.
2323

24-
- Refresh your browser page to see the :guilabel:`Action` tab.
24+
- Refresh your browser page to see the :guilabel:`Actions` tab.
2525
- Explore the scan results.
2626
- Select values to apply to the new Package definition, such as one or more licenses,
2727
a Copyright statement, and a Primary langauge.
@@ -109,7 +109,7 @@ Improve Package Data by Scanning
109109
Select :guilabel:`Packages` from the main menu bar.
110110

111111
Identify and select a Package that needs to be improved.
112-
Click the :guilabel:`Action` button on the Package details form.
112+
Click the :guilabel:`Actions` button on the Package details form.
113113

114114
Optionally follow the progress of the Scan by selecting the :guilabel:`Scans`
115115
option from the :guilabel:`Tools` dropdown on the main menu bar.

docs/tutorial-4-vulnerabilities.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Load Scan Results to your Product
2626

2727
`<https://github.com/aboutcode-org/dejacode/tree/main/docs/sboms/starship_engine_2.0_scan_results.json>`_.
2828

29-
2. On the Product details page, from the :guilabel:`Action` dropdown, select
30-
:guilabel:`Import from Scan`:
29+
2. On the Product details page, from the :guilabel:`Actions` dropdown, select
30+
:guilabel:`Import ScanCode scan results`:
3131

3232
* Click the :guilabel:`Choose File` button under the **Upload file** field.
3333
* Select the **starship_engine_2.0_scan_results.json** file and click the

0 commit comments

Comments
 (0)