[DEV] How to add a widget to the dashboard menu?

  • Hi,

    I'm trying to add a panel to the dashboard, but I cannot add a new item to the "Add" button.
    By searching the code, I have found the file Dashboard.js, which get the registered dashboard...




    So the question is... Where do I register the dashboard widget ?

    Thx

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

  • Click the dented wheel (Top-Right) and select whatever you want.


    Press Save and Bob's your uncle.

  • Sorry I wasn't clear enough.


    First, I'm with OMV v5, not v6.

    Next, I'm searching to add a widget that doesn't exist, aka I'm creating it ;)

    The thing I'm talking about is there, in the red zone ;)


    Thanks

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

  • Ahh, now I understood, ;)


    Open a "feature request" on github to what you want, votdev will see it faster:

    Issues · openmediavault/openmediavault (github.com)

    • Offizieller Beitrag

    OMV5 is practically already EOL, i do not maintain it anymore (except patches for migration or security issues). Please use OMV6 instead. For developing plugins please have a look at https://openmediavault.readthe…/development/plugins.html and use the source code as reference.


    Please note, you can not add custom dashboard widgets, you NEED to use the existing templates because EVERYTHING in the new UI can only be customized via declarative code (JSON/YAML).

  • only for curiosity, what show your widget?, is usefull for other users?

    I'm going to add a temperature widget (I got them with IPMI and a collectd specific configuration), better than the one line that I've added in the System Info one. (see screenshot)
    The fact is that the files I have modified to add this line will be overide each time a new version of OMV goes live.

    Buy adding a widget panel, this will not append ;)

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

  • OMV5 is practically already EOL, i do not maintain it anymore (except patches for migration or security issues). Please use OMV6 instead. For developing plugins please have a look at https://openmediavault.readthe…/development/plugins.html and use the source code as reference.

    Yeah... I know... and I would really like to, but I've done so much specific conf (collectd, IPMI, WebUI, etc...) on my NAS that it would be very long to restart from OMV6 at the moment, so I'm trying to add what I can to my need.

    I reading the code since several months for my needs, but it's still a hard step even if I was a dev guy 15 years ago ;)
    I'm asking help only when I'm really stuck after several hours.

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

  • Have a look here.

    Thanks votdev, that's where I was addind my src files




    But nothing more in the "add" button. It seems that my widget is not "registered".

    votdev Maybe I need to restart something ?

    EDIT:
    - I have already restarted the openmediavault-engined and the nginx services.
    - My files are in the caches directory


    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

    5 Mal editiert, zuletzt von sbocquet () aus folgendem Grund: more infos

    • Offizieller Beitrag

    But nothing more in the "add" button. It seems that my widget is not "registered".

    I searched the source code where the default dashboard widgets are registered, but didn't find anything. I'm really sorry, i can't remember anymore how this is working, too much time passed since this feature was implemented. I think it is a magic function of ExtJS, but i don't know it anymore.


    In general i would say that somewhere a // require("js/omv/module/admin/dashboard/(part|view)/xxx.js") must occur which triggers the PHP code to create a <script type='application/javascript' src='foo'></script> entry in the generated HTML file; but did not found any code that looks like that.

  • I searched the source code where the default dashboard widgets are registered, but didn't find anything. I'm really sorry, i can't remember anymore how this is working, too much time passed since this feature was implemented. I think it is a magic function of ExtJS, but i don't know it anymore.


    In general i would say that somewhere a // require("js/omv/module/admin/dashboard/(par|view)/xxx.js")

    must occur which triggers the PHP code to create a <script type='application/javascript' src='foo'></script> entry in the generated HTML file; but did not found any code that looks like that.

    Thanks for trying votdev ...

    It seems that my files are "here" (listed in the cache, so I assume OMV took them into account), but somehow not "visible"...

    EDIT :
    votdev JS Files are in the generated page... so I'm completely lost now ! lol

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

    Einmal editiert, zuletzt von sbocquet ()

  • votdev

    Like always... you need to clear your web browser cache (or something like this!) ;)

    Anyway... work in progress but it works !


    Just need some advices from some PHP gourou...
    I'm not sure that this is the best way to do it or if there is something more efficient in PHP then those system calls to read the last line of a file. So any advice is welcome for this slice of code.



    Thanks for your help.

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

  • I'm going to add a temperature widget (I got them with IPMI and a collectd specific configuration), better than the one line that I've added in the System Info one. (see screenshot)
    The fact is that the files I have modified to add this line will be overide each time a new version of OMV goes live.

    Buy adding a widget panel, this will not append ;)

    Good addon, please consider to port to OMV6 and share it , when you consider to upgrade your NAS .

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!