Commit c71608aa by ryan

add panel on enter

parent 37c45a81
...@@ -154,6 +154,15 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP ...@@ -154,6 +154,15 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP
}); });
} }
filterKeyPress(evt) {
if (evt.key === 'Enter') {
let panel = _.head(this.state.panelPlugins);
if (panel) {
this.onAddPanel(panel);
}
}
}
filterPanels(panels, filter) { filterPanels(panels, filter) {
let regex = new RegExp(filter, 'i'); let regex = new RegExp(filter, 'i');
return panels.filter(panel => { return panels.filter(panel => {
...@@ -234,6 +243,7 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP ...@@ -234,6 +243,7 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP
placeholder="Panel Search Filter" placeholder="Panel Search Filter"
value={this.state.filter} value={this.state.filter}
onChange={this.filterChange.bind(this)} onChange={this.filterChange.bind(this)}
onKeyPress={this.filterKeyPress.bind(this)}
/> />
<i className="gf-form-input-icon fa fa-search" /> <i className="gf-form-input-icon fa fa-search" />
</label> </label>
......
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