Added functionality to ClearAll button (#1813)
* Added functionality to ClearAll button * Added updating count of partitions in URL * Comments removed * Added SeekDirection reset * White spaces removed Co-authored-by: k.morozov <k.morozov@ffin.ru>
This commit is contained in:
parent
30e0238bd1
commit
a38077d9d7
1 changed files with 17 additions and 1 deletions
|
@ -51,6 +51,7 @@ export interface FiltersProps {
|
||||||
updateMeta(meta: TopicMessageConsuming): void;
|
updateMeta(meta: TopicMessageConsuming): void;
|
||||||
setIsFetching(status: boolean): void;
|
setIsFetching(status: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MessageFilters {
|
export interface MessageFilters {
|
||||||
name: string;
|
name: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
@ -165,6 +166,21 @@ const Filters: React.FC<FiltersProps> = ({
|
||||||
};
|
};
|
||||||
}, [attempt, query, queryType, seekDirection, activeFilter]);
|
}, [attempt, query, queryType, seekDirection, activeFilter]);
|
||||||
|
|
||||||
|
const handleClearAllFilters = () => {
|
||||||
|
setCurrentSeekType(SeekType.OFFSET);
|
||||||
|
setQuery('');
|
||||||
|
changeSeekDirection(SeekDirection.FORWARD);
|
||||||
|
getSelectedPartitionsFromSeekToParam(searchParams, partitions);
|
||||||
|
setSelectedPartitions(
|
||||||
|
partitions.map((partition: Partition) => {
|
||||||
|
return {
|
||||||
|
value: partition.partition,
|
||||||
|
label: String(partition.partition),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const handleFiltersSubmit = React.useCallback(() => {
|
const handleFiltersSubmit = React.useCallback(() => {
|
||||||
setAttempt(attempt + 1);
|
setAttempt(attempt + 1);
|
||||||
|
|
||||||
|
@ -389,7 +405,7 @@ const Filters: React.FC<FiltersProps> = ({
|
||||||
onChange={setSelectedPartitions}
|
onChange={setSelectedPartitions}
|
||||||
labelledBy="Select partitions"
|
labelledBy="Select partitions"
|
||||||
/>
|
/>
|
||||||
<S.ClearAll>Clear all</S.ClearAll>
|
<S.ClearAll onClick={handleClearAllFilters}>Clear all</S.ClearAll>
|
||||||
{isFetching ? (
|
{isFetching ? (
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
Loading…
Add table
Reference in a new issue