Kani999 / netbox-attachments

Plugin to manage attachments for any model
Apache License 2.0
55 stars 4 forks source link

Trouble adding netbox-attachments to netbox-tunnels2 plugin #31

Closed ML-SRT closed 1 year ago

ML-SRT commented 1 year ago

Could you please advise me on how these two plugins can be implemented together?

Kani999 commented 1 year ago

@ML-SRT I'll have to look at the https://github.com/robertlynch3/netbox-tunnels2 plugin first.

I'll try to create it with netbox-docker and will let you know. But it should be just a matter of configuration.

ML-SRT commented 1 year ago

Thanks Kani. I just couldn't figure it out.

Kani999 commented 1 year ago

@ML-SRT In "netbox-tunnels2" there's a problem with the templates. It does not have functions, which render the attachments.

https://github.com/robertlynch3/netbox-tunnels2/blob/master/netbox_tunnels2/templates/netbox_tunnels2/tunnel.html there's missing: {% load plugins %} {% plugin_left_page object %} {% plugin_right_page object %} {% plugin_left_page object %} {% plugin_full_width_page object %}

The example where the block should be inserted is there: https://github.com/netbox-community/netbox/blob/70c2b358ad6c778344b2ee0639dab6b76f751fdc/netbox/templates/ipam/asn.html#L55

So I assume you could create a pull request to netbox-tunnels2 which hopefully will be merged.

EDIT:

Now it works fine.

image

Kani999 commented 1 year ago

Pull request for netbox-tunnels created - https://github.com/robertlynch3/netbox-tunnels2/pull/9

ML-SRT commented 1 year ago

Hi @Kani999, Sorry to be a pain. I am not familiar with Linux and Github. How do I apply this to my instance of netbox? I have it installed on Ubuntu 22.04.2 LTS, netbox-version: 3.5.3.

Kani999 commented 1 year ago

@ML-SRT It looks like, that netbox-tunnels2 will be upgraded (https://github.com/robertlynch3/netbox-tunnels2/pull/9) to enable rendering the "attachment" pages.

If you are not in a hurry with this, you could wait for the new version of netbox-tunnels2. Otherwise, I could find some solution to get around it.

Are you using the system installation? Or are you using a netbox-docker installation of NetBox.

Kani999 commented 1 year ago

@ML-SRT the netbox-tunnels2 just implemented my changes (https://github.com/robertlynch3/netbox-tunnels2/releases/tag/v0.2.5) so now you can install the latest version of netbox-tunnels and it will works with netbox-attachmets.

Just remember to properly set the configuration like

PLUGINS_CONFIG = {
    'netbox_attachments': {
        'apps': ['dcim', 'ipam', 'circuits', 'tenancy', 'virtualization', 'wireless',  'netbox_tunnels2'],
        'display_default': "left_page",
        'display_setting': {"netbox_tunnels2.tunnel": "full_width_page", "netbox_tunnels2.tunneltype": "full_width_page"}
    }
}

Try it and let me know if everything works fine. Then I will close the issue.

ML-SRT commented 1 year ago

Hi @Kani999, Thank you so much for your help on this. I will uninstall netbox-tunnels and reinstall today and let you know how it goes.

ML-SRT commented 1 year ago

@ML-SRT It looks like, that netbox-tunnels2 will be upgraded (robertlynch3/netbox-tunnels2#9) to enable rendering the "attachment" pages.

If you are not in a hurry with this, you could wait for the new version of netbox-tunnels2. Otherwise, I could find some solution to get around it.

Are you using the system installation? Or are you using a netbox-docker installation of NetBox.

I am using the system installation.

ML-SRT commented 1 year ago

That is it working now. Thank you again for your help on this!

Kani999 commented 1 year ago

@ML-SRT Thanks for the response. I'm glad that the plugin is in use.