Closes #10500: Introduce support for nested modules (#16983)

* 10500 add ModularComponentModel

* 10500 add ModularComponentModel

* 10500 add to forms

* 10500 add to serializer, tables

* 10500 template

* 10500 add docs

* 10500 check recursion

* 10500 fix graphql

* 10500 fix conflicting migration from merge

* 10500 token resolution

* 10500 don't return reverse

* 10500 don't return reverse / optimize

* Add ModuleTypeModuleBaysView

* Fix replication of module bays on new modules

* Clean up tables & templates

* Adjust uniqueness constraints

* Correct URL

* Clean up docs

* Fix up serializers

* 10500 add filterset tests

* 10500 add nested validation to Module

* Misc cleanup

* 10500 ModuleBay recursion Test

* 10500 ModuleBay recursion Test

* 10500 ModuleBay recursion Test

* 10500 ModuleBay recursion Test

* Enable MPTT for module bays

* Fix tests

* Fix validation of module token in component names

* Misc cleanup

* Merge migrations

* Fix table ordering

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Arthur Hanson
2024-08-06 00:13:59 +07:00
committed by GitHub
parent 57fe2071a4
commit 796b9e84af
21 changed files with 475 additions and 86 deletions

View File

@@ -496,12 +496,18 @@ class ModuleType(NetBoxObjectType):
@strawberry_django.type(
models.ModuleBay,
fields='__all__',
# fields='__all__',
exclude=('parent',),
filters=ModuleBayFilter
)
class ModuleBayType(ComponentType):
class ModuleBayType(ModularComponentType):
installed_module: Annotated["ModuleType", strawberry.lazy('dcim.graphql.types')] | None
children: List[Annotated["ModuleBayType", strawberry.lazy('dcim.graphql.types')]]
@strawberry_django.field
def parent(self) -> Annotated["ModuleBayType", strawberry.lazy('dcim.graphql.types')] | None:
return self.parent
@strawberry_django.type(
@@ -509,7 +515,7 @@ class ModuleBayType(ComponentType):
fields='__all__',
filters=ModuleBayTemplateFilter
)
class ModuleBayTemplateType(ComponentTemplateType):
class ModuleBayTemplateType(ModularComponentTemplateType):
_name: str