Browse Source

fix: Wired in import click and close dropdown when clicked on import (view info dropdown)

pull/6888/head
Muhammed Mustafa 1 year ago
parent
commit
b94f314b9b
  1. 29
      packages/nc-gui/components/smartsheet/toolbar/OpenedViewAction.vue

29
packages/nc-gui/components/smartsheet/toolbar/OpenedViewAction.vue

@ -22,6 +22,8 @@ const { $api, $e } = useNuxtApp()
const isDropdownOpen = ref(false) const isDropdownOpen = ref(false)
const currentBaseId = computed(() => activeTable.value?.source_id)
const isPublicView = inject(IsPublicInj, ref(false)) const isPublicView = inject(IsPublicInj, ref(false))
const isLocked = inject(IsLockedInj, ref(false)) const isLocked = inject(IsLockedInj, ref(false))
@ -117,6 +119,13 @@ function onDuplicate() {
} }
} }
const onImportClick = (dialog: any) => {
if (isLocked.value) return
isDropdownOpen.value = false
dialog.value = true
}
watch(isDropdownOpen, () => { watch(isDropdownOpen, () => {
setTimeout(() => { setTimeout(() => {
isViewIdCopied.value = false isViewIdCopied.value = false
@ -185,13 +194,8 @@ watch(isDropdownOpen, () => {
<div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">Upload Data</div> <div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">Upload Data</div>
<template v-for="(dialog, type) in quickImportDialogs"> <template v-for="(dialog, type) in quickImportDialogs">
<NcMenuItem v-if="isUIAllowed(`${type}TableImport`) && !isPublicView" :key="type"> <NcMenuItem v-if="isUIAllowed(`${type}TableImport`) && !isPublicView" :key="type" @click="onImportClick(dialog)">
<div <div v-e="[`a:upload:${type}`]" class="nc-base-menu-item" :class="{ disabled: isLocked }">
v-e="[`a:upload:${type}`]"
class="nc-base-menu-item"
:class="{ disabled: isLocked }"
@click="!isLocked ? (dialog.value = true) : {}"
>
<component :is="iconMap.upload" /> <component :is="iconMap.upload" />
{{ `${$t('general.upload')} ${type.toUpperCase()}` }} {{ `${$t('general.upload')} ${type.toUpperCase()}` }}
</div> </div>
@ -247,6 +251,17 @@ watch(isDropdownOpen, () => {
</NcMenu> </NcMenu>
</template> </template>
</NcDropdown> </NcDropdown>
<template v-if="currentBaseId">
<LazyDlgQuickImport
v-for="tp in quickImportDialogTypes"
:key="tp"
v-model="quickImportDialogs[tp].value"
:import-type="tp"
:source-id="currentBaseId"
:import-data-only="true"
/>
</template>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

Loading…
Cancel
Save