Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19fc473286 | ||
|
|
f4188b957f | ||
|
|
51736942e7 | ||
|
|
bf63046edb | ||
|
|
72274e59b5 |
+2
-1
@@ -20,7 +20,7 @@ to install the Netbox SLM plugin:
|
|||||||
|
|
||||||
1. Add ``netbox_slm`` to the ``PLUGINS`` list in
|
1. Add ``netbox_slm`` to the ``PLUGINS`` list in
|
||||||
``configuration/configuration.py``.
|
``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.
|
contents.
|
||||||
3. Create a ``Dockerfile-SLM`` with 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
|
||||||
$ python setup.py sdist
|
$ python setup.py sdist
|
||||||
$ twine upload dist/*
|
$ twine upload dist/*
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -20,7 +20,7 @@ to install the Netbox SLM plugin:
|
|||||||
|
|
||||||
1. Add ``netbox_slm`` to the ``PLUGINS`` list in
|
1. Add ``netbox_slm`` to the ``PLUGINS`` list in
|
||||||
``configuration/configuration.py``.
|
``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.
|
contents.
|
||||||
3. Create a ``Dockerfile-SLM`` with 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
|
$ python setup.py sdist
|
||||||
$ twine upload dist/*
|
$ twine upload dist/*
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class SLMConfig(PluginConfig):
|
|||||||
name = 'netbox_slm'
|
name = 'netbox_slm'
|
||||||
verbose_name = 'Software Lifecycle Management'
|
verbose_name = 'Software Lifecycle Management'
|
||||||
description = 'Software Lifecycle Management'
|
description = 'Software Lifecycle Management'
|
||||||
version = '0.1'
|
version = '0.94'
|
||||||
author = 'Hedde van der Heide'
|
author = 'Hedde van der Heide'
|
||||||
author_email = 'hedde.vanderheide@ictu.nl'
|
author_email = 'hedde.vanderheide@ictu.nl'
|
||||||
base_url = 'slm'
|
base_url = 'slm'
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class SoftwareProductSerializer(PrimaryModelSerializer):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def get_display(self, obj):
|
def get_display(self, obj):
|
||||||
return obj.name
|
return f"{obj.manufacturer.name} - {obj.name}"
|
||||||
|
|
||||||
|
|
||||||
class SoftwareProductVersionSerializer(PrimaryModelSerializer):
|
class SoftwareProductVersionSerializer(PrimaryModelSerializer):
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ class SoftwareProductVersionForm(BootstrapMixin, CustomFieldModelForm):
|
|||||||
|
|
||||||
software_product = DynamicModelChoiceField(
|
software_product = DynamicModelChoiceField(
|
||||||
queryset=SoftwareProduct.objects.all(),
|
queryset=SoftwareProduct.objects.all(),
|
||||||
required=False,
|
|
||||||
widget=APISelect(
|
widget=APISelect(
|
||||||
attrs={"data-url": reverse_lazy("plugins-api:netbox_slm-api:softwareproduct-list")}
|
attrs={"data-url": reverse_lazy("plugins-api:netbox_slm-api:softwareproduct-list")}
|
||||||
),
|
),
|
||||||
@@ -171,9 +170,10 @@ class SoftwareProductInstallationForm(BootstrapMixin, CustomFieldModelForm):
|
|||||||
model = SoftwareProductInstallation
|
model = SoftwareProductInstallation
|
||||||
fields = ("device", "virtualmachine", "software_product", "version",) # "tags")
|
fields = ("device", "virtualmachine", "software_product", "version",) # "tags")
|
||||||
|
|
||||||
# def clean(self):
|
def clean(self):
|
||||||
# import pdb;pdb.set_trace()
|
if not any([self.cleaned_data['device'], self.cleaned_data['virtualmachine']]):
|
||||||
# return super(SoftwareProductInstallationForm, self).clean()
|
raise forms.ValidationError(_("Installation requires atleast one virtualmachine or device destination."))
|
||||||
|
return super(SoftwareProductInstallationForm, self).clean()
|
||||||
|
|
||||||
|
|
||||||
class SoftwareProductInstallationFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
class SoftwareProductInstallationFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.2.9 on 2022-01-24 08:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('dcim', '0133_port_colors'),
|
||||||
|
('netbox_slm', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='softwareproduct',
|
||||||
|
name='manufacturer',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='software_products', to='dcim.manufacturer'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -17,7 +17,8 @@ class SoftwareProduct(PrimaryModel):
|
|||||||
manufacturer = models.ForeignKey(
|
manufacturer = models.ForeignKey(
|
||||||
to='dcim.Manufacturer',
|
to='dcim.Manufacturer',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='software_products'
|
related_name='software_products',
|
||||||
|
null=True, blank=True
|
||||||
)
|
)
|
||||||
|
|
||||||
objects = RestrictedQuerySet.as_manager()
|
objects = RestrictedQuerySet.as_manager()
|
||||||
@@ -95,3 +96,9 @@ class SoftwareProductInstallation(PrimaryModel):
|
|||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse("plugins:netbox_slm:softwareproductinstallation", kwargs={"pk": self.pk})
|
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'}"
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ class SoftwareProductTable(BaseTable):
|
|||||||
"installations",
|
"installations",
|
||||||
# "tags",
|
# "tags",
|
||||||
)
|
)
|
||||||
|
sequence = (
|
||||||
|
"manufacturer",
|
||||||
|
"name",
|
||||||
|
"description",
|
||||||
|
"installations",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class SoftwareProductVersionTable(BaseTable):
|
class SoftwareProductVersionTable(BaseTable):
|
||||||
@@ -76,6 +82,12 @@ class SoftwareProductVersionTable(BaseTable):
|
|||||||
"installations",
|
"installations",
|
||||||
# "tags",
|
# "tags",
|
||||||
)
|
)
|
||||||
|
sequence = (
|
||||||
|
"manufacturer",
|
||||||
|
"software_product",
|
||||||
|
"name",
|
||||||
|
"installations",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class SoftwareProductInstallationTable(BaseTable):
|
class SoftwareProductInstallationTable(BaseTable):
|
||||||
@@ -91,6 +103,11 @@ class SoftwareProductInstallationTable(BaseTable):
|
|||||||
accessor=Accessor('virtualmachine'),
|
accessor=Accessor('virtualmachine'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
platform = tables.Column(
|
||||||
|
accessor='get_platform',
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
|
type = tables.Column(accessor='render_type')
|
||||||
software_product = tables.Column(
|
software_product = tables.Column(
|
||||||
accessor=Accessor('software_product'),
|
accessor=Accessor('software_product'),
|
||||||
linkify=True
|
linkify=True
|
||||||
@@ -109,17 +126,20 @@ class SoftwareProductInstallationTable(BaseTable):
|
|||||||
fields = (
|
fields = (
|
||||||
"pk",
|
"pk",
|
||||||
"name",
|
"name",
|
||||||
"device",
|
"platform",
|
||||||
"virtualmachine",
|
"type",
|
||||||
"software_product",
|
"software_product",
|
||||||
"version",
|
"version",
|
||||||
# "tags",
|
# "tags",
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
"pk",
|
"pk",
|
||||||
"device",
|
"platform",
|
||||||
"virtualmachine",
|
"type",
|
||||||
"software_product",
|
"software_product",
|
||||||
"version",
|
"version",
|
||||||
# "tags",
|
# "tags",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def render_software_product(self, value, **kwargs):
|
||||||
|
return f"{kwargs['record'].software_product.manufacturer.name} - {value}"
|
||||||
|
|||||||
@@ -25,11 +25,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Installations</th>
|
<th scope="row">Installations</th>
|
||||||
<td>
|
<td>
|
||||||
<!-- {% for version in object.softwareproduct_versions.all %}-->
|
{{ object.get_installation_count }}
|
||||||
<!-- <a href="{% url 'plugins:netbox_slm:softwareproductversion' pk=version.pk %}">-->
|
|
||||||
<!-- <span class="badge" style="color: #ffffff; background-color: #9e9e9e">{{ version }}</span>-->
|
|
||||||
<!-- </a>-->
|
|
||||||
<!-- {% endfor %}-->
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ class SoftwareProductVersionView(generic.ObjectView):
|
|||||||
|
|
||||||
queryset = SoftwareProductVersion.objects.all()
|
queryset = SoftwareProductVersion.objects.all()
|
||||||
|
|
||||||
# def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
# records = instance.record_set.all()
|
installation_count = instance.get_installation_count()
|
||||||
# return {"records": records}
|
return {"installations": installation_count}
|
||||||
|
|
||||||
|
|
||||||
class SoftwareProductVersionEditView(generic.ObjectEditView):
|
class SoftwareProductVersionEditView(generic.ObjectEditView):
|
||||||
@@ -127,7 +127,7 @@ class SoftwareProductInstallationListView(generic.ObjectListView):
|
|||||||
class SoftwareProductInstallationView(generic.ObjectView):
|
class SoftwareProductInstallationView(generic.ObjectView):
|
||||||
"""Display SoftwareProductInstallation details"""
|
"""Display SoftwareProductInstallation details"""
|
||||||
|
|
||||||
queryset = SoftwareProductVersion.objects.all()
|
queryset = SoftwareProductInstallation.objects.all()
|
||||||
|
|
||||||
# def get_extra_context(self, request, instance):
|
# def get_extra_context(self, request, instance):
|
||||||
# records = instance.record_set.all()
|
# records = instance.record_set.all()
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = netbox-slm
|
name = netbox-slm
|
||||||
version = 0.92
|
version = 0.94
|
||||||
description = Software Lifecycle Management Netbox Plugin.
|
description = Software Lifecycle Management Netbox Plugin.
|
||||||
# long_description = file: README.rst
|
# long_description = file: README.rst
|
||||||
# long_description_content_type='text/x-rst'
|
# long_description_content_type='text/x-rst'
|
||||||
@@ -16,6 +16,7 @@ classifiers =
|
|||||||
Programming Language :: Python
|
Programming Language :: Python
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3 :: Only
|
Programming Language :: Python :: 3 :: Only
|
||||||
|
Programming Language :: Python :: 3.7
|
||||||
Programming Language :: Python :: 3.8
|
Programming Language :: Python :: 3.8
|
||||||
Programming Language :: Python :: 3.9
|
Programming Language :: Python :: 3.9
|
||||||
Topic :: Internet :: WWW/HTTP
|
Topic :: Internet :: WWW/HTTP
|
||||||
@@ -24,4 +25,4 @@ classifiers =
|
|||||||
[options]
|
[options]
|
||||||
include_package_data = true
|
include_package_data = true
|
||||||
packages = find:
|
packages = find:
|
||||||
python_requires = >=3.6
|
python_requires = >=3.7
|
||||||
|
|||||||
Reference in New Issue
Block a user