feat(webui): Provide improved calculation of time range for queries:#1336
Conversation
…ge of existing archives (resolves y-scope#970).
WalkthroughAdds async time-range resolution (including ALL_TIME via SQL), updates submit to accept null timestamps and await async range resolution, stops auto-updating presets in the TimeRange UI, introduces default time-range constants and Dayjs typing across the search state, and relaxes schema to allow null timestamps. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Submit as SubmitButton
participant Store as SearchStore
participant Map as TIME_RANGE_OPTION_DAYJS_MAP
participant SQL as fetchAllTimeRange
participant API as Query API
Note right of Submit #DDEBF7: submit handler is async and uses messageApi
User->>Submit: Click
Submit->>Store: read timeRangeOption, timeRange, selectDataset, storageEngine
alt timeRangeOption == CUSTOM
Submit->>Submit: newTimeRange = timeRange
else
Submit->>Map: await preset handler (async)
alt preset == ALL_TIME
Map->>SQL: fetchAllTimeRange(selectDataset)
SQL-->>Map: [begin,end] or error
end
Map-->>Submit: [begin,end] or error
alt error
Submit->>Submit: newTimeRange = DEFAULT_TIME_RANGE
Submit->>User: show warning (messageApi)
end
Submit->>Store: updateTimeRange(newTimeRange)
end
alt storageEngine == CLP_S and selectDataset missing
Submit->>User: log error & abort
else
Submit->>Submit: build payload (timestamps null when ALL_TIME)
Submit->>API: submit query job
API-->>Submit: response
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}⚙️ CodeRabbit configuration file
Files:
🧬 Code graph analysis (1)components/webui/client/src/pages/SearchPage/SearchControls/SearchButton/SubmitButton/index.tsx (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
junhaoliao
left a comment
There was a problem hiding this comment.
the code structure lgtm. will validate before approving on the posted comments are addressed
|
Do you think we should update TIME_RANGE_OPTION_DAYJS_MAP in /home/davidmawk/clp/components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/utils.tsx to call the fetch timestamp function? Then we could upgrade the whole UI, so that it calls the function in TIME_RANGE_OPTION_DAYJS_MAP when we submit a query. Right now the timestamps get outdated, but we could potentially fix this for all options, not just allTime |
sure I'll do that |
davemarco
left a comment
There was a problem hiding this comment.
reponded to ur question
|
|
junhaoliao
left a comment
There was a problem hiding this comment.
nice job. deferring to @davemarco 's review
…-scope#1336) - Treat the "All Time" time range as spanning the time range of existing archives. - Determine the time range when the submit button is clicked. - Include logs compressed without a timestamp key.
Description
From the issue page:
Currently, the "All Time" time range in the search UI defaults to [UNIX epoch, current time + 1 year]. Thus, when a user enters a query and the results are displayed, they are usually shown as a single graph near the end of the timeline.
Instead, it would be better to treat "All Time" as spanning the time range of the existing archives.
When a query is run for "All Time", this PR fetches the time range of the existing archives in clp-database; translates that into a query for the time range of the existing archives.
Checklist
breaking change.
Validation performed
Search for
*on the search page with the "all time" range option selected:Summary by CodeRabbit
New Features
Bug Fixes
Refactor