|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import type { Ref } from '@vue/reactivity' |
|
|
|
|
import { |
|
|
|
|
ActiveViewInj, |
|
|
|
|
IsLockedInj, |
|
|
|
@ -41,11 +42,19 @@ const showApiSnippetDrawer = ref(false)
|
|
|
|
|
|
|
|
|
|
const showErd = ref(false) |
|
|
|
|
|
|
|
|
|
const quickImportDialog = ref(false) |
|
|
|
|
type QuickImportDialogType = 'csv' | 'excel' | 'json' |
|
|
|
|
const quickImportDialogTypes: QuickImportDialogType[] = ['csv', 'excel', 'json'] |
|
|
|
|
const quickImportDialogs: Record<typeof quickImportDialogTypes[number], Ref<boolean>> = quickImportDialogTypes.reduce( |
|
|
|
|
(acc: any, curr) => { |
|
|
|
|
acc[curr] = ref(false) |
|
|
|
|
return acc |
|
|
|
|
}, |
|
|
|
|
{}, |
|
|
|
|
) as Record<QuickImportDialogType, Ref<boolean>> |
|
|
|
|
|
|
|
|
|
const { isUIAllowed } = useUIPermission() |
|
|
|
|
|
|
|
|
|
const { isSharedBase } = useProject() |
|
|
|
|
const { bases, isSharedBase } = useProject() |
|
|
|
|
|
|
|
|
|
const Icon = computed(() => { |
|
|
|
|
switch (selectedView.value?.lock_type) { |
|
|
|
@ -173,19 +182,20 @@ useMenuCloseOnEsc(open)
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<template #expandIcon></template> |
|
|
|
|
<a-menu-item v-if="isUIAllowed('csvImport') && !isView && !isPublicView"> |
|
|
|
|
<template v-for="(dialog, type) in quickImportDialogs"> |
|
|
|
|
<a-menu-item v-if="isUIAllowed(`${type}Import`) && !isView && !isPublicView" :key="type"> |
|
|
|
|
<div |
|
|
|
|
v-e="['a:actions:upload-csv']" |
|
|
|
|
v-e="[`a:actions:upload-${type}`]" |
|
|
|
|
class="nc-project-menu-item" |
|
|
|
|
:class="{ disabled: isLocked }" |
|
|
|
|
@click="!isLocked ? (quickImportDialog = true) : {}" |
|
|
|
|
@click="!isLocked ? (dialog.value = true) : {}" |
|
|
|
|
> |
|
|
|
|
<MdiUploadOutline class="text-gray-500" /> |
|
|
|
|
<!-- Upload CSV --> |
|
|
|
|
{{ $t('activity.uploadCSV') }} |
|
|
|
|
{{ `${$t('general.upload')} ${type.toUpperCase()}` }} |
|
|
|
|
<div class="flex items-center text-gray-400"><MdiAlpha />version</div> |
|
|
|
|
</div> |
|
|
|
|
</a-menu-item> |
|
|
|
|
</template> |
|
|
|
|
</a-sub-menu> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -230,7 +240,14 @@ useMenuCloseOnEsc(open)
|
|
|
|
|
</template> |
|
|
|
|
</a-dropdown> |
|
|
|
|
|
|
|
|
|
<LazyDlgQuickImport v-if="quickImportDialog" v-model="quickImportDialog" import-type="csv" :import-data-only="true" /> |
|
|
|
|
<LazyDlgQuickImport |
|
|
|
|
v-for="type in quickImportDialogTypes" |
|
|
|
|
:key="type" |
|
|
|
|
v-model="quickImportDialogs[type].value" |
|
|
|
|
:import-type="type" |
|
|
|
|
:base-id="bases[0].id" |
|
|
|
|
:import-data-only="true" |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<LazyWebhookDrawer v-if="showWebhookDrawer" v-model="showWebhookDrawer" /> |
|
|
|
|
|
|
|
|
|