mirror of
https://github.com/grafana/grafana.git
synced 2025-09-23 13:03:14 +08:00

* Change nav structure when topnav is enable to do initial tests with new information architecture * Support for nested sections * Updated * sentance case * Progress on plugin challange * Rewrite to functional component * Progress * Updates * Progress * Progress on things * missing file * Fixing issue with runtime, need to use setter way to set component exposed via runtime * Move PageLayoutType to grafana/data * Fixing breadcrumb issue, adding more tests * reverted backend change * fix recursive issue with cleanup
27 lines
644 B
TypeScript
27 lines
644 B
TypeScript
import React from 'react';
|
|
|
|
import { NavModel } from '@grafana/data';
|
|
|
|
export interface PluginPageContextType {
|
|
sectionNav: NavModel;
|
|
}
|
|
|
|
export const PluginPageContext = React.createContext(getInitialPluginPageContext());
|
|
|
|
PluginPageContext.displayName = 'PluginPageContext';
|
|
|
|
function getInitialPluginPageContext(): PluginPageContextType {
|
|
return {
|
|
sectionNav: {
|
|
main: { text: 'Plugin page' },
|
|
node: { text: 'Plugin page' },
|
|
},
|
|
};
|
|
}
|
|
|
|
export function buildPluginPageContext(sectionNav: NavModel | null): PluginPageContextType {
|
|
return {
|
|
sectionNav: sectionNav ?? getInitialPluginPageContext().sectionNav,
|
|
};
|
|
}
|