Browse Source

fix: Added events for Sidebar table and view node and all the modals assosiated with it

pull/6539/head
Muhammed Mustafa 1 year ago
parent
commit
6f10bda94a
  1. 8
      packages/nc-gui/components/dashboard/TreeView/TableNode.vue
  2. 9
      packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue
  3. 1
      packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue
  4. 4
      packages/nc-gui/components/dlg/ProjectDuplicate.vue
  5. 1
      packages/nc-gui/components/dlg/TableCreate.vue
  6. 4
      packages/nc-gui/components/dlg/TableDuplicate.vue
  7. 6
      packages/nc-gui/components/dlg/ViewCreate.vue

8
packages/nc-gui/components/dashboard/TreeView/TableNode.vue

@ -161,6 +161,7 @@ const isTableOpened = computed(() => {
>
<template #title>{{ table.table_name }}</template>
<div
v-e="['c:table:open']"
class="table-context flex items-center gap-1 h-full"
:data-testid="`nc-tbl-side-node-${table.title}`"
@contextmenu="setMenuContext('table', table)"
@ -169,6 +170,7 @@ const isTableOpened = computed(() => {
<div class="flex flex-row h-full items-center">
<NcButton
v-if="(table.meta as any)?.hasNonDefaultViews"
v-e="['c:table:toggle-expand']"
type="text"
size="xxsmall"
class="nc-sidebar-node-btn nc-sidebar-expand"
@ -191,6 +193,7 @@ const isTableOpened = computed(() => {
>
<LazyGeneralEmojiPicker
:key="table.meta?.icon"
v-e="['c:table:emoji-picker']"
:emoji="table.meta?.icon"
size="small"
:readonly="!canUserEditEmote || isMobileMode"
@ -242,6 +245,7 @@ const isTableOpened = computed(() => {
!isSharedBase &&
(isUIAllowed('tableRename', { roles: projectRole }) || isUIAllowed('tableDelete', { roles: projectRole }))
"
v-e="['c:table:option']"
:trigger="['click']"
class="nc-sidebar-node-btn"
@click.stop
@ -255,6 +259,7 @@ const isTableOpened = computed(() => {
<NcMenu>
<NcMenuItem
v-if="isUIAllowed('tableRename', { roles: projectRole })"
v-e="['c:table:rename']"
:data-testid="`sidebar-table-rename-${table.title}`"
@click="openRenameTableDialog(table, project.bases[baseIndex].id)"
>
@ -268,6 +273,7 @@ const isTableOpened = computed(() => {
project.bases?.[baseIndex] &&
(project.bases[baseIndex].is_meta || project.bases[baseIndex].is_local)
"
v-e="['c:table:duplicate']"
:data-testid="`sidebar-table-duplicate-${table.title}`"
@click="duplicateTable(table)"
>
@ -277,6 +283,7 @@ const isTableOpened = computed(() => {
<NcMenuItem
v-if="isUIAllowed('tableDelete', { roles: projectRole })"
v-e="['c:table:delete']"
:data-testid="`sidebar-table-delete-${table.title}`"
class="!text-red-500 !hover:bg-red-50"
@click="isTableDeleteDialogVisible = true"
@ -289,6 +296,7 @@ const isTableOpened = computed(() => {
</NcDropdown>
<DashboardTreeViewCreateViewBtn v-if="isUIAllowed('viewCreateOrEdit')">
<NcButton
v-e="['c:view:create']"
type="text"
size="xxsmall"
class="nc-create-view-btn nc-sidebar-node-btn"

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

@ -193,6 +193,7 @@ function onStopEdit() {
<template>
<a-menu-item
v-e="['c:view:open']"
class="nc-sidebar-node !min-h-7 !max-h-7 !mb-0.25 select-none group text-gray-700 !flex !items-center !mt-0 hover:(!bg-gray-200 !text-gray-900) cursor-pointer"
:class="{
'!pl-18 !xs:(pl-19.75)': isDefaultBase,
@ -205,6 +206,7 @@ function onStopEdit() {
<div v-e="['a:view:open', { view: vModel.type }]" class="text-sm flex items-center w-full gap-1" data-testid="view-item">
<div class="flex min-w-6" :data-testid="`view-sidebar-drag-handle-${vModel.alias || vModel.title}`">
<LazyGeneralEmojiPicker
v-e="['c:view:emoji-picker']"
class="nc-table-icon"
:emoji="props.view?.meta?.icon"
size="small"
@ -247,6 +249,7 @@ function onStopEdit() {
<template v-if="!isEditing && !isLocked && isUIAllowed('viewCreateOrEdit')">
<NcDropdown v-model:visible="isDropdownOpen" overlay-class-name="!rounded-lg">
<NcButton
v-e="['c:view:option']"
type="text"
size="xxsmall"
class="nc-sidebar-node-btn invisible !group-hover:visible nc-sidebar-view-node-context-btn"
@ -260,11 +263,11 @@ function onStopEdit() {
<template #overlay>
<NcMenu class="min-w-27" :data-testid="`view-sidebar-view-actions-${vModel.alias || vModel.title}`">
<NcMenuItem @click.stop="onDblClick">
<NcMenuItem v-e="['c:view:rename']" @click.stop="onDblClick">
<GeneralIcon icon="edit" />
<div class="-ml-0.25">{{ $t('general.rename') }}</div>
</NcMenuItem>
<NcMenuItem @click.stop="onDuplicate">
<NcMenuItem v-e="['c:view:duplicate']" @click.stop="onDuplicate">
<GeneralIcon icon="duplicate" class="nc-view-copy-icon" />
{{ $t('general.duplicate') }}
</NcMenuItem>
@ -272,7 +275,7 @@ function onStopEdit() {
<NcDivider />
<template v-if="!vModel.is_default">
<NcMenuItem class="!text-red-500 !hover:bg-red-50" @click.stop="onDelete">
<NcMenuItem v-e="['c:view:delete']" class="!text-red-500 !hover:bg-red-50" @click.stop="onDelete">
<GeneralIcon icon="delete" class="text-sm nc-view-delete-icon" />
<div class="-ml-0.25">{{ $t('general.delete') }}</div>
</NcMenuItem>

1
packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue

@ -628,6 +628,7 @@ watch(
</NcButton>
<NcButton
v-e="['a:source:create']"
size="small"
type="primary"
:disabled="!testSuccess"

4
packages/nc-gui/components/dlg/ProjectDuplicate.vue

@ -95,7 +95,9 @@ const isEaster = ref(false)
</div>
<div class="flex flex-row gap-x-2 mt-2.5 pt-2.5 justify-end">
<NcButton key="back" type="secondary" @click="dialogShow = false">{{ $t('general.cancel') }}</NcButton>
<NcButton key="submit" :loading="isLoading" @click="_duplicate">{{ $t('general.confirm') }} </NcButton>
<NcButton key="submit" v-e="['a:base:duplicate']" :loading="isLoading" @click="_duplicate"
>{{ $t('general.confirm') }}
</NcButton>
</div>
</GeneralModal>
</template>

1
packages/nc-gui/components/dlg/TableCreate.vue

@ -184,6 +184,7 @@ onMounted(() => {
<NcButton type="secondary" @click="dialogShow = false">{{ $t('general.cancel') }}</NcButton>
<NcButton
v-e="['a:table:create']"
type="primary"
:disabled="validateInfos.title.validateStatus === 'error'"
:loading="creating"

4
packages/nc-gui/components/dlg/TableDuplicate.vue

@ -84,7 +84,9 @@ const isEaster = ref(false)
</div>
<div class="flex flex-row gap-x-2 mt-2.5 pt-2.5 justify-end">
<NcButton key="back" type="secondary" @click="dialogShow = false">{{ $t('general.cancel') }}</NcButton>
<NcButton key="submit" type="primary" :loading="isLoading" @click="_duplicate">{{ $t('general.confirm') }} </NcButton>
<NcButton key="submit" v-e="['a:table:duplicate']" type="primary" :loading="isLoading" @click="_duplicate"
>{{ $t('general.confirm') }}
</NcButton>
</div>
</GeneralModal>
</template>

6
packages/nc-gui/components/dlg/ViewCreate.vue

@ -306,7 +306,11 @@ onMounted(async () => {
{{ $t('general.cancel') }}
</NcButton>
<NcButton type="primary" :loading="isViewCreating" @click="onSubmit">
<NcButton v-if="form.copy_from_id" v-e="['a:view:duplicate']" type="primary" :loading="isViewCreating" @click="onSubmit">
{{ $t('labels.createView') }}
<template #loading> {{ $t('labels.creatingView') }}</template>
</NcButton>
<NcButton v-if="form.copy_from_id" v-e="['a:view:create']" type="primary" :loading="isViewCreating" @click="onSubmit">
{{ $t('labels.createView') }}
<template #loading> {{ $t('labels.creatingView') }}</template>
</NcButton>

Loading…
Cancel
Save