The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/e2e/custom-plugins/app-with-exposed-components/module.js

28 lines
907 B

define(['@grafana/data', '@grafana/runtime', 'react'], function (grafanaData, grafanaRuntime, React) {
var AppPlugin = grafanaData.AppPlugin;
var usePluginComponent = grafanaRuntime.usePluginComponent;
var MyComponent = function () {
var plugin = usePluginComponent('myorg-componentexposer-app/reusable-component/v1');
var TestComponent = plugin.component;
var isLoading = plugin.isLoading;
if (!TestComponent) {
return null;
}
return React.createElement(
React.Fragment,
null,
React.createElement('div', null, 'Exposed component:'),
isLoading ? 'Loading..' : React.createElement(TestComponent, { name: 'World' })
);
};
var App = function () {
return React.createElement('div', null, 'Hello Grafana!', React.createElement(MyComponent, null));
};
var plugin = new AppPlugin().setRootPage(App);
return { plugin: plugin };
});