Commit 49550cce by Johannes Schill

wip: panel-header: More merge conflicts during cherry pick

parent dbf7f3fb
......@@ -125,7 +125,7 @@ export class DashboardPanel extends PureComponent<Props, State> {
// withMenuOptions={pluginExports.withMenuOptions}
panel={this.props.panel}
dashboard={this.props.dashboard}
moduleMenu={pluginExports.moduleMenu}
getMenuAdditional={pluginExports.getMenuAdditional}
/>
</div>
{this.props.panel.isEditing && (
......
......@@ -14,14 +14,14 @@ import { PanelHeaderMenu } from './PanelHeader/PanelHeaderMenu';
import { PanelModel } from '../panel_model';
import { DashboardModel } from '../dashboard_model';
import { TimeRange, PanelProps, TimeSeries } from 'app/types';
import { PanelHeaderGetMenuAdditional } from 'app/types/panel';
import { DataSourceApi } from 'app/types/series';
export interface PanelChromeProps {
panel: PanelModel;
dashboard: DashboardModel;
component: ComponentClass<PanelProps>;
// withMenuOptions?: (c: typeof PanelHeaderMenu, p: PanelModel) => typeof PanelHeaderMenu;
moduleMenu?: any;
getMenuAdditional?: PanelHeaderGetMenuAdditional;
}
export interface PanelChromeState {
......@@ -52,7 +52,7 @@ export class PanelChrome extends PureComponent<PanelChromeProps, PanelChromeStat
try {
const dataSourceSrv = getDatasourceSrv();
const dataSourceApi = await dataSourceSrv.get(datasource);
this.setState(prevState => ({
this.setState((prevState: PanelChromeState) => ({
...prevState,
dataSourceApi,
}));
......@@ -95,11 +95,12 @@ export class PanelChrome extends PureComponent<PanelChromeProps, PanelChromeStat
}
render() {
const { panel, dashboard, moduleMenu } = this.props;
const { panel, dashboard, getMenuAdditional } = this.props;
const { refreshCounter, timeRange, dataSourceApi, timeSeries, renderCounter } = this.state;
const { targets } = panel;
const PanelComponent = this.props.component;
const panelSpecificMenuOptions = moduleMenu(panel, dataSourceApi, timeSeries);
const panelSpecificMenuOptions = getMenuAdditional(panel, dataSourceApi, timeSeries);
const additionalMenuItems = panelSpecificMenuOptions.additionalMenuItems || undefined;
const additionalSubMenuItems = panelSpecificMenuOptions.additionalSubMenuItems || undefined;
......
......@@ -4,8 +4,8 @@ import { PanelModel } from 'app/features/dashboard/panel_model';
import { PanelHeaderMenuItem } from './PanelHeaderMenuItem';
import { PanelHeaderMenuItemProps } from 'app/types/panel';
import { getPanelMenu } from 'app/features/dashboard/utils/panel_menu';
import { DataSourceApi } from 'app/types/series';
import { TimeSeries } from 'app/types';
import { DataSourceApi } from 'app/types/series';
export interface PanelHeaderMenuProps {
panel: PanelModel;
......
......@@ -7,8 +7,6 @@ import { Switch } from 'app/core/components/Switch/Switch';
import { getTimeSeriesVMs } from 'app/viz/state/timeSeries';
import { PanelProps, PanelOptionsProps, NullValueMode } from 'app/types';
// import { moduleMenu } from './moduleMenu';
interface Options {
showBars: boolean;
showLines: boolean;
......@@ -75,4 +73,4 @@ export class GraphOptions extends PureComponent<PanelOptionsProps<Options>> {
}
export { Graph2 as PanelComponent, GraphOptions as PanelOptionsComponent };
export { moduleMenu } from './moduleMenu';
export { getMenuAdditional } from './moduleMenu';
......@@ -7,8 +7,11 @@ import { store } from 'app/store/configureStore';
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
import appEvents from 'app/core/app_events';
import { PanelHeaderMenuItemProps, PanelHeaderMenuItemTypes } from 'app/types/panel';
import { TimeSeries } from 'app/types/series';
import { DataSource } from 'app/types/datasources';
import { PanelModel } from 'app/features/dashboard/panel_model';
export const moduleMenu = (panel, dataSourceApi, timeSeries) => {
export const getMenuAdditional = (panel: PanelModel, dataSourceApi: DataSource, timeSeries: TimeSeries[]) => {
const onExploreClick = async () => {
const datasourceSrv = getDatasourceSrv();
const timeSrv = getTimeSrv();
......@@ -19,7 +22,7 @@ export const moduleMenu = (panel, dataSourceApi, timeSeries) => {
};
const onExportCsv = () => {
const model = {} as { seriesList: string };
const model = {} as { seriesList: TimeSeries[] };
model.seriesList = timeSeries;
appEvents.emit('show-modal', {
templateHtml: '<export-data-modal data="model.seriesList"></export-data-modal>',
......
import { LoadingState, TimeSeries, TimeRange } from './series';
import { LoadingState, TimeSeries, TimeRange, DataSourceApi } from './series';
import { PanelModel } from 'app/features/dashboard/panel_model';
export interface PanelProps<T = any> {
timeSeries: TimeSeries[];
......@@ -31,7 +32,11 @@ export interface PanelHeaderMenuItemProps {
role?: string;
}
export interface PanelMenuExtras {
export interface PanelHeaderMenuAdditional {
additionalMenuItems: PanelHeaderMenuItemProps[];
additionalSubMenuItems: PanelHeaderMenuItemProps[];
}
export interface PanelHeaderGetMenuAdditional {
(panel: PanelModel, dataSourceApi: DataSourceApi, timeSeries: TimeSeries[]): PanelHeaderMenuAdditional;
}
import { ComponentClass } from 'react';
import { PanelProps, PanelOptionsProps } from './panel';
import { PanelHeaderGetMenuAdditional } from 'app/types/panel';
export interface PluginExports {
Datasource?: any;
......@@ -13,7 +14,7 @@ export interface PluginExports {
PanelCtrl?;
PanelComponent?: ComponentClass<PanelProps>;
PanelOptionsComponent: ComponentClass<PanelOptionsProps>;
moduleMenu?: any;
getMenuAdditional?: PanelHeaderGetMenuAdditional;
}
export interface PanelPlugin {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment