From b29bca02dc0ac86586271a77c914417eeeebd23f Mon Sep 17 00:00:00 2001 From: Kent Dong Date: Thu, 16 Jan 2025 15:40:58 +0800 Subject: [PATCH] fix: Hide AI routes in the route list (#407) --- frontend/src/pages/route/index.tsx | 4 ++++ frontend/src/switches.ts | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 frontend/src/switches.ts diff --git a/frontend/src/pages/route/index.tsx b/frontend/src/pages/route/index.tsx index 15f9b2d5..69fdf24e 100644 --- a/frontend/src/pages/route/index.tsx +++ b/frontend/src/pages/route/index.tsx @@ -8,6 +8,7 @@ import { } from '@/interfaces/route'; import { addGatewayRoute, deleteGatewayRoute, getGatewayRoutes, updateGatewayRoute } from '@/services'; import store from '@/store'; +import switches from '@/switches'; import { isInternalResource } from '@/utils'; import { ExclamationCircleOutlined, RedoOutlined } from '@ant-design/icons'; import { PageContainer } from '@ant-design/pro-layout'; @@ -121,6 +122,9 @@ const RouteList: React.FC = () => { i.key || (i.key = i.id ? `${i.id}` : i.name); i.internal = isInternalResource(i.name); }); + if (!switches.SHOW_INTERNAL_ROUTES) { + result = result.filter(r => !r.internal); + } result.sort((i1, i2) => { if (i1.internal !== i2.internal) { return i1.internal ? 1 : -1 diff --git a/frontend/src/switches.ts b/frontend/src/switches.ts new file mode 100644 index 00000000..3c45f6f8 --- /dev/null +++ b/frontend/src/switches.ts @@ -0,0 +1,3 @@ +export default { + SHOW_INTERNAL_ROUTES: false, +}; \ No newline at end of file