Skip to content

Commit b242781

Browse files
authored
Add "Product name" and "Product version" as new project settings #1197 (#1204)
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent bfe4c77 commit b242781

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ v34.5.0 (unreleased)
2525

2626
- Fix `inspect_packages` pipeline to properly link discovered packages and dependencies to
2727
codebase resources of package manifests where they were found. Also correctly assign
28-
the datasource_ids atrribute for packages and dependencies.
29-
https://github.com/nexB/scancode.io/pull/1180/
28+
the datasource_ids attribute for packages and dependencies.
29+
https://github.com/nexB/scancode.io/pull/1180
30+
31+
- Add "Product name" and "Product version" as new project settings.
32+
https://github.com/nexB/scancode.io/issues/1197
3033

3134
v34.4.0 (2024-04-22)
3235
--------------------

scanpipe/forms.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ class ProjectSettingsForm(forms.ModelForm):
281281
"ignored_patterns",
282282
"scancode_license_score",
283283
"attribution_template",
284+
"product_name",
285+
"product_version",
284286
]
285287
extract_recursively = forms.BooleanField(
286288
label="Extract recursively",
@@ -318,6 +320,16 @@ class ProjectSettingsForm(forms.ModelForm):
318320
help_text="Custom attribution template.",
319321
widget=forms.Textarea(attrs={"class": "textarea is-dynamic", "rows": 3}),
320322
)
323+
product_name = forms.CharField(
324+
label="Product name",
325+
required=False,
326+
widget=forms.TextInput(attrs={"class": "input"}),
327+
)
328+
product_version = forms.CharField(
329+
label="Product version",
330+
required=False,
331+
widget=forms.TextInput(attrs={"class": "input"}),
332+
)
321333

322334
class Meta:
323335
model = Project

scanpipe/templates/scanpipe/includes/project_settings_menu.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
<i class="fa-solid fa-barcode mr-2"></i>ScanCode
2121
</a>
2222
</li>
23+
<li>
24+
<a href="#dejacode">
25+
<i class="fa-solid fa-laptop-code mr-2"></i>DejaCode
26+
</a>
27+
</li>
2328
<li>
2429
<a href="#attribution">
2530
<i class="fa-solid fa-file-lines mr-2"></i>Attribution

scanpipe/templates/scanpipe/project_settings.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,30 @@
9393
</div>
9494
</div>
9595

96+
<div class="panel">
97+
<p id="dejacode" class="panel-heading py-2 is-size-6">DejaCode</p>
98+
<div class="panel-block is-block px-4">
99+
<div class="field">
100+
<label class="label" for="{{ form.product_name.id_for_label }}">
101+
Product name
102+
</label>
103+
<div class="control">
104+
{{ form.product_name }}
105+
</div>
106+
<p class="help">{{ form.product_name.help_text }}</p>
107+
</div>
108+
<div class="field">
109+
<label class="label" for="{{ form.product_version.id_for_label }}">
110+
Product version
111+
</label>
112+
<div class="control">
113+
{{ form.product_version }}
114+
</div>
115+
<p class="help">{{ form.product_version.help_text }}</p>
116+
</div>
117+
</div>
118+
</div>
119+
96120
<div class="panel">
97121
<p id="attribution" class="panel-heading py-2 is-size-6">Attribution</p>
98122
<div class="panel-block is-block px-4">

scanpipe/tests/test_forms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def test_scanpipe_forms_project_settings_form_update_project_settings(self):
136136
expected = {
137137
"extract_recursively": False,
138138
"ignored_patterns": ["*.ext", "dir/*"],
139+
"product_name": "",
140+
"product_version": "",
139141
"attribution_template": "",
140142
"scancode_license_score": 10,
141143
}

0 commit comments

Comments
 (0)