Zum Inhalt springen
Grafana Panels Docs

Dashboard Settings

dashboardSettings ist kein klassisches, deploybares Grafana-Part wie cssCode / jsCode. Es ist ein kleines HTML-Snippet, das einmal pro Dashboard ganz oben liegen muss (eigenes Text-/HTML-Panel), weil Runtime-Code (creds, Editor-Row-Sichtbarkeit) darauf zugreift.

Die Werte unterscheiden sich oft von Dashboard zu Dashboard (creds, editorSettings, adminAllEditorVisible) – deshalb gibt es hier keinen festen Standard-Part im Deploy.

| Feld | Required | Typ | Default | Beschreibung | | ----------------------- | -------- | -------------------------------------- | ------- | ----------------------------------------------------------------------------------------------- | --- | | dashboardSettings | Ja | object | - | Globales Config-Objekt; muss vor jsCode / Overview-Runtime definiert sein. | | adminAllEditorVisible | Nein | boolean | - | Wenn true, sieht ein User mit Rolle Admin alle Editor-Rows aus editorSettings. | | creds | Ja | string | - | Grafana-Credentials-Variable, typisch '${credentials}' (Pipe-getrennt; Runtime splittet bei |). | | editorSettings | Ja | Array<{ role: string; row: string }> | - | Mapping Rolle → Dashboard-Row-Titel. Steuert, welche Editor-Rows sichtbar bleiben. | | editorSettings[].role | Ja | string | - | Rollenname (nach Credential-Prefix-Normalisierung), z. B. 'EditorMap'. | | editorSettings[].row | Ja | string | - | Exakter Grafana-Row-Titel, z. B. 'Editor - Karte'. |

Im generierten overview-Panel ist das Snippet bereits vorangestellt. Dort ist editorSettings bewusst ein leeres Array ([]) – Overview braucht keine Editor-Row-Freischaltung.

Quelle: src/panels/snippets/dashboardSettings.js (Prefix über PANEL_SELECTION_PREFIXES).

Für ein klassisches Multi-Part-Dashboard ([x] CSS CODE, [x] JS CODE, …) ein eigenes kleines HTML-Panel anlegen und Folgendes einfügen. editorSettings und ggf. adminAllEditorVisible / creds an das jeweilige Dashboard anpassen:

<script>
  var dashboardSettings = {
    adminAllEditorVisible: true, // If the customer admin can see every Editor panel
    creds: '${credentials}',
    editorSettings: [
      { role: 'EditorMap', row: 'Editor - Karte' },
      { role: 'EditorNotification', row: 'Editor - Notifizierung' },
      { role: 'EditorDevice', row: 'Editor - Gerätedetails' },
    ],
  };
</script>
  • Panel-Titel oft mit [x] …, damit Nicht-Editoren das Settings-Panel ausgeblendet bekommen (wie die übrigen Infrastruktur-Parts).
  • Ohne gültiges dashboardSettings schlägt die Runtime früh fehl (dashboardSettings.creds).
  • editorSettings: [] bedeutet: keine Editor-Rows werden freigeschaltet (Overview-Default).