UserPicker: Use clearable AsyncSelect for the UserPicker (#27994)

This commit is contained in:
Alex Khomenko 2020-10-03 08:19:45 +03:00 committed by GitHub
parent dfe04ea3e8
commit 6173aa70b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,7 @@ import React, { Component } from 'react';
import _ from 'lodash';
// Components
import { LegacyForms } from '@grafana/ui';
const { AsyncSelect } = LegacyForms;
import { AsyncSelect } from '@grafana/ui';
// Utils & Services
import { debounce } from 'lodash';
@ -66,13 +65,14 @@ export class UserPicker extends Component<Props, State> {
return (
<div className="user-picker" data-testid="userPicker">
<AsyncSelect
isClearable
className={className}
isLoading={isLoading}
defaultOptions={true}
loadOptions={this.debouncedSearch}
onChange={onSelected}
placeholder="Select user"
noOptionsMessage={() => 'No users found'}
noOptionsMessage="No users found"
/>
</div>
);