miaow2 / netbox-config-diff

Find diff and push rendered device configurations from NetBox to devices and apply them.
https://miaow2.github.io/netbox-config-diff/
Apache License 2.0
74 stars 4 forks source link

Swap left/right colors #77

Open rvmack opened 1 month ago

rvmack commented 1 month ago

Hi there! thanks a lot for this awesome plugin!

I'd like to ask if it'd be an easy change to make the coloring in the config diff view configurable. I use that plugin in a way that the rendered config from a template in netbox shall be the target configuration. At the moment the config lines from that template are red and the config lines from a device are green in the config diff view. I'd like to have it exactly the opposite way.

Not sure if that would require just to change values in the diff2html.dark.min.css and diff2html.min.css or if diff2html-ui.min.js would need to be touched (which looks like much more work)

@miaow2 could you maybe give me a hint which places would be needed to get touched to swap these colors: image and if you would accept a merge request which makes this configurable like

PLUGINS_CONFIG = {
    "netbox_config_diff": {
        "swap_colors": true
    },
}

Cheers!

rvmack commented 1 month ago

Additional note: The configurations from the device are imported via git datasource in my case, not via scrapli, as the nos is not supported (yet). Don't know if that makes a difference for the diff presentation.

Why I think this feature/change would be helpful: Left side is the configuration as rendered from a template with data from netbox as source of truth and the right side is the actual configuration. I find it more convenient to see things to be added in green and things to be removed in red, also like red is wrong, green is right (and data in netbox should be right).

chris240189 commented 1 month ago

can you check which version of the plugin you are running? at some point, left and right side of the view was swapped. in the newer versions, left side is the device config (i get mine through a datasource and oxidized) which changes in red with a "-" in front. right side is in green with "+" for things that would be added through application of the rendered template.

rvmack commented 4 weeks ago

Ok nice, thats how I would like it. Currently on netbox-config-diff==2.2.0 Looking forward to deploy latest version with netbox 4

miaow2 commented 3 weeks ago

Hi @rvmack thanks for opening the issue. Like @chris240189 said, in the 2.3.0 version I swapped the columns, so on the left, there is the device configuration and on the right - rendered config from NetBox.

Thanks @chris240189 for answering