tju-yxq opened a new pull request, #3164:
URL: https://github.com/apache/rocketmq-dashboard/pull/3164

   ## What happened
   
   In the Message Explorer, `By Message Key` only accepted a Topic and Key. The 
backend already supported `tag`, `startTime`, and `endTime` for key queries, 
but the UI never sent them. Key searches also bypassed the seven-day window 
validation used by topic queries, so a caller could submit an unbounded or 
reversed key-query request directly to the API.
   
   For on-call searches, this makes a common workflow unnecessarily broad: an 
incident usually has both a business key and a known time window, and sometimes 
a known tag. Without those filters, key searches can return many unrelated 
messages and require manual inspection.
   
   ## Change
   
   Backend:
   
   - Validate explicit key-query time windows before calling the provider:
     - reject negative timestamps
     - reject `startTime >= endTime`
     - reject ranges longer than seven days
   - Keep key queries without explicit timestamps backward compatible; they 
continue to use provider defaults.
   - Message ID lookups remain unchanged because their time window is not part 
of that lookup.
   
   Frontend:
   
   - Add optional Tag and time-range controls to the `By Message Key` form.
   - Send trimmed `tag`, `startTime`, and `endTime` values with key queries.
   - Apply the same start-before-end and seven-day maximum validation as Topic 
queries.
   - Preserve Tag and time values when replaying a saved key query from 
history, and clear Tag on reset.
   
   Tests:
   
   - Backend service tests cover reversed, over-long, and omitted key-query 
windows, and verify the provider is not called for invalid requests.
   - A focused UI test verifies that a key query submits the selected topic, 
trimmed key/tag, and explicit time range.
   - Updated the existing message-page validation test to re-query the button 
after async mode switches and to expect the new key-query time parameters.
   
   ## Verification
   
   Focused backend:
   
   ```
   cd server
   mvn -q '-Dtest=MessageServiceTest,MessageControllerTest' test
   mvn -q checkstyle:check
   ```
   
   Focused frontend:
   
   ```
   cd web
   npm test -- MessagePage.test.tsx MessagePageKeyQuery.test.tsx 
MessagePageAsyncState.test.tsx message.test.ts --run
   ```
   
   Result: 5 files / 37 tests passed.
   
   Lint/build:
   
   ```
   npm run lint -- --quiet
   npm run build
   ```
   
   Lint reported 0 errors and 10 pre-existing warnings elsewhere in the 
codebase. The production build completed successfully.
   
   `git diff --check` passed before commit.
   
   The production/config additions are 54 lines (19 backend, 35 frontend). This 
is the natural size for the UI/API gap; I did not pad the change with unrelated 
refactoring.
   
   Closes #3163
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to