mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-17 14:17:28 +08:00
webui task-audit: persist EKG time window selection in localStorage
This commit is contained in:
@@ -47,7 +47,10 @@ const TaskAudit: React.FC = () => {
|
|||||||
const [ekgSourceStats, setEkgSourceStats] = useState<Record<string, number>>({});
|
const [ekgSourceStats, setEkgSourceStats] = useState<Record<string, number>>({});
|
||||||
const [ekgChannelStats, setEkgChannelStats] = useState<Record<string, number>>({});
|
const [ekgChannelStats, setEkgChannelStats] = useState<Record<string, number>>({});
|
||||||
const [ekgEscalationCount, setEkgEscalationCount] = useState<number>(0);
|
const [ekgEscalationCount, setEkgEscalationCount] = useState<number>(0);
|
||||||
const [ekgWindow, setEkgWindow] = useState<'6h' | '24h' | '7d'>('24h');
|
const [ekgWindow, setEkgWindow] = useState<'6h' | '24h' | '7d'>(() => {
|
||||||
|
const saved = typeof window !== 'undefined' ? window.localStorage.getItem('taskAudit.ekgWindow') : null;
|
||||||
|
return saved === '6h' || saved === '24h' || saved === '7d' ? saved : '24h';
|
||||||
|
});
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -93,6 +96,12 @@ const TaskAudit: React.FC = () => {
|
|||||||
|
|
||||||
useEffect(() => { fetchData(); }, [q, reportDate, ekgWindow]);
|
useEffect(() => { fetchData(); }, [q, reportDate, ekgWindow]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
window.localStorage.setItem('taskAudit.ekgWindow', ekgWindow);
|
||||||
|
}
|
||||||
|
}, [ekgWindow]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const exportDailyReport = () => {
|
const exportDailyReport = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user