1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Don't clear searchValue on CommandDialog onBlur (#3172)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-07-06 04:01:11 -04:00 committed by GitHub
parent 8ac3203924
commit b2836eb57a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,16 +35,17 @@ import { clusterViewURL } from "../../../common/routes";
@observer @observer
export class CommandDialog extends React.Component { export class CommandDialog extends React.Component {
@observable menuIsOpen = true; @observable menuIsOpen = true;
@observable searchValue: any = undefined;
constructor(props: {}) { constructor(props: {}) {
super(props); super(props);
makeObservable(this); makeObservable(this);
} }
@computed get activeEntity(): CatalogEntity | undefined { @computed get activeEntity(): CatalogEntity | undefined {
return catalogEntityRegistry.activeEntity; return catalogEntityRegistry.activeEntity;
} }
@computed get options() { @computed get options() {
const registry = CommandRegistry.getInstance(); const registry = CommandRegistry.getInstance();
@ -104,14 +105,24 @@ export class CommandDialog extends React.Component {
return ( return (
<Select <Select
menuPortalTarget={null} menuPortalTarget={null}
onChange={(v) => this.onChange(v.value)} onChange={v => this.onChange(v.value)}
components={{ DropdownIndicator: null, IndicatorSeparator: null }} components={{
DropdownIndicator: null,
IndicatorSeparator: null,
}}
menuIsOpen={this.menuIsOpen} menuIsOpen={this.menuIsOpen}
options={this.options} options={this.options}
autoFocus={true} autoFocus={true}
escapeClearsValue={false} escapeClearsValue={false}
data-test-id="command-palette-search" data-test-id="command-palette-search"
placeholder="Type a command or search&hellip;" /> placeholder="Type a command or search&hellip;"
onInputChange={(newValue, { action }) => {
if (action === "input-change") {
this.searchValue = newValue;
}
}}
inputValue={this.searchValue}
/>
); );
} }
} }