Browse Source

Merge pull request #7573 from nocodb/nc-fix/shared-base-breadcrumb

Nc - fix: shared base breadcrumb links and view options access issue
pull/7593/head
Raju Udava 10 months ago committed by GitHub
parent
commit
14521a1f73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue
  2. 7
      packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue
  3. 3
      packages/nc-gui/components/smartsheet/toolbar/ViewInfo.vue
  4. 25
      packages/nc-gui/store/tables.ts

2
packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue

@ -256,7 +256,7 @@ watch(isDropdownOpen, async () => {
</NcTooltip> </NcTooltip>
<div class="flex-1" /> <div class="flex-1" />
<template v-if="!isEditing && !isLocked && isUIAllowed('viewCreateOrEdit')"> <template v-if="!isEditing && !isLocked">
<NcDropdown v-model:visible="isDropdownOpen" overlay-class-name="!rounded-lg"> <NcDropdown v-model:visible="isDropdownOpen" overlay-class-name="!rounded-lg">
<NcButton <NcButton
v-e="['c:view:option']" v-e="['c:view:option']"

7
packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue

@ -161,8 +161,9 @@ const onDelete = async () => {
</NcButton> </NcButton>
</div> </div>
</NcTooltip> </NcTooltip>
<NcDivider />
<template v-if="!view?.is_default"> <template v-if="!view?.is_default && isUIAllowed('viewCreateOrEdit')">
<NcDivider />
<NcMenuItem v-if="lockType !== LockType.Locked" @click="onRenameMenuClick"> <NcMenuItem v-if="lockType !== LockType.Locked" @click="onRenameMenuClick">
<GeneralIcon icon="rename" /> <GeneralIcon icon="rename" />
{{ $t('activity.renameView') }} {{ $t('activity.renameView') }}
@ -283,7 +284,7 @@ const onDelete = async () => {
</NcSubMenu> </NcSubMenu>
</template> </template>
<template v-if="!view.is_default"> <template v-if="!view.is_default && isUIAllowed('viewCreateOrEdit')">
<NcDivider /> <NcDivider />
<NcTooltip v-if="lockType === LockType.Locked"> <NcTooltip v-if="lockType === LockType.Locked">
<template #title> {{ $t('msg.info.disabledAsViewLocked') }} </template> <template #title> {{ $t('msg.info.disabledAsViewLocked') }} </template>

3
packages/nc-gui/components/smartsheet/toolbar/ViewInfo.vue

@ -17,6 +17,7 @@ const openedBaseUrl = computed(() => {
return `${window.location.origin}/#${baseUrl({ return `${window.location.origin}/#${baseUrl({
id: base.value.id!, id: base.value.id!,
type: 'database', type: 'database',
isSharedBase: isSharedBase.value,
})}` })}`
}) })
</script> </script>
@ -112,7 +113,7 @@ const openedBaseUrl = computed(() => {
<NuxtLink <NuxtLink
v-else v-else
class="!text-inherit !underline-transparent !hover:(text-black underline-gray-600)" class="!text-inherit !underline-transparent !hover:(text-black underline-gray-600)"
:to="tableUrl({ table: activeTable, completeUrl: true })" :to="tableUrl({ table: activeTable, completeUrl: true, isSharedBase })"
> >
{{ activeTable?.title }} {{ activeTable?.title }}
</NuxtLink> </NuxtLink>

25
packages/nc-gui/store/tables.ts

@ -214,19 +214,28 @@ export const useTablesStore = defineStore('tablesStore', () => {
} }
} }
const tableUrl = ({ table, completeUrl }: { table: TableType; completeUrl: boolean }) => { const tableUrl = ({ table, completeUrl, isSharedBase }: { table: TableType; completeUrl: boolean; isSharedBase?: boolean }) => {
const base = basesStore.bases.get(table.base_id!) let base
if (!base) return if (!isSharedBase) {
base = basesStore.bases.get(table.base_id!)
if (!base) return
}
const nuxtPageName = 'index-typeOrId-baseId-index-index-viewId-viewTitle' const nuxtPageName = 'index-typeOrId-baseId-index-index-viewId-viewTitle'
const url = router.resolve({ const url = router.resolve({
name: nuxtPageName, name: nuxtPageName,
params: { params: isSharedBase
typeOrId: workspaceStore.activeWorkspaceId, ? {
baseId: base.id, typeOrId: route.value.params.typeOrId,
viewId: table.id, baseId: route.value.params.baseId,
}, viewId: route.value.params.viewId,
}
: {
typeOrId: workspaceStore.activeWorkspaceId,
baseId: base?.id,
viewId: table.id,
},
}) })
if (completeUrl) return `${window.location.origin}/${url.href}` if (completeUrl) return `${window.location.origin}/${url.href}`

Loading…
Cancel
Save