netbox-config-diff icon indicating copy to clipboard operation
netbox-config-diff copied to clipboard

Swap left/right colors

Open rvmack opened this issue 1 year ago • 4 comments

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 avatar Jul 15 '24 16:07 rvmack

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).

rvmack avatar Jul 16 '24 08:07 rvmack

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.

chris240189 avatar Jul 18 '24 11:07 chris240189

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

rvmack avatar Jul 26 '24 17:07 rvmack

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

miaow2 avatar Jul 28 '24 14:07 miaow2

In the meantime I've also updated to netbox 4+ and to latest 2.6.0 configdiff - thank you both chris for answering and @miaow2 for having that implemented already!

rvmack avatar Aug 30 '24 20:08 rvmack