Browse Source

fix: removed some of the command palette counterpart

pull/7490/head
Ramesh Mane 8 months ago
parent
commit
23c02cb62a
  1. 9
      packages/nc-gui/app.vue
  2. 6
      packages/nc-gui/components/cmd-l/index.vue
  3. 6
      packages/nocodb/src/services/command-palette.service.ts

9
packages/nc-gui/app.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { applyNonSelectable, computed, useCommandPalette, useRouter, useTheme } from '#imports'
import { applyNonSelectable, computed, useCommandPalette, useRouter, useTheme, isEeUI } from '#imports'
const router = useRouter()
@ -63,6 +63,12 @@ if (typeof window !== 'undefined') {
// @ts-expect-error using arbitrary window key
window.__ncvue = true
}
function onScope(scope: string) {
if (scope === 'root' && isEeUI) {
loadTemporaryScope({ scope: 'root', data: {} })
}
}
</script>
<template>
@ -79,6 +85,7 @@ if (typeof window !== 'undefined') {
:data="cmdData"
:placeholder="cmdPlaceholder"
:load-temporary-scope="loadTemporaryScope"
@scope="onScope"
/>
<!-- Recent Views. Cycles through recently visited Views -->
<CmdL v-model:open="cmdL" />

6
packages/nc-gui/components/cmd-l/index.vue

@ -183,7 +183,7 @@ onMounted(() => {
document.querySelector('.cmdOpt-list')?.focus()
if (!activeView.value) return
const index = recentViews.value.findIndex(
(v) => v.viewName === activeView?.value.name && v.tableID === activeView?.value.tableId,
(v) => v.viewName === activeView.value?.name && v.tableID === activeView.value?.tableId,
)
if (index + 1 > recentViews.value.length) {
selected.value = recentViews.value[0].tableID + recentViews.value[0].viewName
@ -218,10 +218,10 @@ onMounted(() => {
<GeneralViewIcon :meta="{ type: cmdOption.viewType }" />
<a-tooltip overlay-class-name="!px-2 !py-1 !rounded-lg">
<template #title>
{{ cmdOption.viewName }}
{{ cmdOption.isDefault ? $t('title.defaultView') : cmdOption.viewName }}
</template>
<span class="max-w- truncate capitalize">
{{ cmdOption.viewName }}
{{ cmdOption.isDefault ? $t('title.defaultView') : cmdOption.viewName }}
</span>
</a-tooltip>
</div>

6
packages/nocodb/src/services/command-palette.service.ts

@ -20,11 +20,8 @@ export class CommandPaletteService {
try {
const { scope, data } = param.body;
console.log('param.user.id', param.user, scope, data);
if (scope === 'root') {
const bases = await Base.list({ user: param.user });
console.log('bases', bases);
for (const base of bases) {
cmdData.push({
@ -40,13 +37,10 @@ export class CommandPaletteService {
},
});
}
console.log('scope');
} else if (scope.startsWith('p-')) {
const allBases = [];
const bases = await Base.list({ user: param.user });
console.log('bases', bases);
allBases.push(...bases);

Loading…
Cancel
Save