mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #6832: Support config context rendering under GraphQL API
This commit is contained in:
parent
582b69de74
commit
57dc4c207f
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
* [#6811](https://github.com/netbox-community/netbox/issues/6811) - Fix exception when editing users
|
* [#6811](https://github.com/netbox-community/netbox/issues/6811) - Fix exception when editing users
|
||||||
* [#6827](https://github.com/netbox-community/netbox/issues/6827) - Fix circuit termination connection dropdown
|
* [#6827](https://github.com/netbox-community/netbox/issues/6827) - Fix circuit termination connection dropdown
|
||||||
|
* [#6832](https://github.com/netbox-community/netbox/issues/6832) - Support config context rendering under GraphQL API
|
||||||
* [#6846](https://github.com/netbox-community/netbox/issues/6846) - Form-driven REST API calls should use brief mode
|
* [#6846](https://github.com/netbox-community/netbox/issues/6846) - Form-driven REST API calls should use brief mode
|
||||||
* [#6871](https://github.com/netbox-community/netbox/issues/6871) - Support dynamic tag types in GraphQL API
|
* [#6871](https://github.com/netbox-community/netbox/issues/6871) - Support dynamic tag types in GraphQL API
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from dcim import filtersets, models
|
from dcim import filtersets, models
|
||||||
from extras.graphql.mixins import ChangelogMixin, CustomFieldsMixin, ImageAttachmentsMixin, TagsMixin
|
from extras.graphql.mixins import (
|
||||||
|
ChangelogMixin, ConfigContextMixin, CustomFieldsMixin, ImageAttachmentsMixin, TagsMixin,
|
||||||
|
)
|
||||||
from ipam.graphql.mixins import IPAddressesMixin, VLANGroupsMixin
|
from ipam.graphql.mixins import IPAddressesMixin, VLANGroupsMixin
|
||||||
from netbox.graphql.types import BaseObjectType, OrganizationalObjectType, PrimaryObjectType
|
from netbox.graphql.types import BaseObjectType, OrganizationalObjectType, PrimaryObjectType
|
||||||
|
|
||||||
@ -132,7 +134,7 @@ class ConsoleServerPortTemplateType(ComponentTemplateObjectType):
|
|||||||
return self.type or None
|
return self.type or None
|
||||||
|
|
||||||
|
|
||||||
class DeviceType(ImageAttachmentsMixin, PrimaryObjectType):
|
class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, PrimaryObjectType):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Device
|
model = models.Device
|
||||||
|
@ -3,6 +3,7 @@ from graphene.types.generic import GenericScalar
|
|||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'ChangelogMixin',
|
'ChangelogMixin',
|
||||||
|
'ConfigContextMixin',
|
||||||
'CustomFieldsMixin',
|
'CustomFieldsMixin',
|
||||||
'ImageAttachmentsMixin',
|
'ImageAttachmentsMixin',
|
||||||
'JournalEntriesMixin',
|
'JournalEntriesMixin',
|
||||||
@ -17,6 +18,13 @@ class ChangelogMixin:
|
|||||||
return self.object_changes.restrict(info.context.user, 'view')
|
return self.object_changes.restrict(info.context.user, 'view')
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigContextMixin:
|
||||||
|
config_context = GenericScalar()
|
||||||
|
|
||||||
|
def resolve_config_context(self, info):
|
||||||
|
return self.get_config_context()
|
||||||
|
|
||||||
|
|
||||||
class CustomFieldsMixin:
|
class CustomFieldsMixin:
|
||||||
custom_fields = GenericScalar()
|
custom_fields = GenericScalar()
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
from dcim.graphql.types import ComponentObjectType
|
from dcim.graphql.types import ComponentObjectType
|
||||||
|
from extras.graphql.mixins import ConfigContextMixin
|
||||||
from ipam.graphql.mixins import IPAddressesMixin, VLANGroupsMixin
|
from ipam.graphql.mixins import IPAddressesMixin, VLANGroupsMixin
|
||||||
from virtualization import filtersets, models
|
|
||||||
from netbox.graphql.types import OrganizationalObjectType, PrimaryObjectType
|
from netbox.graphql.types import OrganizationalObjectType, PrimaryObjectType
|
||||||
|
from virtualization import filtersets, models
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'ClusterType',
|
'ClusterType',
|
||||||
@ -36,7 +37,7 @@ class ClusterTypeType(OrganizationalObjectType):
|
|||||||
filterset_class = filtersets.ClusterTypeFilterSet
|
filterset_class = filtersets.ClusterTypeFilterSet
|
||||||
|
|
||||||
|
|
||||||
class VirtualMachineType(PrimaryObjectType):
|
class VirtualMachineType(ConfigContextMixin, PrimaryObjectType):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.VirtualMachine
|
model = models.VirtualMachine
|
||||||
|
Loading…
Reference in New Issue
Block a user