OPNsense Forum

Archive => 23.7 Legacy Series => Topic started by: straightup on January 01, 2024, 01:53:36 PM

Title: Interface color
Post by: straightup on January 01, 2024, 01:53:36 PM
Hello,
I'm new to this forum and already read a lot, but did not find an answer on my actual question.
I want to change the color of the interfaces in the traffic graphs widget; like others before:

https://forum.opnsense.org/index.php?topic=32307.msg156131#msg156131
https://forum.opnsense.org/index.php?topic=6845.msg29747#msg29747

unfortunately these threads were not answered.
I found the code where I can change the color (/usr/local/www/widgets/widgets/traffic_graphs.widget.php) and I already did, but this "patch" is not update resistant. I see in the code, that the interfaces have a color stored in a database. But I did not get what database it is. Excuse my lack of knowledge but I'm not a programmer and I mostly struggle on these jumps into other code (require etc).
So perhaps here is someone who has the knowledge and is willing to help me and as the links above shows also others who want to customize these graphs.

So the question is which database is used to get the interfaces color in the traffic graph widget and how can this be changed? Thanks a lot.
Title: Re: Interface color
Post by: MarieSophieSG on October 03, 2024, 12:31:22 AM
Same here, I would love to be able to give each interface a specific color, as I'm using RJ45 with each its own color
WAN0 = black
LAN1 = Green
LAN2 = Blue
LAN3 = White

How do I access  /usr/local/www/widgets/widgets/traffic_graphs.widget.php from the GUI ? (or do I have to access the disk from SSH ?

And did you get an answer about how to make it permanent ?
Title: Re: Interface color
Post by: cookiemonster on October 03, 2024, 03:05:53 PM
Quote from: MarieSophieSG on October 03, 2024, 12:31:22 AM
How do I access  /usr/local/www/widgets/widgets/traffic_graphs.widget.php from the GUI ? (or do I have to access the disk from SSH ?

And did you get an answer about how to make it permanent ?
SSH only. OPN UI does not include a "file browser".
All changes to these internals do not survive upgrades because you are chaning version-controlled files that are part of the system. The only ones and methods to change are with hooks, and are documented in the docs.
Title: Re: Interface color
Post by: MarieSophieSG on October 03, 2024, 05:04:47 PM
Yes, TY, I did :)
But now I'm facing another problem, the traffic_graphs.widget.php is no longer in the www/widgets/widgets/
And couldn't find on Github where nor when it was moved

Or maybe it is just me not having it there ?
Title: Re: Interface color
Post by: Patrick M. Hausen on October 03, 2024, 05:20:38 PM
Try the files in https://github.com/opnsense/core/tree/master/src/opnsense/www/js/widgets

That corresponds to /usr/local/opnsense/www/js/widgets on your installed system.
Title: Re: Interface color
Post by: MarieSophieSG on October 03, 2024, 08:15:41 PM
Quote from: Patrick M. Hausen on October 03, 2024, 05:20:38 PM
Try the files in https://github.com/opnsense/core/tree/master/src/opnsense/www/js/widgets

That corresponds to /usr/local/opnsense/www/js/widgets on your installed system.

Thank you !
You sure know your way around :-p that's pretty impressive ..

Meanwhile, I have been opening each file that looks more or less like an interface config, but to date, I haven't found any addressing the colour subject, except a "avoid white = 1" in interfaces.php

I will keep looking but in GitHub this time rather than through Putty, much easier :)