Browse Source

fix: Added event to Project node

pull/6539/head
Muhammed Mustafa 1 year ago
parent
commit
bf3fd5df42
  1. 33
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  2. 4
      packages/nc-gui/components/dashboard/TreeView/index.vue

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

@ -163,8 +163,6 @@ const setIcon = async (icon: string, project: ProjectType) => {
} }
function openTableCreateDialog(baseIndex?: number | undefined) { function openTableCreateDialog(baseIndex?: number | undefined) {
$e('c:table:create:navdraw')
const isOpen = ref(true) const isOpen = ref(true)
let baseId = project.value!.bases?.[0].id let baseId = project.value!.bases?.[0].id
if (typeof baseIndex === 'number') { if (typeof baseIndex === 'number') {
@ -234,6 +232,8 @@ const onProjectClick = async (project: NcProject, ignoreNavigation?: boolean, to
return return
} }
if (!toggleIsExpanded) $e('c:base:open')
ignoreNavigation = isMobileMode.value || ignoreNavigation ignoreNavigation = isMobileMode.value || ignoreNavigation
toggleIsExpanded = isMobileMode.value || toggleIsExpanded toggleIsExpanded = isMobileMode.value || toggleIsExpanded
@ -376,6 +376,16 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
) )
$e('a:project:duplicate') $e('a:project:duplicate')
} }
const tableDelete = () => {
isTableDeleteDialogVisible.value = true
$e('c:table:delete')
}
const projectDelete = () => {
isProjectDeleteDialogVisible.value = true
$e('c:project:delete')
}
</script> </script>
<template> <template>
@ -410,7 +420,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
/> />
</NcButton> </NcButton>
<div v-e="['c:base:open']" class="flex items-center mr-1" @click="onProjectClick(project)"> <div class="flex items-center mr-1" @click="onProjectClick(project)">
<div class="flex items-center select-none w-6 h-full"> <div class="flex items-center select-none w-6 h-full">
<a-spin <a-spin
v-if="project.isLoading" v-if="project.isLoading"
@ -530,7 +540,12 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
key="api" key="api"
v-e="['c:base:api-docs']" v-e="['c:base:api-docs']"
data-testid="nc-sidebar-project-rest-apis" data-testid="nc-sidebar-project-rest-apis"
@click.stop="openLink(`/api/v1/db/meta/projects/${project.id}/swagger`, appInfo.ncSiteUrl)" @click.stop="
() => {
$e('c:base:api-docs')
openLink(`/api/v1/db/meta/projects/${project.id}/swagger`, appInfo.ncSiteUrl)
}
"
> >
<GeneralIcon icon="snippet" class="group-hover:text-black !max-w-3.9" /> <GeneralIcon icon="snippet" class="group-hover:text-black !max-w-3.9" />
{{ $t('activity.account.swagger') }} {{ $t('activity.account.swagger') }}
@ -557,10 +572,9 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
</NcMenuItem> </NcMenuItem>
<NcMenuItem <NcMenuItem
v-if="isUIAllowed('projectDelete', { roles: [stringifyRolesObj(orgRoles), projectRole].join() })" v-if="isUIAllowed('projectDelete', { roles: [stringifyRolesObj(orgRoles), projectRole].join() })"
v-e="['c:base:delete']"
data-testid="nc-sidebar-project-delete" data-testid="nc-sidebar-project-delete"
class="!text-red-500 !hover:bg-red-50" class="!text-red-500 !hover:bg-red-50"
@click="isProjectDeleteDialogVisible = true" @click="projectDelete"
> >
<GeneralIcon icon="delete" class="w-4" /> <GeneralIcon icon="delete" class="w-4" />
{{ $t('general.delete') }} {{ $t('general.delete') }}
@ -746,12 +760,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
</div> </div>
</NcMenuItem> </NcMenuItem>
<NcDivider /> <NcDivider />
<NcMenuItem <NcMenuItem v-if="isUIAllowed('table-delete')" class="!hover:bg-red-50" @click="tableDelete">
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"> <div class="nc-project-option-item text-red-600">
<GeneralIcon icon="delete" /> <GeneralIcon icon="delete" />
{{ $t('general.delete') }} {{ $t('general.delete') }}

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

@ -71,7 +71,7 @@ const setMenuContext = (type: 'project' | 'base' | 'table' | 'main' | 'layout',
function openRenameTableDialog(table: TableType, rightClick = false) { function openRenameTableDialog(table: TableType, rightClick = false) {
if (!table || !table.base_id) return if (!table || !table.base_id) return
$e(rightClick ? 'c:table:rename:navdraw:right-click' : 'c:table:rename:navdraw:options') $e('c:table:rename')
const isOpen = ref(true) const isOpen = ref(true)
@ -115,6 +115,8 @@ const duplicateTable = async (table: TableType) => {
const isOpen = ref(true) const isOpen = ref(true)
$e('c:table:duplicate')
const { close } = useDialog(resolveComponent('DlgTableDuplicate'), { const { close } = useDialog(resolveComponent('DlgTableDuplicate'), {
'modelValue': isOpen, 'modelValue': isOpen,
'table': table, 'table': table,

Loading…
Cancel
Save