Browse Source

fix: Added Sidebar project and base node events

pull/6539/head
Muhammed Mustafa 1 year ago
parent
commit
cd51c38a1d
  1. 4
      packages/nc-gui/components/dashboard/TreeView/BaseOptions.vue
  2. 40
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

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

@ -70,6 +70,7 @@ function openQuickImportDialog(type: string) {
<NcMenuItem
v-if="isUIAllowed('airtableImport', { roles: projectRole })"
key="quick-import-airtable"
v-e="['c:import:airtable']"
@click="openAirtableImportDialog(base.id)"
>
<GeneralIcon icon="airtable" class="max-w-3.75 group-hover:text-black" />
@ -79,6 +80,7 @@ function openQuickImportDialog(type: string) {
<NcMenuItem
v-if="isUIAllowed('csvImport', { roles: projectRole })"
key="quick-import-csv"
v-e="['c:import:csv']"
@click="openQuickImportDialog('csv')"
>
<GeneralIcon icon="csv" class="w-4 group-hover:text-black" />
@ -88,6 +90,7 @@ function openQuickImportDialog(type: string) {
<NcMenuItem
v-if="isUIAllowed('jsonImport', { roles: projectRole })"
key="quick-import-json"
v-e="['c:import:json']"
@click="openQuickImportDialog('json')"
>
<GeneralIcon icon="code" class="w-4 group-hover:text-black" />
@ -97,6 +100,7 @@ function openQuickImportDialog(type: string) {
<NcMenuItem
v-if="isUIAllowed('excelImport', { roles: projectRole })"
key="quick-import-excel"
v-e="['c:import:excel']"
@click="openQuickImportDialog('excel')"
>
<GeneralIcon icon="excel" class="max-w-4 group-hover:text-black" />

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

@ -397,6 +397,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
class="nc-sidebar-node project-title-node h-7.25 flex-grow rounded-md group flex items-center w-full pr-1"
>
<NcButton
v-e="['c:base:expand']"
type="text"
size="xxsmall"
class="nc-sidebar-node-btn nc-sidebar-expand ml-0.75 !xs:visible"
@ -420,6 +421,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<LazyGeneralEmojiPicker
v-else
:key="project.meta?.icon"
v-e="['c:base:emojiSelect']"
:emoji="project.meta?.icon"
:readonly="true"
size="small"
@ -456,6 +458,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<NcDropdown v-model:visible="isOptionsOpen" :trigger="['click']">
<NcButton
v-e="['c:base:options']"
class="nc-sidebar-node-btn"
:class="{ '!text-black !opacity-100': isOptionsOpen }"
data-testid="nc-sidebar-context-menu"
@ -476,13 +479,19 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
@click="isOptionsOpen = false"
>
<template v-if="!isSharedBase">
<NcMenuItem v-if="isUIAllowed('projectRename')" data-testid="nc-sidebar-project-rename" @click="enableEditMode">
<NcMenuItem
v-if="isUIAllowed('projectRename')"
v-e="['c:base:rename']"
data-testid="nc-sidebar-project-rename"
@click="enableEditMode"
>
<GeneralIcon icon="edit" class="group-hover:text-black" />
{{ $t('general.rename') }}
</NcMenuItem>
<NcMenuItem
v-if="isUIAllowed('projectDuplicate', { roles: [stringifyRolesObj(orgRoles), projectRole].join() })"
v-e="['c:base:duplicate']"
data-testid="nc-sidebar-project-duplicate"
@click="duplicateProject(project)"
>
@ -496,7 +505,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<NcMenuItem
v-if="!isEeUI"
key="copy"
v-e="['c:navbar:user:copy-proj-info']"
v-e="['c:base:copy-proj-info']"
data-testid="nc-sidebar-project-copy-project-info"
@click.stop="copyProjectInfo"
>
@ -505,7 +514,12 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
</NcMenuItem>
<!-- ERD View -->
<NcMenuItem key="erd" data-testid="nc-sidebar-project-relations" @click="openProjectErdView(project)">
<NcMenuItem
key="erd"
v-e="['c:base:erd']"
data-testid="nc-sidebar-project-relations"
@click="openProjectErdView(project)"
>
<GeneralIcon icon="erd" />
{{ $t('title.relations') }}
</NcMenuItem>
@ -514,7 +528,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<NcMenuItem
v-if="isUIAllowed('apiDocs')"
key="api"
v-e="['e:api-docs']"
v-e="['c:base:api-docs']"
data-testid="nc-sidebar-project-rest-apis"
@click.stop="openLink(`/api/v1/db/meta/projects/${project.id}/swagger`, appInfo.ncSiteUrl)"
>
@ -533,7 +547,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<NcMenuItem
v-if="isUIAllowed('projectMiscSettings')"
key="teamAndSettings"
v-e="['c:navdraw:project-settings']"
v-e="['c:base:settings']"
data-testid="nc-sidebar-project-settings"
class="nc-sidebar-project-project-settings"
@click="toggleDialog(true, 'teamAndAuth', undefined, project.id)"
@ -543,6 +557,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
</NcMenuItem>
<NcMenuItem
v-if="isUIAllowed('projectDelete', { roles: [stringifyRolesObj(orgRoles), projectRole].join() })"
v-e="['c:base:delete']"
data-testid="nc-sidebar-project-delete"
class="!text-red-500 !hover:bg-red-50"
@click="isProjectDeleteDialogVisible = true"
@ -556,6 +571,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<NcButton
v-if="isUIAllowed('tableCreate', { roles: projectRole })"
v-e="['c:base:create-table']"
class="nc-sidebar-node-btn"
size="xxsmall"
type="text"
@ -590,6 +606,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<a-collapse
v-else-if="base && base.enabled"
v-model:activeKey="activeKey"
v-e="['c:source:toggle-expand']"
class="!mx-0 !px-0 nc-sidebar-base-node"
:class="[{ hidden: searchActive && !!filterQuery }]"
expand-icon-position="left"
@ -645,6 +662,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
@update:visible="isBasesOptionsOpen[base!.id!] = $event"
>
<NcButton
v-e="['c:source:options']"
class="nc-sidebar-node-btn"
:class="{ '!text-black !opacity-100': isBasesOptionsOpen[base!.id!] }"
type="text"
@ -663,7 +681,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
@click="isBasesOptionsOpen[base!.id!] = false"
>
<!-- ERD View -->
<NcMenuItem key="erd" @click="openErdView(base)">
<NcMenuItem key="erd" v-e="['c:source:erd']" @click="openErdView(base)">
<GeneralIcon icon="erd" />
{{ $t('title.relations') }}
</NcMenuItem>
@ -675,6 +693,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<NcButton
v-if="isUIAllowed('tableCreate', { roles: projectRole })"
v-e="['c:source:add-table']"
type="text"
size="xxsmall"
class="nc-sidebar-node-btn"
@ -708,6 +727,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<template v-else-if="contextMenuTarget.type === 'base'"></template>
<template v-else-if="contextMenuTarget.type === 'table'">
v-e="['c:table:rename']"
<NcMenuItem v-if="isUIAllowed('tableRename')" @click="openRenameTableDialog(contextMenuTarget.value, true)">
<div class="nc-project-option-item">
<GeneralIcon icon="edit" class="text-gray-700" />
@ -717,6 +737,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<NcMenuItem
v-if="isUIAllowed('tableDuplicate') && (contextMenuBase?.is_meta || contextMenuBase?.is_local)"
v-e="['c:table:duplicate']"
@click="duplicateTable(contextMenuTarget.value)"
>
<div class="nc-project-option-item">
@ -725,7 +746,12 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
</div>
</NcMenuItem>
<NcDivider />
<NcMenuItem v-if="isUIAllowed('table-delete')" class="!hover:bg-red-50" @click="isTableDeleteDialogVisible = true">
<NcMenuItem
v-if="isUIAllowed('table-delete')"
v-e="['c:table:delete']"
class="!hover:bg-red-50"
@click="isTableDeleteDialogVisible = true"
>
<div class="nc-project-option-item text-red-600">
<GeneralIcon icon="delete" />
{{ $t('general.delete') }}

Loading…
Cancel
Save