wip: changes

This commit is contained in:
Torkel Ödegaard
2018-12-13 07:44:58 +01:00
parent 1751a51088
commit 666e8e8330
6 changed files with 25 additions and 12 deletions

View File

@@ -5,7 +5,7 @@ import { FadeIn } from 'app/core/components/Animations/FadeIn';
interface Props {
children: JSX.Element;
heading: string;
renderToolbar?: () => JSX.Element | JSX.Element[];
renderToolbar?: () => JSX.Element;
toolbarItems?: EditorToolBarView[];
}
@@ -106,8 +106,12 @@ export class EditorTabBody extends PureComponent<Props, State> {
<div className="toolbar">
<div className="toolbar__heading">{heading}</div>
{renderToolbar && renderToolbar()}
<div className="gf-form--grow" />
{toolbarItems.map(item => this.renderButton(item))}
{toolbarItems.length > 0 && (
<>
<div className="gf-form--grow" />
{toolbarItems.map(item => this.renderButton(item))}
</>
)}
</div>
<div className="panel-editor__scroll">
<CustomScrollbar autoHide={false}>

View File

@@ -169,6 +169,10 @@ export class VisualizationTab extends PureComponent<Props, State> {
/>
<i className="gf-form-input-icon fa fa-search" />
</label>
<div className="flex-grow" />
<button className="btn btn-link" onClick={this.onCloseVizPicker}>
<i className="fa fa-chevron-up" />
</button>
</>
);
} else {
@@ -183,14 +187,17 @@ export class VisualizationTab extends PureComponent<Props, State> {
};
onTypeChanged = (plugin: PanelPlugin) => {
// this.setState({ isVizPickerOpen: false });
this.props.onTypeChanged(plugin);
if (plugin.id === this.props.plugin.id) {
this.setState({ isVizPickerOpen: false });
} else {
this.props.onTypeChanged(plugin);
}
};
render() {
const { plugin } = this.props;
const { isVizPickerOpen, searchQuery } = this.state;
const toolbarItems: EditorToolBarView = [];
const toolbarItems: EditorToolBarView[] = [];
if (!isVizPickerOpen) {
toolbarItems.push({

View File

@@ -62,7 +62,6 @@ export class VizTypePicker extends PureComponent<Props> {
};
render() {
const { onClose } = this.props;
const filteredPluginList = this.getFilteredPluginList();
return (