mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-04 16:20:40 +08:00
Merge pull request #1304 from SigNoz/417-search-filter
feat: search filter is added in the trace filter
This commit is contained in:
commit
5a34ce2221
@ -39,16 +39,22 @@ function CommonCheckBox(props: CommonCheckBoxProps): JSX.Element {
|
||||
});
|
||||
};
|
||||
|
||||
const isMoreButtonAvilable = Boolean(
|
||||
numberOfFilters && statusObj.length > numberOfFilters,
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Search
|
||||
value={searchFilter}
|
||||
onChange={(e): void => setSearchFilter(e.target.value)}
|
||||
style={{
|
||||
padding: '0 3%',
|
||||
}}
|
||||
placeholder="Filter Values"
|
||||
/>
|
||||
{statusObj.length > 0 && (
|
||||
<Search
|
||||
value={searchFilter}
|
||||
onChange={(e): void => setSearchFilter(e.target.value)}
|
||||
style={{
|
||||
padding: '0 3%',
|
||||
}}
|
||||
placeholder="Filter Values"
|
||||
/>
|
||||
)}
|
||||
|
||||
{statusObj
|
||||
.sort((a, b) => {
|
||||
@ -60,13 +66,15 @@ function CommonCheckBox(props: CommonCheckBoxProps): JSX.Element {
|
||||
}
|
||||
return countA - countB;
|
||||
})
|
||||
.filter((_, index) => index < numberOfFilters)
|
||||
.filter((filter) => {
|
||||
if (searchFilter.length === 0) {
|
||||
return true;
|
||||
}
|
||||
return filter.includes(searchFilter);
|
||||
return filter
|
||||
.toLocaleLowerCase()
|
||||
.includes(searchFilter.toLocaleLowerCase());
|
||||
})
|
||||
.filter((_, index) => index < numberOfFilters)
|
||||
.map((e) => (
|
||||
<CheckBoxComponent
|
||||
key={e}
|
||||
@ -78,7 +86,7 @@ function CommonCheckBox(props: CommonCheckBoxProps): JSX.Element {
|
||||
/>
|
||||
))}
|
||||
|
||||
{numberOfFilters && statusObj.length > numberOfFilters && (
|
||||
{isMoreButtonAvilable && (
|
||||
<Button onClick={onClickMoreHandler} type="link">
|
||||
More
|
||||
</Button>
|
||||
|
@ -24,7 +24,7 @@ import {
|
||||
} from 'types/actions/trace';
|
||||
import { TraceFilterEnum, TraceReducer } from 'types/reducer/trace';
|
||||
|
||||
export const INITIAL_FILTER_VALUE = 4;
|
||||
export const INITIAL_FILTER_VALUE = 8;
|
||||
|
||||
const initialValue: TraceReducer = {
|
||||
filter: new Map(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user