From 04d3c3aaed655bfae77c8aeb7f1f28285d3e0d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agn=C3=A8s=20Toulet?= <35176601+AgnesToulet@users.noreply.github.com> Date: Wed, 8 Apr 2020 21:13:12 +0200 Subject: [PATCH] Dashboard: extend dashnav to add custom content (#23433) --- .../dashboard/components/DashNav/DashNav.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/components/DashNav/DashNav.tsx b/public/app/features/dashboard/components/DashNav/DashNav.tsx index 2b146f388e1..6a256cc250d 100644 --- a/public/app/features/dashboard/components/DashNav/DashNav.tsx +++ b/public/app/features/dashboard/components/DashNav/DashNav.tsx @@ -1,5 +1,5 @@ // Libaries -import React, { PureComponent } from 'react'; +import React, { PureComponent, FC } from 'react'; import { connect } from 'react-redux'; import { css } from 'emotion'; import { e2e } from '@grafana/e2e'; @@ -29,6 +29,12 @@ export interface OwnProps { onAddPanel: () => void; } +const customNavbarContent: Array>> = []; + +export function addNavbarContent(content: FC>) { + customNavbarContent.push(content); +} + export interface StateProps { location: any; } @@ -173,6 +179,10 @@ class DashNav extends PureComponent { )} + {customNavbarContent.map((Component, index) => ( + + ))} +
{canSave && (