Skip to content

Commit

Permalink
Add "Product name" and "Product version" as new project settings #1197
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed May 6, 2024
1 parent 6aa0afc commit 271cb45
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ v34.5.0 (unreleased)

- Fix `inspect_packages` pipeline to properly link discovered packages and dependencies to
codebase resources of package manifests where they were found. Also correctly assign
the datasource_ids atrribute for packages and dependencies.
https://github.com/nexB/scancode.io/pull/1180/
the datasource_ids attribute for packages and dependencies.
https://github.com/nexB/scancode.io/pull/1180

- Add "Product name" and "Product version" as new project settings.
https://github.com/nexB/scancode.io/issues/1197

v34.4.0 (2024-04-22)
--------------------
Expand Down
12 changes: 12 additions & 0 deletions scanpipe/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ class ProjectSettingsForm(forms.ModelForm):
"ignored_patterns",
"scancode_license_score",
"attribution_template",
"product_name",
"product_version",
]
extract_recursively = forms.BooleanField(
label="Extract recursively",
Expand Down Expand Up @@ -318,6 +320,16 @@ class ProjectSettingsForm(forms.ModelForm):
help_text="Custom attribution template.",
widget=forms.Textarea(attrs={"class": "textarea is-dynamic", "rows": 3}),
)
product_name = forms.CharField(
label="Product name",
required=False,
widget=forms.TextInput(attrs={"class": "input"}),
)
product_version = forms.CharField(
label="Product version",
required=False,
widget=forms.TextInput(attrs={"class": "input"}),
)

class Meta:
model = Project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<i class="fa-solid fa-barcode mr-2"></i>ScanCode
</a>
</li>
<li>
<a href="#dejacode">
<i class="fa-solid fa-laptop-code mr-2"></i>DejaCode
</a>
</li>
<li>
<a href="#attribution">
<i class="fa-solid fa-file-lines mr-2"></i>Attribution
Expand Down
24 changes: 24 additions & 0 deletions scanpipe/templates/scanpipe/project_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,30 @@
</div>
</div>

<div class="panel">
<p id="dejacode" class="panel-heading py-2 is-size-6">DejaCode</p>
<div class="panel-block is-block px-4">
<div class="field">
<label class="label" for="{{ form.product_name.id_for_label }}">
Product name
</label>
<div class="control">
{{ form.product_name }}
</div>
<p class="help">{{ form.product_name.help_text }}</p>
</div>
<div class="field">
<label class="label" for="{{ form.product_version.id_for_label }}">
Product version
</label>
<div class="control">
{{ form.product_version }}
</div>
<p class="help">{{ form.product_version.help_text }}</p>
</div>
</div>
</div>

<div class="panel">
<p id="attribution" class="panel-heading py-2 is-size-6">Attribution</p>
<div class="panel-block is-block px-4">
Expand Down
2 changes: 2 additions & 0 deletions scanpipe/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def test_scanpipe_forms_project_settings_form_update_project_settings(self):
expected = {
"extract_recursively": False,
"ignored_patterns": ["*.ext", "dir/*"],
"product_name": "",
"product_version": "",
"attribution_template": "",
"scancode_license_score": 10,
}
Expand Down

0 comments on commit 271cb45

Please sign in to comment.