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