diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index fd6fdcb..c62636b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.11" - name: Install tools run: pip install .[tools] diff --git a/ci/Dockerfile b/ci/Dockerfile index fd82aa7..bc4ef09 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.10 +ARG PYTHON_VERSION=3.11 FROM python:${PYTHON_VERSION}-alpine AS compile-image WORKDIR /build @@ -11,7 +11,7 @@ RUN pip install -U .[build] RUN python -m build RUN pip install --no-index /build -FROM netboxcommunity/netbox:v3.7.2 +FROM netboxcommunity/netbox:v4.0.6 -ARG PYTHON_VERSION=3.10 +ARG PYTHON_VERSION=3.11 COPY --from=compile-image /opt/netbox/venv/lib/python${PYTHON_VERSION}/site-packages/netbox_slm /opt/netbox/venv/lib/python${PYTHON_VERSION}/site-packages/netbox_slm diff --git a/ci/Dockerfile-CI b/ci/Dockerfile-CI index 7be4eeb..c21d0b3 100644 --- a/ci/Dockerfile-CI +++ b/ci/Dockerfile-CI @@ -1,4 +1,4 @@ -FROM netboxcommunity/netbox:v3.7.2 +FROM netboxcommunity/netbox:v4.0.6 RUN mkdir /ci && chmod go+w /ci COPY ../ci/requirements_ci.txt /ci/ diff --git a/ci/docker-compose.ci.yml b/ci/docker-compose.ci.yml index 0939273..30b49e3 100644 --- a/ci/docker-compose.ci.yml +++ b/ci/docker-compose.ci.yml @@ -1,4 +1,4 @@ -version: '3.7' +--- services: netbox: ports: diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml index 67ffe55..f7965b9 100644 --- a/ci/docker-compose.yml +++ b/ci/docker-compose.yml @@ -1,7 +1,7 @@ -version: '3.7' +--- services: netbox: &netbox - image: netboxcommunity/netbox:${VERSION-v3.7.2} + image: netboxcommunity/netbox:${VERSION-v4.0.6} depends_on: - postgres - redis diff --git a/ci/requirements_ci.txt b/ci/requirements_ci.txt index eca0d7a..f98f879 100644 --- a/ci/requirements_ci.txt +++ b/ci/requirements_ci.txt @@ -1,2 +1,2 @@ -coverage==7.2.2 +coverage==7.5.4 unittest-xml-reporting==3.2.0 diff --git a/netbox_slm/__init__.py b/netbox_slm/__init__.py index 127d809..fc15c18 100644 --- a/netbox_slm/__init__.py +++ b/netbox_slm/__init__.py @@ -1,4 +1,4 @@ -from extras.plugins import PluginConfig +from netbox.plugins import PluginConfig __version__ = "1.6.0" diff --git a/netbox_slm/api/serializers.py b/netbox_slm/api/serializers.py index 7b2f508..e6e1e0f 100644 --- a/netbox_slm/api/serializers.py +++ b/netbox_slm/api/serializers.py @@ -10,7 +10,7 @@ class SoftwareLicenseSerializer(NetBoxModelSerializer): class Meta: model = SoftwareLicense - fields = [ + fields = ( "id", "display", "url", @@ -31,7 +31,8 @@ class Meta: "custom_field_data", "created", "last_updated", - ] + ) + brief_fields = ("id", "display", "url", "name", "description") def get_display(self, obj): return f"{obj}" @@ -43,7 +44,7 @@ class SoftwareProductSerializer(NetBoxModelSerializer): class Meta: model = SoftwareProduct - fields = [ + fields = ( "id", "display", "url", @@ -55,7 +56,8 @@ class Meta: "custom_field_data", "created", "last_updated", - ] + ) + brief_fields = ("id", "display", "url", "name", "description") def get_display(self, obj): return f"{obj.manufacturer} - {obj}" @@ -69,7 +71,7 @@ class SoftwareProductInstallationSerializer(NetBoxModelSerializer): class Meta: model = SoftwareProductInstallation - fields = [ + fields = ( "id", "display", "url", @@ -83,7 +85,8 @@ class Meta: "custom_field_data", "created", "last_updated", - ] + ) + brief_fields = ("id", "display", "url", "name") def get_display(self, obj): return f"{obj}" @@ -95,7 +98,7 @@ class SoftwareProductVersionSerializer(NetBoxModelSerializer): class Meta: model = SoftwareProductVersion - fields = [ + fields = ( "id", "display", "url", @@ -113,7 +116,8 @@ class Meta: "custom_field_data", "created", "last_updated", - ] + ) + brief_fields = ("id", "display", "url", "name") def get_display(self, obj): return f"{obj}" diff --git a/netbox_slm/forms/software_license.py b/netbox_slm/forms/software_license.py index 1c35d00..1f50082 100644 --- a/netbox_slm/forms/software_license.py +++ b/netbox_slm/forms/software_license.py @@ -4,6 +4,7 @@ from netbox.forms import NetBoxModelForm, NetBoxModelImportForm, NetBoxModelBulkEditForm, NetBoxModelFilterSetForm from netbox_slm.models import SoftwareProduct, SoftwareProductVersion, SoftwareProductInstallation, SoftwareLicense from utilities.forms.fields import CommentField, DynamicModelChoiceField, TagFilterField, LaxURLField +from utilities.forms.rendering import FieldSet from utilities.forms.widgets import APISelect, DatePicker @@ -62,7 +63,7 @@ class Meta: class SoftwareLicenseFilterForm(NetBoxModelFilterSetForm): model = SoftwareLicense - fieldsets = ((None, ("q", "tag")),) + fieldsets = (FieldSet(None, ("q", "tag")),) tag = TagFilterField(model) @@ -85,13 +86,4 @@ class SoftwareLicenseBulkEditForm(NetBoxModelBulkEditForm): version = DynamicModelChoiceField(queryset=SoftwareProductVersion.objects.all(), required=False) installation = DynamicModelChoiceField(queryset=SoftwareProductInstallation.objects.all(), required=False) model = SoftwareLicense - fieldsets = ( - ( - None, - ( - "software_product", - "version", - "installation", - ), - ), - ) + fieldsets = (FieldSet(None, ("software_product", "version", "installation")),) diff --git a/netbox_slm/forms/software_product.py b/netbox_slm/forms/software_product.py index 8705344..7a7afe1 100644 --- a/netbox_slm/forms/software_product.py +++ b/netbox_slm/forms/software_product.py @@ -4,6 +4,7 @@ from netbox.forms import NetBoxModelForm, NetBoxModelImportForm, NetBoxModelBulkEditForm, NetBoxModelFilterSetForm from netbox_slm.models import SoftwareProduct from utilities.forms.fields import CommentField, DynamicModelChoiceField, TagFilterField +from utilities.forms.rendering import FieldSet class SoftwareProductForm(NetBoxModelForm): @@ -29,7 +30,7 @@ class Meta: class SoftwareProductFilterForm(NetBoxModelFilterSetForm): model = SoftwareProduct - fieldsets = ((None, ("q", "tag")),) + fieldsets = (FieldSet(None, ("q", "tag")),) tag = TagFilterField(model) diff --git a/netbox_slm/forms/software_product_installation.py b/netbox_slm/forms/software_product_installation.py index 24c2546..9643041 100644 --- a/netbox_slm/forms/software_product_installation.py +++ b/netbox_slm/forms/software_product_installation.py @@ -5,6 +5,7 @@ from netbox.forms import NetBoxModelForm, NetBoxModelImportForm, NetBoxModelBulkEditForm, NetBoxModelFilterSetForm from netbox_slm.models import SoftwareProductInstallation, SoftwareProduct, SoftwareProductVersion from utilities.forms.fields import CommentField, DynamicModelChoiceField, TagFilterField +from utilities.forms.rendering import FieldSet from utilities.forms.widgets import APISelect from virtualization.models import VirtualMachine, Cluster @@ -56,7 +57,7 @@ def clean_version(self): class SoftwareProductInstallationFilterForm(NetBoxModelFilterSetForm): model = SoftwareProductInstallation - fieldsets = ((None, ("q", "tag")),) + fieldsets = (FieldSet(None, ("q", "tag")),) tag = TagFilterField(model) @@ -70,12 +71,4 @@ class SoftwareProductInstallationBulkEditForm(NetBoxModelBulkEditForm): software_product = DynamicModelChoiceField(queryset=SoftwareProduct.objects.all(), required=False) version = DynamicModelChoiceField(queryset=SoftwareProductVersion.objects.all(), required=False) model = SoftwareProductInstallation - fieldsets = ( - ( - None, - ( - "software_product", - "version", - ), - ), - ) + fieldsets = (FieldSet(None, ("software_product", "version")),) diff --git a/netbox_slm/forms/software_product_version.py b/netbox_slm/forms/software_product_version.py index 34ff1f4..e385b11 100644 --- a/netbox_slm/forms/software_product_version.py +++ b/netbox_slm/forms/software_product_version.py @@ -4,6 +4,7 @@ from netbox.forms import NetBoxModelForm, NetBoxModelImportForm, NetBoxModelBulkEditForm, NetBoxModelFilterSetForm from netbox_slm.models import SoftwareProduct, SoftwareProductVersion from utilities.forms.fields import CommentField, DynamicModelChoiceField, TagFilterField +from utilities.forms.rendering import FieldSet from utilities.forms.widgets import APISelect, DatePicker @@ -39,7 +40,7 @@ class Meta: class SoftwareProductVersionFilterForm(NetBoxModelFilterSetForm): model = SoftwareProductVersion - fieldsets = ((None, ("q", "tag")),) + fieldsets = (FieldSet(None, ("q", "tag")),) tag = TagFilterField(model) diff --git a/netbox_slm/navigation.py b/netbox_slm/navigation.py index 13b1423..07ccccc 100644 --- a/netbox_slm/navigation.py +++ b/netbox_slm/navigation.py @@ -1,5 +1,4 @@ -from extras.plugins import PluginMenuButton, PluginMenuItem -from utilities.choices import ButtonColorChoices +from netbox.plugins import PluginMenuButton, PluginMenuItem menu_items = ( PluginMenuItem( @@ -10,14 +9,12 @@ "plugins:netbox_slm:softwareproduct_add", "Add", "mdi mdi-plus-thick", - ButtonColorChoices.GREEN, permissions=["netbox_slm.add_softwareproduct"], ), PluginMenuButton( "plugins:netbox_slm:softwareproduct_import", "Import", "mdi mdi-upload", - ButtonColorChoices.CYAN, permissions=["netbox_slm.add_softwareproduct"], ), ), @@ -30,14 +27,12 @@ "plugins:netbox_slm:softwareproductversion_add", "Add", "mdi mdi-plus-thick", - ButtonColorChoices.GREEN, permissions=["netbox_slm.add_softwareproductversion"], ), PluginMenuButton( "plugins:netbox_slm:softwareproductversion_import", "Import", "mdi mdi-upload", - ButtonColorChoices.CYAN, permissions=["netbox_slm.add_softwareproductversion"], ), ), @@ -50,14 +45,12 @@ "plugins:netbox_slm:softwareproductinstallation_add", "Add", "mdi mdi-plus-thick", - ButtonColorChoices.GREEN, permissions=["netbox_slm.add_softwareproductinstallation"], ), PluginMenuButton( "plugins:netbox_slm:softwareproductinstallation_import", "Import", "mdi mdi-upload", - ButtonColorChoices.CYAN, permissions=["netbox_slm.add_softwareproductinstallation"], ), ), @@ -70,14 +63,12 @@ "plugins:netbox_slm:softwarelicense_add", "Add", "mdi mdi-plus-thick", - ButtonColorChoices.GREEN, permissions=["netbox_slm.add_softwarelicense"], ), PluginMenuButton( "plugins:netbox_slm:softwarelicense_import", "Import", "mdi mdi-upload", - ButtonColorChoices.CYAN, permissions=["netbox_slm.add_softwarelicense"], ), ), diff --git a/netbox_slm/templates/netbox_slm/softwarelicense.html b/netbox_slm/templates/netbox_slm/softwarelicense.html index 372c713..b70bf91 100644 --- a/netbox_slm/templates/netbox_slm/softwarelicense.html +++ b/netbox_slm/templates/netbox_slm/softwarelicense.html @@ -11,58 +11,56 @@
Software License
-
- - - - - - - - - - - - - - - +
Name{{ object.name }}
Description{{ object.description }}
Type{{ object.type }}
Stored location
+ + + + + + + + + + + + + + {% if object.stored_location_url %} - + {% else %} - + {% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name{{ object.name }}
Description{{ object.description }}
Type{{ object.type }}
Stored location{{ object.stored_location_txt }}{{ object.stored_location_txt }}{{ object.stored_location_txt }}{{ object.stored_location_txt }}
Start date{{ object.start_date }}
Expiration date{{ object.expiration_date }}
Software Product{{ object.software_product }}
Version{{ object.version }}
Support{{ object.support }}
License amount{{ object.license_amount }}
Installation{{ object.installation }}
-
+ + + Start date + {{ object.start_date }} + + + Expiration date + {{ object.expiration_date }} + + + Software Product + {{ object.software_product }} + + + Version + {{ object.version }} + + + Support + {{ object.support }} + + + License amount + {{ object.license_amount }} + + + Installation + {{ object.installation }} + + {% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/tags.html' %} diff --git a/netbox_slm/templates/netbox_slm/softwareproduct.html b/netbox_slm/templates/netbox_slm/softwareproduct.html index 089c25b..65cc24a 100644 --- a/netbox_slm/templates/netbox_slm/softwareproduct.html +++ b/netbox_slm/templates/netbox_slm/softwareproduct.html @@ -11,34 +11,32 @@
Software Product
-
- - - - - - - - - - - - - - - - - -
Name{{ object.name }}
Description{{ object.description }}
Manufacturer{{ object.manufacturer }}
Versions - {% for version in object.softwareproduct_versions.all %} - - {{ version }} - - {% empty %} - n/a - {% endfor %} -
-
+ + + + + + + + + + + + + + + + + +
Name{{ object.name }}
Description{{ object.description }}
Manufacturer{{ object.manufacturer }}
Versions + {% for version in object.softwareproduct_versions.all %} + + {{ version }} + + {% empty %} + n/a + {% endfor %} +
{% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/tags.html' %} diff --git a/netbox_slm/templates/netbox_slm/softwareproductinstallation.html b/netbox_slm/templates/netbox_slm/softwareproductinstallation.html index 4819d50..735e7f5 100644 --- a/netbox_slm/templates/netbox_slm/softwareproductinstallation.html +++ b/netbox_slm/templates/netbox_slm/softwareproductinstallation.html @@ -11,34 +11,32 @@
Software Product Installation
-
- +
{% if object.device %} - - - - + + + + {% elif object.virtualmachine %} - - - - + + + + {% else %} - - - - + + + + {% endif %} - - - - - - - - -
Device{{ object.device }}
Device{{ object.device }}
Virtualmachine{{ object.virtualmachine }}
Virtualmachine{{ object.virtualmachine }}
Cluster{{ object.cluster }}
Cluster{{ object.cluster }}
Software Product{{ object.software_product }}
Version{{ object.version }}
-
+ + Software Product + {{ object.software_product }} + + + Version + {{ object.version }} + + {% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/tags.html' %} diff --git a/netbox_slm/templates/netbox_slm/softwareproductversion.html b/netbox_slm/templates/netbox_slm/softwareproductversion.html index 0e4055f..5477351 100644 --- a/netbox_slm/templates/netbox_slm/softwareproductversion.html +++ b/netbox_slm/templates/netbox_slm/softwareproductversion.html @@ -11,50 +11,48 @@
Software Product Version
-
- - - - - - - - - - - +
Name{{ object.name }}
Release date{{ object.release_date }}
Documentation url
+ + + + + + + + + + {% if object.documentation_url %} - + {% else %} - + {% endif %} - - - - - - - + + + + + + + {% if object.file_link %} - + {% else %} - + {% endif %} - - - - - - - - - - - - - -
Name{{ object.name }}
Release date{{ object.release_date }}
Documentation url{{ object.documentation_url }}{{ object.documentation_url }}{{ object.documentation_url }}{{ object.documentation_url }}
End of support{{ object.end_of_support }}
Filename
End of support{{ object.end_of_support }}
Filename{{ object.filename }}{{ object.filename }}{{ object.filename }}{{ object.filename }}
File checksum{{ object.file_checksum }}
Release type{{ object.get_release_type_display }}
Installations{{ object.get_installation_count }}
-
+ + + File checksum + {{ object.file_checksum }} + + + Release type + {{ object.get_release_type_display }} + + + Installations + {{ object.get_installation_count }} + + {% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/tags.html' %} diff --git a/pyproject.toml b/pyproject.toml index f062736..d4ad6c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "netbox-slm" dynamic = ["version"] description = "Software Lifecycle Management Netbox Plugin" readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.11" license = { text = "Apache-2.0" } authors = [ {name = "ICTU", email = "open-source-projects@ictu.nl"}, @@ -21,9 +21,8 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ] @@ -31,13 +30,13 @@ dependencies = [] [project.optional-dependencies] build = [ - "build == 1.0.3", - "setuptools == 68.2.0", - "twine == 3.7.1", + "build == 1.2.1", + "setuptools == 70.3.0", + "twine == 5.1.1", ] tools = [ - "black == 23.3.0", - "ruff == 0.0.275", + "black == 24.4.2", + "ruff == 0.5.1", ] [tool.setuptools.dynamic] @@ -48,7 +47,7 @@ include = ["netbox_slm"] [tool.black] line-length = 120 -target-version = ["py39"] +target-version = ["py311"] color = true check = true diff = true @@ -59,7 +58,7 @@ netbox_slm/migrations/.*.py [tool.ruff] line-length = 120 -target-version = "py39" +target-version = "py311" format = "github" src = ["netbox_slm"]