From 35beebc30a066f7472b41f069899c9f4eb82dcf4 Mon Sep 17 00:00:00 2001 From: Chengxun Lee <24319042+bclswl0827@users.noreply.github.com> Date: Wed, 6 Mar 2024 00:18:31 +0800 Subject: [PATCH] Back to limiting waveform query duration to 1 hour --- CHANGELOG.md | 5 ++++ VERSION | 2 +- app/v1/history/types.go | 6 ++-- frontend/src/.env | 4 +-- frontend/src/src/components/Input.tsx | 40 ++++++++++++--------------- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3eed263..8944ab60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ Starting from v2.2.5, all notable changes to this project will be documented in this file. +## v2.10.2 + +- Input component optimization +- Back to limiting waveform query duration to 1 hour + ## v2.10.1 - Support download SeisComP3 XML inventory directly from the frontend diff --git a/VERSION b/VERSION index c0151c8a..1e8349cd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.10.1 +v2.10.2 diff --git a/app/v1/history/types.go b/app/v1/history/types.go index 6b0075f7..39afa6f4 100644 --- a/app/v1/history/types.go +++ b/app/v1/history/types.go @@ -3,9 +3,9 @@ package history import "time" const ( - JSON_DURATION = time.Hour * 24 // The maximum duration of the JSON data to be exported - SAC_DURATION = time.Hour // The maximum duration of the SAC data to be exported - THRESHOLD = time.Minute // There are uneven gaps between the data if time difference is greater than THRESHOLD + JSON_DURATION = time.Hour // The maximum duration of the JSON data to be exported + SAC_DURATION = time.Hour // The maximum duration of the SAC data to be exported + THRESHOLD = time.Minute // There are uneven gaps between the data if time difference is greater than THRESHOLD ) type History struct{} diff --git a/frontend/src/.env b/frontend/src/.env index bd8bb46e..ee3b5f8d 100644 --- a/frontend/src/.env +++ b/frontend/src/.env @@ -1,2 +1,2 @@ -REACT_APP_VERSION=v2.10.1 -REACT_APP_RELEASE=f4439441-20240305224739 +REACT_APP_VERSION=v2.10.2 +REACT_APP_RELEASE=a98cab67-20240306000257 diff --git a/frontend/src/src/components/Input.tsx b/frontend/src/src/components/Input.tsx index eaeda87a..ab2da48a 100644 --- a/frontend/src/src/components/Input.tsx +++ b/frontend/src/src/components/Input.tsx @@ -1,6 +1,5 @@ import { TextField } from "@mui/material"; import { ChangeEvent, InputHTMLAttributes } from "react"; -import { userThrottle } from "../helpers/utils/userThrottle"; interface InputProps { readonly label: string; @@ -23,34 +22,29 @@ export const Input = (props: InputProps) => { onValueChange, } = props; - const handleOnChange = userThrottle( - ({ target }: ChangeEvent) => { - if (!onValueChange) { + const handleOnChange = ({ target }: ChangeEvent) => { + if (!onValueChange) { + return; + } + const { value } = target; + if (type === "number") { + const numberValue = Number(value); + if (isNaN(numberValue)) { + onValueChange(defaultValue); return; } - const { value } = target; - if (type === "number") { - const numberValue = Number(value); - if (isNaN(numberValue)) { - target.value = defaultValue.toString(); + if (numberLimit) { + const { max, min } = numberLimit; + if (numberValue > max || numberValue < min) { onValueChange(defaultValue); return; } - if (numberLimit) { - const { max, min } = numberLimit; - if (numberValue > max || numberValue < min) { - target.value = defaultValue.toString(); - onValueChange(defaultValue); - return; - } - } - onValueChange(numberValue); - } else { - onValueChange(value); } - }, - 1000 - ); + onValueChange(numberValue); + } else { + onValueChange(value); + } + }; return (