This is an automated email from the ASF dual-hosted git repository.
guoqqqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new bfd29b36f fix(consumers): redirect to /consumers after deleting a
consumer (#3421)
bfd29b36f is described below
commit bfd29b36fc2018b1b3131fc57d0df8526f2d5680
Author: Ming Wen <[email protected]>
AuthorDate: Mon Jul 13 09:57:53 2026 +0800
fix(consumers): redirect to /consumers after deleting a consumer (#3421)
---
.../regression/consumers.delete-redirect.spec.ts | 63 ++++++++++++++++++++++
src/routes/consumers/detail.$username/index.tsx | 2 +-
2 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/e2e/tests/regression/consumers.delete-redirect.spec.ts
b/e2e/tests/regression/consumers.delete-redirect.spec.ts
new file mode 100644
index 000000000..45c57b753
--- /dev/null
+++ b/e2e/tests/regression/consumers.delete-redirect.spec.ts
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Regression: deleting a consumer from its detail page used to navigate to
+// /consumer_groups (copy-paste from a sibling page). The user must land on
+// the consumers list they came from.
+
+import { consumersPom } from '@e2e/pom/consumers';
+import { randomId } from '@e2e/utils/common';
+import { e2eReq } from '@e2e/utils/req';
+import { test } from '@e2e/utils/test';
+import { expect } from '@playwright/test';
+
+import { deleteAllConsumers, putConsumerReq } from '@/apis/consumers';
+
+const username = randomId('reg_del_redirect').replaceAll('-', '_');
+
+test.beforeAll(async () => {
+ await deleteAllConsumers(e2eReq);
+ await putConsumerReq(e2eReq, { username });
+});
+
+test.afterAll(async () => {
+ await deleteAllConsumers(e2eReq);
+});
+
+test('deleting a consumer redirects to the consumers list', async ({
+ page,
+}) => {
+ await consumersPom.toIndex(page);
+ await consumersPom.isIndexPage(page);
+
+ await page
+ .getByRole('row', { name: username })
+ .getByRole('button', { name: 'View' })
+ .click();
+ await consumersPom.isDetailPage(page);
+
+ await page.getByRole('button', { name: 'Delete' }).click();
+ await page
+ .getByRole('dialog')
+ .getByRole('button', { name: 'Delete' })
+ .click();
+
+ // must land on the consumers list, not /consumer_groups
+ await consumersPom.isIndexPage(page);
+ await expect(page).toHaveURL(/\/consumers(\?|$)/);
+ await expect(page.getByRole('row', { name: username })).toBeHidden();
+});
diff --git a/src/routes/consumers/detail.$username/index.tsx
b/src/routes/consumers/detail.$username/index.tsx
index 1f083eaa1..b0ae4bea7 100644
--- a/src/routes/consumers/detail.$username/index.tsx
+++ b/src/routes/consumers/detail.$username/index.tsx
@@ -135,7 +135,7 @@ const ConsumerDetailTab = () => {
name={t('consumers.singular')}
target={username}
api={`${API_CONSUMERS}/${username}`}
- onSuccess={() => navigate({ to: '/consumer_groups' })}
+ onSuccess={() => navigate({ to: '/consumers' })}
/>
</Group>
),