How can I add a custom option to Admin Dashboard

alrnetwork

Verified User
Joined
Feb 12, 2021
Messages
164
Location
Europe UTC+2
Hi all,

Very new to DirectAdmin, but super, SUPER impressed with it so far.

I was wondering how I can create my own custom button / link within the Admin interface, to be shown to admins only. At this point, it simply needs to be a button which acts as a hyperlink (I have Grafana set up for performance monitoring and want a quick way for admins to access it).

As the Grafana interface is running on the host, I would like it to be able to collect the existing host url (without port number). I'm happy to design a little icon, is there any specific format? PNG etc? (see attached mock-up)

I was digging around on the net, but couldn't find an answer, or maybe just not searching well.

Thanks in advance!
 

Attachments

  • Screenshot 2021-02-14 at 18.21.28.png
    Screenshot 2021-02-14 at 18.21.28.png
    404.4 KB · Views: 31
"Customize Evolution Skin" lets you customize the menus, however, it wouldn't add new entries to menu after updates of DA, so, that's the drawback..

Alternative way to do this would be to place this new entry as a plugin, something like:
Code:
PLUGIN_DIR=/usr/local/directadmin/plugins/grafana_url

mkdir -p ${PLUGIN_DIR}/hooks
mkdir -p ${PLUGIN_DIR}/admin
mkdir -p ${PLUGIN_DIR}/images

wget -O ${PLUGIN_DIR}/images/admin_icon.svg https://symbols.getvecta.com/stencil_82/58_grafana-icon.e4a9200593.svg

echo '<a href="https://|SERVER_NAME|:3000" target="_blank">Grafana</a>' > ${PLUGIN_DIR}/hooks/admin_img.html
echo '<a href="https://|SERVER_NAME|:3000" target="_blank">Grafana</a>' > ${PLUGIN_DIR}/hooks/admin_txt.html

touch ${PLUGIN_DIR}/admin/index.html

echo 'active=yes' > ${PLUGIN_DIR}/plugin.conf
echo 'author=none' >> ${PLUGIN_DIR}/plugin.conf
echo 'id=grafana' >> ${PLUGIN_DIR}/plugin.conf
echo 'installed=yes' >> ${PLUGIN_DIR}/plugin.conf
echo 'name=Grafana' >> ${PLUGIN_DIR}/plugin.conf
echo 'update_url=' >> ${PLUGIN_DIR}/plugin.conf
echo 'version=0.1' >> ${PLUGIN_DIR}/plugin.conf
echo 'version_url=' >> ${PLUGIN_DIR}/plugin.conf

chown -R diradmin:diradmin ${PLUGIN_DIR}
 
Okay, this sounds like the ticket... Gonna try this now.. Seems to me like you literally just made that plugin for me haha
 
@smtalk - See (browsing around) that you appear to be the guy when it comes to these sorts of questions..

The only thing I have to ask is, what do I do with that code? Forgive my density, but this is not my forte :)
 
Legend(s)! Thanks very much for your support! This worked perfectly. The icon failed, but I simply re-uploaded the file directly to the directory (the same linked SVG file) and renamed it to admin_icon.svg, and worked.. so all good! Also had to change the https:// to http:// for the Grafana url. Tweaks are simple from this point..

Much appreciated @smtalk!
 
Back
Top