This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new f7a7c6e06 feat(consumer): offer a skip-accumulation preset when 
resetting offsets (#3994)
f7a7c6e06 is described below

commit f7a7c6e06dc59c9c24bffe4993b05c6ff9849148
Author: 烤化の初雪 <[email protected]>
AuthorDate: Mon Sep 7 17:17:04 2026 +0800

    feat(consumer): offer a skip-accumulation preset when resetting offsets 
(#3994)
    
    Add a skip-accumulation quick action to the consumer offset reset modal
    that sets the reset timestamp to now, restoring the classic dashboard's
    dedicated skip-accumulation action. The existing preview-and-confirm
    flow still guards the reset, and the preset clears any stale preview
    like the other timestamp presets.
    
    Related to #3993.
    
    Co-authored-by: unbridled-41 
<[email protected]>
---
 .../pages/instance/__tests__/ConsumerPage.test.tsx | 30 ++++++++++++++++++++++
 web/src/pages/instance/consumer.tsx                |  9 +++++++
 2 files changed, 39 insertions(+)

diff --git a/web/src/pages/instance/__tests__/ConsumerPage.test.tsx 
b/web/src/pages/instance/__tests__/ConsumerPage.test.tsx
index 12f8e9256..aea364109 100644
--- a/web/src/pages/instance/__tests__/ConsumerPage.test.tsx
+++ b/web/src/pages/instance/__tests__/ConsumerPage.test.tsx
@@ -814,6 +814,36 @@ describe('Consumer page', () => {
     expect(screen.getByRole('button', { name: '确认重置' })).toBeDisabled();
   });
 
+  it('supports skipping accumulation by resetting to the latest offsets', 
async () => {
+    const user = userEvent.setup();
+    renderWithProviders(<ConsumerPage />);
+
+    await user.click(await screen.findByRole('button', { name: /重置位点/ }));
+    const topicSelect = screen.getByRole('combobox', { name: '目标 Topic' });
+    await user.click(topicSelect);
+    const option = await waitFor(() => {
+      const element = screen
+        .getAllByText('remote-topic')
+        .find((candidate) => 
candidate.classList.contains('ant-select-item-option-content'));
+      if (!element) throw new Error('Missing target Topic option');
+      return element;
+    });
+    await user.click(option);
+
+    const beforeSkip = Date.now();
+    await user.click(screen.getByRole('button', { name: /跳过积压/ }));
+    await user.click(screen.getByRole('button', { name: /预览影响/ }));
+
+    await waitFor(() => {
+      const calls = 
vi.mocked(consumerService.previewConsumerOffsetReset).mock.calls;
+      const request = calls[calls.length - 1]?.[0];
+      expect(request?.timestamp).toBeGreaterThanOrEqual(beforeSkip);
+      expect(request?.timestamp).toBeLessThanOrEqual(Date.now());
+    });
+    expect(await screen.findByText('将回放 10 条消息')).toBeInTheDocument();
+    await waitFor(() => expect(screen.getByRole('button', { name: '确认重置' 
})).toBeEnabled());
+  });
+
   it('blocks reset confirmation when the preview has failed queues', async () 
=> {
     vi.mocked(consumerService.previewConsumerOffsetReset).mockResolvedValue({
       instanceId: 'instance-1',
diff --git a/web/src/pages/instance/consumer.tsx 
b/web/src/pages/instance/consumer.tsx
index 2c9c9b998..34036b1ff 100644
--- a/web/src/pages/instance/consumer.tsx
+++ b/web/src/pages/instance/consumer.tsx
@@ -2465,6 +2465,15 @@ const ConsumerPageContent = ({
                 快捷选择
               </Text>
               <Space wrap>
+                <Button
+                  size="small"
+                  onClick={() => {
+                    setResetTime(dayjs());
+                    clearResetPreview();
+                  }}
+                >
+                  跳过积压(重置到最新)
+                </Button>
                 <Button
                   size="small"
                   onClick={() => {

Reply via email to