comment cleanup

pull/15957/head
ryan 6 years ago
parent 09ba8cd5d3
commit 8cca611727
  1. 13
      packages/grafana-ui/src/types/panel.ts
  2. 3
      public/app/features/dashboard/dashgrid/DashboardPanel.tsx

@ -27,10 +27,15 @@ export interface PanelEditorProps<T = any> {
}
/**
* Checks the existing model before the component is loaded
* This is useful for fixing options as configuration changes
* The object passed in is the panel model.... but not typed
* since that is not in grafana ui
* This function is called with the full panelModel before
* the pluginPanel is constructed. This gives you an opportunity
* to validate the panel settings before the panel loads.
*
* @param panelModel the whole panel object. including the configuration
* saved for other panels
*
* @returns the validated panel options that will be passed into the
* panel constructor
*/
export type PanelOptionsValidator<T = any> = (panelModel: any) => T;

@ -96,7 +96,8 @@ export class DashboardPanel extends PureComponent<Props, State> {
}
}
// This is be called before the plugin constructor, so the initial properties are valid
// This is called before the plugin is added to the three,
// it allows plugins to update options before loading
validateOptions = (plugin: PanelPlugin, panel: PanelModel) => {
const { reactPanel } = plugin.exports;
if (reactPanel && reactPanel.optionsValidator) {

Loading…
Cancel
Save