Commit b6a5375a by Torkel Ödegaard

wip

parent 21e1d7b0
...@@ -159,7 +159,7 @@ export class VisualizationTab extends PureComponent<Props, State> { ...@@ -159,7 +159,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
placeholder="" placeholder=""
onChange={this.onSearchQueryChange} onChange={this.onSearchQueryChange}
value={searchQuery} value={searchQuery}
ref={elem => (this.searchInput = elem)} ref={elem => elem && elem.focus()}
/> />
<i className="gf-form-input-icon fa fa-search" /> <i className="gf-form-input-icon fa fa-search" />
</label> </label>
...@@ -192,8 +192,12 @@ export class VisualizationTab extends PureComponent<Props, State> { ...@@ -192,8 +192,12 @@ export class VisualizationTab extends PureComponent<Props, State> {
return ( return (
<EditorTabBody heading="Visualization" renderToolbar={this.renderToolbar} toolbarItems={[panelHelp]}> <EditorTabBody heading="Visualization" renderToolbar={this.renderToolbar} toolbarItems={[panelHelp]}>
{isVizPickerOpen && <VizTypePicker current={plugin} onTypeChanged={this.onTypeChanged} searchQuery={searchQuery} />} <>
{isVizPickerOpen && (
<VizTypePicker current={plugin} onTypeChanged={this.onTypeChanged} searchQuery={searchQuery} />
)}
{this.renderPanelOptions()} {this.renderPanelOptions()}
</>
</EditorTabBody> </EditorTabBody>
); );
} }
......
...@@ -43,7 +43,6 @@ export class VizTypePicker extends PureComponent<Props> { ...@@ -43,7 +43,6 @@ export class VizTypePicker extends PureComponent<Props> {
key={plugin.id} key={plugin.id}
isCurrent={isCurrent} isCurrent={isCurrent}
plugin={plugin} plugin={plugin}
isSelected={false}
onClick={() => onTypeChanged(plugin)} onClick={() => onTypeChanged(plugin)}
/> />
); );
......
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { PanelPlugin } from 'app/types/plugins'; import { PanelPlugin } from 'app/types/plugins';
interface Props { interface Props {
isSelected: boolean;
isCurrent: boolean; isCurrent: boolean;
plugin: PanelPlugin; plugin: PanelPlugin;
onClick: () => void; onClick: () => void;
onMouseEnter: () => void;
} }
const VizTypePickerPlugin = React.memo( const VizTypePickerPlugin = React.memo(
({ isSelected, isCurrent, plugin, onClick, onMouseEnter }: Props) => { ({ isCurrent, plugin, onClick }: Props) => {
const cssClass = classNames({ const cssClass = classNames({
'viz-picker__item': true, 'viz-picker__item': true,
'viz-picker__item--selected': isSelected,
'viz-picker__item--current': isCurrent, 'viz-picker__item--current': isCurrent,
}); });
return ( return (
<div className={cssClass} onClick={onClick} title={plugin.name} onMouseEnter={onMouseEnter}> <div className={cssClass} onClick={onClick} title={plugin.name}>
<div className="viz-picker__item-name">{plugin.name}</div> <div className="viz-picker__item-name">{plugin.name}</div>
<img className="viz-picker__item-img" src={plugin.info.logos.small} /> <img className="viz-picker__item-img" src={plugin.info.logos.small} />
</div> </div>
); );
}, },
(prevProps, nextProps) => { (prevProps, nextProps) => {
if (prevProps.isSelected === nextProps.isSelected && prevProps.isCurrent === nextProps.isCurrent) { if (prevProps.isCurrent === nextProps.isCurrent) {
return true; return true;
} }
return false; return false;
......
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
border: 1px solid $orange; border: 1px solid $orange;
} }
&--selected { &:hover {
box-shadow: $panel-editor-viz-item-shadow-hover; box-shadow: $panel-editor-viz-item-shadow-hover;
background: $panel-editor-viz-item-bg-hover; background: $panel-editor-viz-item-bg-hover;
border: $panel-editor-viz-item-border-hover; border: $panel-editor-viz-item-border-hover;
......
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