mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
Simplify plugin attributes for is_installed column
This commit is contained in:
parent
633d0c9b79
commit
f9347122c2
@ -64,9 +64,8 @@ class Plugin:
|
|||||||
is_certified: bool = False
|
is_certified: bool = False
|
||||||
release_latest: PluginVersion = field(default_factory=PluginVersion)
|
release_latest: PluginVersion = field(default_factory=PluginVersion)
|
||||||
release_recent_history: list[PluginVersion] = field(default_factory=list)
|
release_recent_history: list[PluginVersion] = field(default_factory=list)
|
||||||
is_local: bool = False # extra field for locally installed plugins
|
is_local: bool = False # Indicates that the plugin is listed in settings.PLUGINS (i.e. installed)
|
||||||
is_installed: bool = False
|
is_loaded: bool = False # Indicates whether the plugin successfully loaded at launch
|
||||||
failed_to_load: bool = False
|
|
||||||
installed_version: str = ''
|
installed_version: str = ''
|
||||||
netbox_min_version: str = ''
|
netbox_min_version: str = ''
|
||||||
netbox_max_version: str = ''
|
netbox_max_version: str = ''
|
||||||
@ -94,8 +93,7 @@ def get_local_plugins(plugins=None):
|
|||||||
tag_line=plugin_config.description,
|
tag_line=plugin_config.description,
|
||||||
description_short=plugin_config.description,
|
description_short=plugin_config.description,
|
||||||
is_local=True,
|
is_local=True,
|
||||||
is_installed=True,
|
is_loaded=plugin_name in registry['plugins']['installed'],
|
||||||
failed_to_load=plugin_name not in registry['plugins']['installed'],
|
|
||||||
installed_version=installed_version,
|
installed_version=installed_version,
|
||||||
netbox_min_version=plugin_config.min_version,
|
netbox_min_version=plugin_config.min_version,
|
||||||
netbox_max_version=plugin_config.max_version,
|
netbox_max_version=plugin_config.max_version,
|
||||||
@ -104,8 +102,8 @@ def get_local_plugins(plugins=None):
|
|||||||
# Update catalog entries for local plugins, or add them to the list if not listed
|
# Update catalog entries for local plugins, or add them to the list if not listed
|
||||||
for k, v in local_plugins.items():
|
for k, v in local_plugins.items():
|
||||||
if k in plugins:
|
if k in plugins:
|
||||||
plugins[k].is_local = True
|
plugins[k].is_local = v.is_local
|
||||||
plugins[k].is_installed = v.is_installed
|
plugins[k].is_loaded = v.is_loaded
|
||||||
plugins[k].installed_version = v.installed_version
|
plugins[k].installed_version = v.installed_version
|
||||||
else:
|
else:
|
||||||
plugins[k] = v
|
plugins[k] = v
|
||||||
|
@ -16,10 +16,12 @@ OBJECTCHANGE_REQUEST_ID = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
PLUGIN_IS_INSTALLED = """
|
PLUGIN_IS_INSTALLED = """
|
||||||
{% if record.failed_to_load %}
|
{% if record.is_local %}
|
||||||
<span class="text-danger"><i class="mdi mdi-alert" data-bs-toggle="tooltip" title="Could not load due to NetBox version incompatibility. Min version: {{ record.netbox_min_version }}, max version: {{ record.netbox_max_version }}"></i></span>
|
{% if record.is_loaded %}
|
||||||
{% elif value is True %}
|
<span class="text-success"><i class="mdi mdi-check-bold"></i></span>
|
||||||
<span class="text-success"><i class="mdi mdi-check-bold"></i></span>
|
{% else %}
|
||||||
|
<span class="text-danger"><i class="mdi mdi-alert" data-bs-toggle="tooltip" title="Could not load plugin. Version may be incompatible. Min version: {{ record.netbox_min_version }}, max version: {{ record.netbox_max_version }}"></i></span>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="text-danger"><i class="mdi mdi-close-thick"></i></span>
|
<span class="text-danger"><i class="mdi mdi-close-thick"></i></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user