diff --git a/packages/nc-gui/components/cmd-k/index.vue b/packages/nc-gui/components/cmd-k/index.vue index bc7cb48241..e4584ecd8a 100644 --- a/packages/nc-gui/components/cmd-k/index.vue +++ b/packages/nc-gui/components/cmd-k/index.vue @@ -166,6 +166,8 @@ const actionListGroupedBySection = computed(() => { const keys = useMagicKeys() +const shiftModifier = keys.shift + const setAction = (action: string) => { selected.value = action nextTick(() => { @@ -294,7 +296,7 @@ whenever(keys.Enter, () => { const selectedEl = formattedData.value.find((el) => el.id === selected.value) cmdInput.value = '' if (selectedEl) { - fireAction(selectedEl, keys.shift.value) + fireAction(selectedEl, shiftModifier.value) } } }) diff --git a/packages/nc-gui/composables/useCommandPalette/index.ts b/packages/nc-gui/composables/useCommandPalette/index.ts index ce71cf6fea..cda3144f86 100644 --- a/packages/nc-gui/composables/useCommandPalette/index.ts +++ b/packages/nc-gui/composables/useCommandPalette/index.ts @@ -34,6 +34,8 @@ export const useCommandPalette = createSharedComposable(() => { const { token, user, signOut } = useGlobal() + const { workspacesList } = storeToRefs(useWorkspace()) + const commands = ref({ homeCommands, baseCommands: [], @@ -61,7 +63,25 @@ export const useCommandPalette = createSharedComposable(() => { staticCmd.push(...commands.value.baseCommands) - return staticCmd + return (workspacesList.value || []) + .map((workspace: { id: string; title: string; meta?: { color: string } }) => ({ + id: `ws-nav-${workspace.id}`, + title: workspace.title, + icon: 'workspace', + iconColor: workspace.meta?.color, + section: 'Workspaces', + scopePayload: { + scope: `ws-${workspace.id}`, + data: { + workspace_id: workspace.id, + }, + }, + handler: processHandler({ + type: 'navigate', + payload: `/${workspace.id}/settings`, + }), + })) + .concat(staticCmd) }) const dynamicData = ref([]) @@ -74,7 +94,7 @@ export const useCommandPalette = createSharedComposable(() => { if (cmdLoading.value) { return [{ id: 'loading', title: 'Loading...' }, ...staticData.value] } else { - return [...dynamicData.value, ...staticData.value] + return [...dynamicData.value, ...tempData.value, ...staticData.value] } })