Implemented from-to inputs

This commit is contained in:
TzeYiing authored and Copple committed 2022-03-30 17:07:39 +02:00
1 parent b830ee41cd
commit f0ea00cf66
2 files changed
+13 -1

No files matched your search

@@ -86,7 +86,7 @@ const LogPanel: FC<Props> = ({
}
}
const handleFromChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const handleToChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value
if (value !== '' && isNaN(Date.parse(value))) {
setTo({ value, error: 'Invalid ISO 8601 timestamp' })
@@ -91,6 +91,18 @@ export const LogPage: NextPage = () => {
}
}, [s, te, ts])
useEffect(() => {
router.push({
pathname: router.pathname,
query: {
...router.query,
q: undefined,
s: filters.search_query || '',
ts: params.timestamp_start,
te: params.timestamp_end,
},
})
}, [params.timestamp_end, params.timestamp_start, filters.search_query])
const onSelectTemplate = (template: LogTemplate) => {
setFilters((prev) => ({ ...prev, search_query: template.searchString }))
}