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;
|
||||
setIsFetching(status: boolean): void;
|
||||
}
|
||||
|
||||
export interface MessageFilters {
|
||||
name: string;
|
||||
code: string;
|
||||
|
@ -165,6 +166,21 @@ const Filters: React.FC<FiltersProps> = ({
|
|||
};
|
||||
}, [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(() => {
|
||||
setAttempt(attempt + 1);
|
||||
|
||||
|
@ -389,7 +405,7 @@ const Filters: React.FC<FiltersProps> = ({
|
|||
onChange={setSelectedPartitions}
|
||||
labelledBy="Select partitions"
|
||||
/>
|
||||
<S.ClearAll>Clear all</S.ClearAll>
|
||||
<S.ClearAll onClick={handleClearAllFilters}>Clear all</S.ClearAll>
|
||||
{isFetching ? (
|
||||
<Button
|
||||
type="button"
|
||||
|
|
Loading…
Add table
Reference in a new issue