Browse Source

fix: pass source reference

pull/8708/head
Pranav C 2 weeks ago
parent
commit
cd735c9be3
  1. 6
      packages/nc-gui/components/dashboard/TreeView/BaseOptions.vue
  2. 10
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  3. 1
      packages/nc-gui/components/dashboard/TreeView/index.vue
  4. 4
      packages/nc-gui/components/project/AllTables.vue

6
packages/nc-gui/components/dashboard/TreeView/BaseOptions.vue

@ -80,7 +80,11 @@ function openQuickImportDialog(type: string) {
</div>
</NcMenuItem>
<NcMenuItem v-if="isUIAllowed('csvImport', { roles: baseRole })" key="quick-import-csv" @click="openQuickImportDialog('csv')">
<NcMenuItem
v-if="isUIAllowed('csvImport', { roles: baseRole, source })"
key="quick-import-csv"
@click="openQuickImportDialog('csv')"
>
<div v-e="['c:import:csv']" class="flex gap-2 items-center">
<GeneralIcon icon="csv" class="w-4 group-hover:text-black" />
{{ $t('labels.csvFile') }}

10
packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

@ -101,9 +101,7 @@ const baseViewOpen = computed(() => {
})
const showBaseOption = (source: SourceType) => {
return ['airtableImport', 'csvImport', 'jsonImport', 'excelImport'].some((permission) =>
isUIAllowed(permission, { source }),
)
return ['airtableImport', 'csvImport', 'jsonImport', 'excelImport'].some((permission) => isUIAllowed(permission, { source }))
}
const enableEditMode = () => {
@ -823,7 +821,11 @@ const getSource = (sourceId: string) => {
</div>
</NcMenuItem>
<DashboardTreeViewBaseOptions v-if="showBaseOption(source)" v-model:base="base" :source="source" />
<DashboardTreeViewBaseOptions
v-if="showBaseOption(source)"
v-model:base="base"
:source="source"
/>
</NcMenu>
</template>
</NcDropdown>

1
packages/nc-gui/components/dashboard/TreeView/index.vue

@ -100,6 +100,7 @@ const duplicateTable = async (table: TableType) => {
const isCreateTableAllowed = computed(
() =>
base.value?.sources?.[0] &&
isUIAllowed('tableCreate', { source: base.value?.sources?.[0] }) &&
route.value.name !== 'index' &&
route.value.name !== 'index-index' &&

4
packages/nc-gui/components/project/AllTables.vue

@ -76,7 +76,7 @@ function openTableCreateDialog(baseIndex?: number | undefined) {
}"
>
<div
v-if="isUIAllowed('tableCreate', { source: openedProject?.sources?.[0] })"
v-if="isUIAllowed('tableCreate', { source: base?.sources?.[0] })"
role="button"
class="nc-base-view-all-table-btn"
data-testid="proj-view-btn__add-new-table"
@ -86,7 +86,7 @@ function openTableCreateDialog(baseIndex?: number | undefined) {
<div class="label">{{ $t('general.new') }} {{ $t('objects.table') }}</div>
</div>
<div
v-if="isUIAllowed('tableCreate', { source: openedProject?.sources?.[0] })"
v-if="isUIAllowed('tableCreate', { source: base?.sources?.[0] })"
v-e="['c:table:import']"
role="button"
class="nc-base-view-all-table-btn"

Loading…
Cancel
Save