#15908: Introduce FeatureSet dataclass for tracking release features

This commit is contained in:
Jeremy Stretch 2024-07-30 16:39:46 -04:00
parent 845888c24e
commit 954eadcdc5
3 changed files with 16 additions and 4 deletions

View File

@ -32,7 +32,7 @@
{% trans "Overview" %}
</a>
</li>
{% if True or not plugin.is_local and 'commercial' not in settings.RELEASE.features %}
{% if not plugin.is_local and not settings.RELEASE.features.commercial %}
<li class="nav-item" role="presentation">
<button class="nav-link" id="install-tab" data-bs-toggle="tab" data-bs-target="#install" type="button" role="tab" aria-controls="object-list" aria-selected="false">
{% trans "Install" %}
@ -100,7 +100,7 @@
</div>
</div>
</div>
{% if True or not plugin.is_local and 'commercial' not in settings.RELEASE.features %}
{% if not plugin.is_local and not settings.RELEASE.features.commercial %}
<div class="tab-pane" id="install" role="tabpanel" aria-labelledby="install-tab">
<div class="card">
<h5 class="card-header">{% trans "Local Installation Instructions" %}</h5>

View File

@ -1,7 +1,7 @@
{% load i18n %}
{% load navigation %}
{% if 'help-center' in settings.RELEASE.features %}
{% if settings.RELEASE.features.help_center %}
{# Help center control #}
<a href="#" class="nav-link px-1" aria-label="{% trans "Help center" %}">
<i class="mdi mdi-forum-outline"></i>

View File

@ -12,13 +12,25 @@ RELEASE_PATH = 'release.yaml'
LOCAL_RELEASE_PATH = 'local/release.yaml'
@dataclass
class FeatureSet:
"""
A map of all available NetBox features.
"""
# Commercial support is provided by NetBox Labs
commercial: bool = False
# Live help center is enabled
help_center: bool = False
@dataclass
class ReleaseInfo:
version: str
edition: str
published: Union[datetime.date, None] = None
designation: Union[str, None] = None
features: List = field(default_factory=list)
features: FeatureSet = field(default_factory=FeatureSet)
@property
def full_version(self):