mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Tempo: Run search query with keyboard shortcut from input fields (#39247)
* Tempo: Run query with keyboard shortcut from duration fields
This commit is contained in:
parent
7db97097c9
commit
9c4e7eb659
@ -72,6 +72,12 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props
|
|||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onKeyDown = (keyEvent: React.KeyboardEvent) => {
|
||||||
|
if (keyEvent.key === 'Enter' && (keyEvent.shiftKey || keyEvent.ctrlKey)) {
|
||||||
|
onRunQuery();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={css({ maxWidth: '500px' })}>
|
<div className={css({ maxWidth: '500px' })}>
|
||||||
<InlineFieldRow>
|
<InlineFieldRow>
|
||||||
@ -140,6 +146,7 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props
|
|||||||
minDuration: v.currentTarget.value,
|
minDuration: v.currentTarget.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
</InlineFieldRow>
|
</InlineFieldRow>
|
||||||
@ -154,6 +161,7 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props
|
|||||||
maxDuration: v.currentTarget.value,
|
maxDuration: v.currentTarget.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
</InlineFieldRow>
|
</InlineFieldRow>
|
||||||
@ -168,6 +176,7 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props
|
|||||||
limit: v.currentTarget.value ? parseInt(v.currentTarget.value, 10) : undefined,
|
limit: v.currentTarget.value ? parseInt(v.currentTarget.value, 10) : undefined,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
</InlineFieldRow>
|
</InlineFieldRow>
|
||||||
|
Loading…
Reference in New Issue
Block a user