|
@@ -1,12 +1,12 @@
|
|
|
import { ComponentClass } from 'react';
|
|
import { ComponentClass } from 'react';
|
|
|
import { NavModel } from './navModel';
|
|
import { NavModel } from './navModel';
|
|
|
-import { PluginMeta, PluginIncludeType, GrafanaPlugin } from './plugin';
|
|
|
|
|
|
|
+import { PluginMeta, PluginIncludeType, GrafanaPlugin, KeyValue } from './plugin';
|
|
|
|
|
|
|
|
-export interface AppRootProps {
|
|
|
|
|
- meta: AppPluginMeta;
|
|
|
|
|
|
|
+export interface AppRootProps<T = KeyValue> {
|
|
|
|
|
+ meta: AppPluginMeta<T>;
|
|
|
|
|
|
|
|
path: string; // The URL path to this page
|
|
path: string; // The URL path to this page
|
|
|
- query: { [s: string]: any }; // The URL query parameters
|
|
|
|
|
|
|
+ query: KeyValue; // The URL query parameters
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Pass the nav model to the container... is there a better way?
|
|
* Pass the nav model to the container... is there a better way?
|
|
@@ -14,13 +14,13 @@ export interface AppRootProps {
|
|
|
onNavChanged: (nav: NavModel) => void;
|
|
onNavChanged: (nav: NavModel) => void;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export interface AppPluginMeta extends PluginMeta {
|
|
|
|
|
|
|
+export interface AppPluginMeta<T = KeyValue> extends PluginMeta<T> {
|
|
|
// TODO anything specific to apps?
|
|
// TODO anything specific to apps?
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export class AppPlugin extends GrafanaPlugin<AppPluginMeta> {
|
|
|
|
|
|
|
+export class AppPlugin<T = KeyValue> extends GrafanaPlugin<AppPluginMeta<T>> {
|
|
|
// Content under: /a/${plugin-id}/*
|
|
// Content under: /a/${plugin-id}/*
|
|
|
- root?: ComponentClass<AppRootProps>;
|
|
|
|
|
|
|
+ root?: ComponentClass<AppRootProps<T>>;
|
|
|
rootNav?: NavModel; // Initial navigation model
|
|
rootNav?: NavModel; // Initial navigation model
|
|
|
|
|
|
|
|
// Old style pages
|
|
// Old style pages
|
|
@@ -37,7 +37,7 @@ export class AppPlugin extends GrafanaPlugin<AppPluginMeta> {
|
|
|
* Set the component displayed under:
|
|
* Set the component displayed under:
|
|
|
* /a/${plugin-id}/*
|
|
* /a/${plugin-id}/*
|
|
|
*/
|
|
*/
|
|
|
- setRootPage(root: ComponentClass<AppRootProps>, rootNav?: NavModel) {
|
|
|
|
|
|
|
+ setRootPage(root: ComponentClass<AppRootProps<T>>, rootNav?: NavModel) {
|
|
|
this.root = root;
|
|
this.root = root;
|
|
|
this.rootNav = rootNav;
|
|
this.rootNav = rootNav;
|
|
|
return this;
|
|
return this;
|