Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Limit attachments to specific models #64

Open
llamafilm opened this issue Jul 13, 2024 · 2 comments
Open

[Feature] Limit attachments to specific models #64

llamafilm opened this issue Jul 13, 2024 · 2 comments

Comments

@llamafilm
Copy link

Hello! I'd like to allow attachments only on Device Types. I don't want users to be able to add attachments to Devices. My primary use case is datasheets, and I'm afraid that if users are able to add in both places, they will make mistakes.

@Kani999
Copy link
Owner

Kani999 commented Jul 16, 2024

I'll take a look on how to extend the PLUGIN_CONFIG to support specifying certain models.

PLUGINS_CONFIG = {
    'netbox_attachments': {
        'apps': ['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless', 'inventory_monitor'],
        'display_default': "right_page",
        'display_setting': {'ipam.vlan': "left_page", 'dcim.device': "full_width_page", 'dcim.devicerole': "full_width_page", 'inventory_monitor.probe': "additional_tab"}
    }
}

@matejv
Copy link

matejv commented Jul 16, 2024

That would be a useful feature for us as well.

I have figured out a workaround: if you set display_setting to some unsupported value for models you want hidden, it won't show on GUI. This won't prevent adding attachments via some other methods (like from scripts or via API), but is good enough for us.

Example config:

PLUGINS_CONFIG = {
    'netbox_attachments': {
        'apps': ['dcim',],
        'display_setting': {
            'dcim.devicetype': "full_width_page",
            'dcim.device': "hidden",
        },
    },

You'll have to list all models under dcim you want to hide attachments from unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants