Guys, any ideas how to disable export data and another not necessary options in current version of grafana?
I found a method as belown
In grafana build folder, search js file that contain â.show-on-hoverâ css style
add âdisplay: noneâ to âăshow-on-hoverâ and âpanel-menuâ in js.
clear browser cache, reload again.
to enable only for editors and disable for viewers In grafana 10.3
itâs work for me:
#sudo cd /usr/share/grafana/public/build/ *.js
#sudo grep -Ril âpanel-dropdownâ
in my case:
/usr/share/grafana/public/build/3964.4eb430604260346eee8b.js
for disable share: edit the file and the lines commented as â// ADD THIS LINE TO SHOW ONLY FOR EDITORSâ:
e.isEditing || R.push({ text: (0, P.t)("panel.header-menu.view", "View"), iconClassName: "eye", onClick: t, shortcut: "v", }), n.canEditPanel(e) && !e.isEditing && R.push({ text: (0, P.t)("panel.header-menu.edit", "Edit"), iconClassName: "edit", onClick: s, shortcut: "e", }), n.canEditPanel(e) && // ADD THIS LINE TO SHOW ONLY FOR EDITORS !e.isEditing && // ADD THIS LINE TO SHOW ONLY FOR EDITORS R.push({ text: (0, P.t)("panel.header-menu.share", "Share"), iconClassName: "share-alt", onClick: o, shortcut: "p s", }), Ee.contextSrv.hasAccessToExplore() && !(e.plugin && e.plugin.meta.skipDataQuery) && e.datasource?.uid !== Be.oe && R.push({ text: (0, P.t)("panel.header-menu.explore", "Explore"), iconClassName: "compass", onClick: V, shortcut: "p x", }); const te = []; e.plugin && !e.plugin.meta.skipDataQuery && (te.push({ text: (0, P.t)("panel.header-menu.inspect-data", "Data"), onClick: (u) => d(C.q.Data), }), n.meta.canEdit && te.push({ text: (0, P.t)("panel.header-menu.query", "Query"), onClick: (u) => d(C.q.Query), })), te.push({ text: (0, P.t)("panel.header-menu.inspect-json", "Panel JSON"), onClick: (u) => d(C.q.JSON), }), n.canEditPanel(e) && // ADD THIS LINE TO SHOW ONLY FOR EDITORS !e.isEditing && // ADD THIS LINE TO SHOW ONLY FOR EDITORS R.push({ type: "submenu", text: (0, P.t)("panel.header-menu.inspect", "Inspect"), iconClassName: "info-circle", onClick: (u) => { const G = u.currentTarget, Y = u.target; (Y === G || (Y instanceof HTMLElement && Y.closest('[role="menuitem"]') === G)) && d(); }, shortcut: "i", subMenu: te, });
As we already got some feedback from Grafanaâs team and Torkel. Since even if you âhideâ the controls, the user still has access to all the endpoints and data involved.
Closing the topic because it already got 4 years old and the version changed a lot for something that always needs some âhackingâ on the code.