forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profiling] Improve finding a function (elastic#210437)
closes elastic/prodfiler#4534 TopN functions: https://github.com/user-attachments/assets/1b62a50f-3c6f-4cd5-8971-019ca403893c Diff TopN functions: https://github.com/user-attachments/assets/0c598317-9423-44b4-9d3f-079d22a0194c
- Loading branch information
1 parent
c5857f9
commit 929cd7d
Showing
8 changed files
with
338 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...utions/observability/plugins/profiling/public/components/search_functions_input/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { EuiFieldSearch } from '@elastic/eui'; | ||
import { debounce } from 'lodash'; | ||
import React, { useCallback, useMemo, useState } from 'react'; | ||
|
||
interface Props { | ||
value: string; | ||
onChange: (functionName: string) => void; | ||
} | ||
|
||
export function SearchFunctionsInput({ value, onChange }: Props) { | ||
const [searchQuery, setSearchQuery] = useState(value); | ||
const debouncedOnChange = useMemo(() => debounce(onChange, 300), [onChange]); | ||
const handleSearchChange = useCallback( | ||
(e: React.ChangeEvent<HTMLInputElement>) => { | ||
setSearchQuery(e.target.value); | ||
debouncedOnChange(e.target.value); | ||
}, | ||
[debouncedOnChange] | ||
); | ||
return ( | ||
<EuiFieldSearch | ||
data-test-subj="tableSearchInput" | ||
placeholder="Search functions by name" | ||
fullWidth={true} | ||
value={searchQuery} | ||
onChange={handleSearchChange} | ||
/> | ||
); | ||
} |
Oops, something went wrong.