3 Commits
8 changed files with 41 additions and 19 deletions
+2 -1
View File
@@ -20,7 +20,7 @@ to install the Netbox SLM plugin:
1. Add ``netbox_slm`` to the ``PLUGINS`` list in
``configuration/configuration.py``.
2. Create a ``plugin_requirements.txt`` with ``netbox-slm==0.9`` as
2. Create a ``plugin_requirements.txt`` with ``netbox-slm==0.93`` as
contents.
3. Create a ``Dockerfile-SLM`` with contents:
@@ -63,6 +63,7 @@ directory run
::
# make sure to update the version in netbox_slm/__init__.py and setup.cfg
$ python setup.py sdist
$ twine upload dist/*
+1 -1
View File
@@ -5,7 +5,7 @@ class SLMConfig(PluginConfig):
name = 'netbox_slm'
verbose_name = 'Software Lifecycle Management'
description = 'Software Lifecycle Management'
version = '0.93'
version = '0.94'
author = 'Hedde van der Heide'
author_email = 'hedde.vanderheide@ictu.nl'
base_url = 'slm'
+1 -1
View File
@@ -21,7 +21,7 @@ class SoftwareProductSerializer(PrimaryModelSerializer):
]
def get_display(self, obj):
return obj.name
return f"{obj.manufacturer.name} - {obj.name}"
class SoftwareProductVersionSerializer(PrimaryModelSerializer):
+6
View File
@@ -96,3 +96,9 @@ class SoftwareProductInstallation(PrimaryModel):
def get_absolute_url(self):
return reverse("plugins:netbox_slm:softwareproductinstallation", kwargs={"pk": self.pk})
def get_platform(self):
return self.device or self.virtualmachine
def render_type(self):
return f"{'device' if self.device else 'virtualmachine'}"
+24 -4
View File
@@ -37,6 +37,12 @@ class SoftwareProductTable(BaseTable):
"installations",
# "tags",
)
sequence = (
"manufacturer",
"name",
"description",
"installations",
)
class SoftwareProductVersionTable(BaseTable):
@@ -76,6 +82,12 @@ class SoftwareProductVersionTable(BaseTable):
"installations",
# "tags",
)
sequence = (
"manufacturer",
"software_product",
"name",
"installations",
)
class SoftwareProductInstallationTable(BaseTable):
@@ -91,6 +103,11 @@ class SoftwareProductInstallationTable(BaseTable):
accessor=Accessor('virtualmachine'),
linkify=True
)
platform = tables.Column(
accessor='get_platform',
linkify=True
)
type = tables.Column(accessor='render_type')
software_product = tables.Column(
accessor=Accessor('software_product'),
linkify=True
@@ -109,17 +126,20 @@ class SoftwareProductInstallationTable(BaseTable):
fields = (
"pk",
"name",
"device",
"virtualmachine",
"platform",
"type",
"software_product",
"version",
# "tags",
)
default_columns = (
"pk",
"device",
"virtualmachine",
"platform",
"type",
"software_product",
"version",
# "tags",
)
def render_software_product(self, value, **kwargs):
return f"{kwargs['record'].software_product.manufacturer.name} - {value}"
@@ -25,11 +25,7 @@
<tr>
<th scope="row">Installations</th>
<td>
<!-- {% for version in object.softwareproduct_versions.all %}-->
<!-- <a href="{% url 'plugins:netbox_slm:softwareproductversion' pk=version.pk %}">-->
<!-- <span class="badge" style="color: #ffffff; background-color: #9e9e9e">{{ version }}</span>-->
<!-- </a>-->
<!-- {% endfor %}-->
{{ object.get_installation_count }}
</td>
</tr>
</table>
+4 -4
View File
@@ -78,9 +78,9 @@ class SoftwareProductVersionView(generic.ObjectView):
queryset = SoftwareProductVersion.objects.all()
# def get_extra_context(self, request, instance):
# records = instance.record_set.all()
# return {"records": records}
def get_extra_context(self, request, instance):
installation_count = instance.get_installation_count()
return {"installations": installation_count}
class SoftwareProductVersionEditView(generic.ObjectEditView):
@@ -127,7 +127,7 @@ class SoftwareProductInstallationListView(generic.ObjectListView):
class SoftwareProductInstallationView(generic.ObjectView):
"""Display SoftwareProductInstallation details"""
queryset = SoftwareProductVersion.objects.all()
queryset = SoftwareProductInstallation.objects.all()
# def get_extra_context(self, request, instance):
# records = instance.record_set.all()
+2 -3
View File
@@ -1,6 +1,6 @@
[metadata]
name = netbox-slm
version = 0.93
version = 0.94
description = Software Lifecycle Management Netbox Plugin.
# long_description = file: README.rst
# long_description_content_type='text/x-rst'
@@ -16,7 +16,6 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
@@ -26,4 +25,4 @@ classifiers =
[options]
include_package_data = true
packages = find:
python_requires = >=3.6
python_requires = >=3.7