feat: show certificates in a separate sidebar menu
NetBox loads only one menu per plugin, so the certificate menu is registered explicitly in SLMConfig.ready(). Without top_level_menu the certificate entry stays in the shared plugin menu items. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c4c93c5709
commit
f296a576f2
3 files changed
+17
-1
No files matched your search
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
* Certificate management with type, common name, SANs, issuer, serial number, fingerprint and validity period
|
* Certificate management with type, common name, SANs, issuer, serial number, fingerprint and validity period
|
||||||
* Optional certificate assignment to software products, installations, devices, virtual machines and tenants
|
* Optional certificate assignment to software products, installations, devices, virtual machines and tenants
|
||||||
|
* Separate Certificates menu in the sidebar
|
||||||
* Daily certificate expiration notifications with the same reminder and email options as licenses
|
* Daily certificate expiration notifications with the same reminder and email options as licenses
|
||||||
* Optional tenant group and tenant assignments for software licenses
|
* Optional tenant group and tenant assignments for software licenses
|
||||||
* German translation for navigation, forms, tables, detail views, choices, and validation messages
|
* German translation for navigation, forms, tables, detail views, choices, and validation messages
|
||||||
|
|||||||
@@ -47,5 +47,11 @@ class SLMConfig(PluginConfig):
|
|||||||
|
|
||||||
from netbox_slm import jobs # noqa: F401
|
from netbox_slm import jobs # noqa: F401
|
||||||
|
|
||||||
|
from netbox.plugins.registration import register_menu
|
||||||
|
from netbox_slm import navigation
|
||||||
|
|
||||||
|
if hasattr(navigation, "certificate_menu"):
|
||||||
|
register_menu(navigation.certificate_menu)
|
||||||
|
|
||||||
|
|
||||||
config = SLMConfig
|
config = SLMConfig
|
||||||
@@ -79,6 +79,9 @@ slm_items = (
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
certificate_items = (
|
||||||
PluginMenuItem(
|
PluginMenuItem(
|
||||||
link="plugins:netbox_slm:certificate_list",
|
link="plugins:netbox_slm:certificate_list",
|
||||||
link_text=_("Certificates"),
|
link_text=_("Certificates"),
|
||||||
@@ -106,6 +109,12 @@ if get_plugin_config("netbox_slm", "top_level_menu"):
|
|||||||
groups=((SLMConfig.verbose_name, slm_items),),
|
groups=((SLMConfig.verbose_name, slm_items),),
|
||||||
icon_class="mdi mdi-content-save",
|
icon_class="mdi mdi-content-save",
|
||||||
)
|
)
|
||||||
|
# NetBox loads only one menu per plugin; this one is registered in SLMConfig.ready()
|
||||||
|
certificate_menu = PluginMenu(
|
||||||
|
label=_("Certificates"),
|
||||||
|
groups=((_("Certificates"), certificate_items),),
|
||||||
|
icon_class="mdi mdi-certificate",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# auto imported by default PluginConfig.menu_items = navigation.menu_items
|
# auto imported by default PluginConfig.menu_items = navigation.menu_items
|
||||||
menu_items = slm_items
|
menu_items = slm_items + certificate_items
|
||||||
Reference in new issue
Block a user