2022-07-06 17:00:56 +02:00
|
|
|
import React, { useEffect } from 'react';
|
|
|
|
|
|
2022-07-23 17:09:03 +02:00
|
|
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
2022-07-06 17:00:56 +02:00
|
|
|
|
|
|
|
|
export interface AppChromeUpdateProps {
|
|
|
|
|
actions?: React.ReactNode;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* This needs to be moved to @grafana/ui or runtime.
|
|
|
|
|
* This is the way core pages and plugins update the breadcrumbs and page toolbar actions
|
|
|
|
|
*/
|
2022-09-12 15:45:14 +02:00
|
|
|
export const AppChromeUpdate = React.memo<AppChromeUpdateProps>(({ actions }: AppChromeUpdateProps) => {
|
2022-07-23 17:09:03 +02:00
|
|
|
const { chrome } = useGrafana();
|
|
|
|
|
|
2022-07-06 17:00:56 +02:00
|
|
|
useEffect(() => {
|
2022-09-12 15:45:14 +02:00
|
|
|
chrome.update({ actions });
|
2022-07-06 17:00:56 +02:00
|
|
|
});
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AppChromeUpdate.displayName = 'TopNavUpdate';
|