mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
added flags to vizpicker from query param
This commit is contained in:
parent
f6b46f7a34
commit
e4dad78045
@ -17,6 +17,17 @@ export interface State {
|
|||||||
copiedPanelPlugins: any[];
|
copiedPanelPlugins: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Location = {
|
||||||
|
query: {
|
||||||
|
panelId: number;
|
||||||
|
edit: boolean;
|
||||||
|
fullscreen: boolean;
|
||||||
|
tab?: string;
|
||||||
|
isVizPickerOpen?: boolean;
|
||||||
|
};
|
||||||
|
partial: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export class AddPanelWidget extends React.Component<Props, State> {
|
export class AddPanelWidget extends React.Component<Props, State> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -62,18 +73,8 @@ export class AddPanelWidget extends React.Component<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
moveToEdit(panel, tab) {
|
moveToEdit(location) {
|
||||||
reduxStore.dispatch(
|
reduxStore.dispatch(updateLocation(location));
|
||||||
updateLocation({
|
|
||||||
query: {
|
|
||||||
panelId: panel.id,
|
|
||||||
edit: true,
|
|
||||||
fullscreen: true,
|
|
||||||
tab: tab,
|
|
||||||
},
|
|
||||||
partial: true,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onCreateNewPanel = (tab = 'queries') => {
|
onCreateNewPanel = (tab = 'queries') => {
|
||||||
@ -89,7 +90,28 @@ export class AddPanelWidget extends React.Component<Props, State> {
|
|||||||
dashboard.addPanel(newPanel);
|
dashboard.addPanel(newPanel);
|
||||||
dashboard.removePanel(this.props.panel);
|
dashboard.removePanel(this.props.panel);
|
||||||
|
|
||||||
this.moveToEdit(newPanel, tab);
|
let location: Location = {
|
||||||
|
query: {
|
||||||
|
panelId: newPanel.id,
|
||||||
|
edit: true,
|
||||||
|
fullscreen: true,
|
||||||
|
},
|
||||||
|
partial: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (tab === 'visualization') {
|
||||||
|
location = {
|
||||||
|
...location,
|
||||||
|
query: {
|
||||||
|
...location.query,
|
||||||
|
tab: 'visualization',
|
||||||
|
isVizPickerOpen: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
this.moveToEdit(location);
|
||||||
|
} else {
|
||||||
|
this.moveToEdit(location);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onPasteCopiedPanel = panelPluginInfo => {
|
onPasteCopiedPanel = panelPluginInfo => {
|
||||||
|
@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|||||||
|
|
||||||
// Utils & Services
|
// Utils & Services
|
||||||
import { AngularComponent, getAngularLoader } from 'app/core/services/AngularLoader';
|
import { AngularComponent, getAngularLoader } from 'app/core/services/AngularLoader';
|
||||||
//TODO: See PanelEdit
|
import { store } from 'app/store/store';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { EditorTabBody, EditorToolbarView } from './EditorTabBody';
|
import { EditorTabBody, EditorToolbarView } from './EditorTabBody';
|
||||||
@ -39,7 +39,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isVizPickerOpen: false,
|
isVizPickerOpen: store.getState().location.query.isVizPickerOpen === true,
|
||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
scrollTop: 0,
|
scrollTop: 0,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user