You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "Baluduvamsi2006 (via GitHub)" <gi...@apache.org> on 2026/03/01 20:54:44 UTC
[PR] Feat/add global spotlight menu [apisix-dashboard]
Baluduvamsi2006 opened a new pull request, #3313:
URL: https://github.com/apache/apisix-dashboard/pull/3313
# Why submit this pull request?
- [ ] Bugfix
- [x] New feature provided
- [ ] Improve performance
- [ ] Backport patches
---
# What changes will this PR take into?
This PR introduces a global command palette (Ctrl + K / Cmd + K) that enables fast, keyboard-driven navigation across dashboard resources such as Routes, Upstreams, Consumers, and Plugins.
The goal is to reduce navigation friction in large deployments where manually browsing paginated lists becomes inefficient.
---
# Detailed Implementation
## ✨ Feature: Global Command Palette (Spotlight)
<img width="1919" height="1012" alt="image" src="https://github.com/user-attachments/assets/798dd06c-dd26-45d3-8e31-d5fb0dbb4df1" />
- Integrated Mantine’s native `@mantine/spotlight` module to provide a polished, accessible command palette experience.
- Added a global keyboard shortcut:
- `Ctrl + K` (Windows/Linux)
- `Cmd + K` (macOS)
- Trigger opens a modal overlay that dims the background and focuses user input for immediate interaction.
## 🔍 Resource Search & Navigation
- Implements fuzzy search across core dashboard resources:
- Routes
- Upstreams
- Consumers
- Plugins
- Selecting a result performs an immediate navigation to the corresponding resource detail or list view.
- Eliminates the need to manually traverse side menus and paginated tables for commonly accessed resources.
## 🧩 Architecture & Integration
- Spotlight provider is mounted at the application root to ensure global availability.
- Action definitions are generated dynamically from existing route and resource metadata to avoid duplication.
- Fully leverages Mantine’s built-in spotlight lifecycle, accessibility, and keyboard handling without introducing custom modal logic.
## 🎯 UX Considerations
- Designed for power users managing large API gateway configurations.
- Keyboard-first interaction improves efficiency while remaining optional for mouse-based users.
- Visual styling aligns with existing dashboard theming to ensure a consistent look and feel.
---
This feature is fully self-contained, does not affect existing navigation behavior, and introduces no breaking changes.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feat/add global spotlight menu [apisix-dashboard]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3313:
URL: https://github.com/apache/apisix-dashboard/pull/3313#discussion_r2872323967
##########
src/components/GlobalSpotlight.tsx:
##########
@@ -0,0 +1,66 @@
+/**
+ * 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.
+ */
+import { ActionIcon } from '@mantine/core';
+import { Spotlight, spotlight } from '@mantine/spotlight';
+import { useNavigate } from '@tanstack/react-router';
+import { useTranslation } from 'react-i18next';
+
+import { navRoutes } from '@/config/navRoutes';
+import IconClose from '~icons/material-symbols/close';
+import IconDashboard from '~icons/material-symbols/dashboard-outline';
+import IconSearch from '~icons/material-symbols/search';
+
+export const GlobalSpotlight = () => {
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+
+ const actions = navRoutes.map((route) => ({
+ id: route.to,
+ label: t(`sources.${route.label}`),
+ description: `Jump to ${t(`sources.${route.label}`)} dashboard`,
Review Comment:
`description` is hard-coded English and concatenates translated fragments. This breaks localization for non-English users; consider moving the full description string into i18n (with interpolation for the resource name) instead of building it with a template literal.
```suggestion
description: t('spotlight.jumpToDashboard', { resource: t(`sources.${route.label}`) }),
```
##########
src/components/GlobalSpotlight.tsx:
##########
@@ -0,0 +1,66 @@
+/**
+ * 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.
+ */
+import { ActionIcon } from '@mantine/core';
+import { Spotlight, spotlight } from '@mantine/spotlight';
+import { useNavigate } from '@tanstack/react-router';
+import { useTranslation } from 'react-i18next';
+
+import { navRoutes } from '@/config/navRoutes';
+import IconClose from '~icons/material-symbols/close';
+import IconDashboard from '~icons/material-symbols/dashboard-outline';
+import IconSearch from '~icons/material-symbols/search';
+
+export const GlobalSpotlight = () => {
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+
+ const actions = navRoutes.map((route) => ({
+ id: route.to,
+ label: t(`sources.${route.label}`),
+ description: `Jump to ${t(`sources.${route.label}`)} dashboard`,
+ leftSection: <IconDashboard style={{ width: 18, height: 18, opacity: 0.7 }} />,
+ onClick: () => {
+ navigate({ to: route.to });
+ },
+ }));
+
+ return (
+ <Spotlight
+ actions={actions}
+ nothingFound={t('noData')}
+ highlightQuery
+ scrollAreaProps={{ type: 'always', offsetScrollbars: true, mah: 400 }}
+ searchProps={{
+ leftSection: <IconSearch style={{ width: 22, height: 22 }} />,
+ placeholder: 'Search resources... (Ctrl + K)',
+ rightSectionPointerEvents: 'all',
Review Comment:
The search input placeholder is hard-coded English and advertises only "Ctrl + K" even though the shortcut is typically platform-dependent (Cmd on macOS). This should be localized and either display a neutral "Mod + K" label or render the correct key combo per platform.
##########
pnpm-lock.yaml:
##########
@@ -1042,11 +1045,24 @@ packages:
react: ^18.x || ^19.x
react-dom: ^18.x || ^19.x
+ '@mantine/spotlight@8.3.15':
+ resolution: {integrity: sha512-zKssw/6eBmkY+1sGAgD8Vpy7dU5MXcY/cpvfr65SfIknRljKM9D4Z9TflzgIpxEdhvozls06MPcxj/pZkGpELQ==}
+ peerDependencies:
+ '@mantine/core': 8.3.15
+ '@mantine/hooks': 8.3.15
Review Comment:
`@mantine/spotlight@8.3.15` declares peer dependencies on `@mantine/core`/`@mantine/hooks` 8.3.15, but this lockfile resolves those peers to 8.3.12. This peer mismatch can cause subtle runtime/styling issues; align Mantine package versions and regenerate `pnpm-lock.yaml`.
```suggestion
'@mantine/spotlight@8.3.12':
resolution: {integrity: sha512-zKssw/6eBmkY+1sGAgD8Vpy7dU5MXcY/cpvfr65SfIknRljKM9D4Z9TflzgIpxEdhvozls06MPcxj/pZkGpELQ==}
peerDependencies:
'@mantine/core': 8.3.12
'@mantine/hooks': 8.3.12
```
##########
src/routes/__root.tsx:
##########
@@ -55,6 +56,7 @@ const Root = () => {
<TanStackRouterDevtools />
<ReactQueryDevtools initialIsOpen={false} />
<SettingsModal />
+ <GlobalSpotlight />
</I18nextProvider>
Review Comment:
The new global Spotlight feature is user-facing but has no automated coverage. Given the existing Playwright e2e suite, add a test that triggers the palette via the keyboard shortcut and verifies selecting an action navigates to the expected page.
##########
package.json:
##########
@@ -20,6 +20,7 @@
"@mantine/hooks": "^8.0.0",
"@mantine/modals": "^8.0.0",
"@mantine/notifications": "^8.0.0",
+ "@mantine/spotlight": "^8.3.15",
"@monaco-editor/react": "^4.7.0",
Review Comment:
`@mantine/spotlight` is pinned to 8.3.15, but the repo is currently locked to `@mantine/core`/`@mantine/hooks` 8.3.12 (see pnpm-lock peer deps). Please align Mantine package versions (core/hooks/spotlight/store) to the same patch version to avoid peer-dependency mismatches and potential runtime issues.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org