8000 Show the individual PURL fields in the Package details view #83 by tdruez · Pull Request #85 · aboutcode-org/dejacode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Show the individual PURL fields in the Package details view #83 #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Release notes
- Add a DEJACODE_SUPPORT_EMAIL setting for support email address customization.
https://github.com/nexB/dejacode/issues/76

- Show the individual PURL fields in the Package details view.
https://github.com/nexB/dejacode/issues/83

### Version 5.0.1

- Improve the stability of the "Check for new Package versions" feature.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<dt class="col-sm-2 text-end pt-2 pe-0">
&nbsp;
</dt>
<dd class="col-sm-10">
<div class="container px-0">
<div class="row align-items-start">
<div class="col">
<span class="help_text" data-bs-placement="right" data-bs-toggle="tooltip" data-bs-title="{{ values.help_texts.type }}">
Type
</span>
<pre class="pre-bg-body-tertiary mt-1 mb-2">{{ values.package.type|default:"&nbsp;" }}</pre>
</div>
<div class="col">
<span class="help_text" data-bs-placement="right" data-bs-toggle="tooltip" data-bs-title="{{ values.help_texts.namespace }}">
Namespace
</span>
<pre class="pre-bg-body-tertiary mt-1 mb-2">{{ values.package.namespace|default:"&nbsp;" }}</pre>
</div>
<div class="col">
<span class="help_text" data-bs-placement="right" data-bs-toggle="tooltip" data-bs-title="{{ values.help_texts.name }}">
Name
</span>
<pre class="pre-bg-body-tertiary mt-1 mb-2">{{ values.package.name|default:"&nbsp;" }}</pre>
</div>
<div class="col">
<span class="help_text" data-bs-placement="right" data-bs-toggle="tooltip" data-bs-title="{{ values.help_texts.version }}">
Version
</span>
<pre class="pre-bg-body-tertiary mt-1 mb-2">{{ values.package.version|default:"&nbsp;" }}</pre>
</div>
</div>
{% if package.qualifiers or package.subpath %}
<div class="row align-items-start">
<div class="col">
<span class="help_text" data-bs-placement="right" data-bs-toggle="tooltip" data-bs-title="{{ values.help_texts.qualifiers }}">
Qualifiers
</span>
<pre class="pre-bg-body-tertiary mt-1 mb-2">{{ values.package.qualifiers|default:"&nbsp;" }}</pre>
</div>
<div class="col">
<span class="help_text" data-bs-placement="right" data-bs-toggle="tooltip" data-bs-title="{{ values.help_texts.subpath }}">
Subpath
</span>
<pre class="pre-bg-body-tertiary mt-1 mb-2">{{ values.package.subpath|default:"&nbsp;" }}</pre>
</div>
</div>
{% endif %}
</div>
</dd>
2 changes: 1 addition & 1 deletion dje/templates/tabs/tab_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% if template_name %}
{% include template_name %}
{% else %}
{% include 'tabs/tab_default.html' %}
{% include 'tabs/field_default.html' %}
{% endif %}
{% endfor %}
{% if tab_context.extra %}
Expand Down
13 changes: 13 additions & 0 deletions dje/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,8 @@ def tab_history(self):
}

def get_package_fields(self, package, essential_tab=False):
from component_catalog.models import PACKAGE_URL_FIELDS

# Always displayed in the Package "Essentials" tab context but only
# displayed if a value is available in the Component "Packages" tab.
essential_else_bool = None if essential_tab else bool
Expand All @@ -1024,9 +1026,20 @@ def show_usage_policy(value):
(_("Identifier"), package.get_absolute_link(), package.identifier_help(), None)
)

package_url_fields_context = {
"package": package,
"help_texts": {field: ght(package._meta, field) for field in PACKAGE_URL_FIELDS},
}

tab_fields.extend(
[
(_("Package URL"), package.package_url, package.package_url_help(), None),
(
"",
package_url_fields_context,
None,
"component_catalog/tabs/field_package_url_fields.html",
),
TabField("filename", package, condition=essential_else_bool),
TabField(
"usage_policy",
Expand Down
0