Browse Source

Merge pull request #6647 from nocodb/nc-fix/ui-wrn

fix: remove leftover code
pull/6648/head
mertmit 1 year ago committed by GitHub
parent
commit
f3dff71634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 51
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  2. 1
      packages/nc-gui/components/dlg/ProjectDuplicate.vue
  3. 1
      packages/nc-gui/components/dlg/SharedBaseDuplicate.vue
  4. 1
      packages/nc-gui/components/dlg/TableDuplicate.vue
  5. 2
      packages/nc-gui/components/nc/Pagination.vue
  6. 43
      packages/nc-gui/components/workspace/ProjectList.vue
  7. 6
      packages/nc-gui/store/config.ts

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

@ -57,7 +57,7 @@ const basesStore = useBases()
const { isMobileMode } = useGlobal() const { isMobileMode } = useGlobal()
const { loadProjects, createProject: _createProject, updateProject, getProjectMetaInfo } = basesStore const { createProject: _createProject, updateProject, getProjectMetaInfo } = basesStore
const { bases } = storeToRefs(basesStore) const { bases } = storeToRefs(basesStore)
@ -65,7 +65,7 @@ const { loadProjectTables } = useTablesStore()
const { activeTable } = storeToRefs(useTablesStore()) const { activeTable } = storeToRefs(useTablesStore())
const { appInfo, navigateToProject } = useGlobal() const { appInfo } = useGlobal()
const { orgRoles, isUIAllowed } = useRoles() const { orgRoles, isUIAllowed } = useRoles()
@ -351,46 +351,6 @@ const duplicateProject = (base: BaseType) => {
selectedProjectToDuplicate.value = base selectedProjectToDuplicate.value = base
isDuplicateDlgOpen.value = true isDuplicateDlgOpen.value = true
} }
const { $poller } = useNuxtApp()
const DlgProjectDuplicateOnOk = async (jobData: { id: string; base_id: string }) => {
await loadProjects('workspace')
$poller.subscribe(
{ id: jobData.id },
async (data: {
id: string
status?: string
data?: {
error?: {
message: string
}
message?: string
result?: any
}
}) => {
if (data.status !== 'close') {
if (data.status === JobStatus.COMPLETED) {
await loadProjects('workspace')
const base = bases.value.get(jobData.base_id)
// open base after duplication
if (base) {
await navigateToProject({
baseId: base.id,
type: base.type,
})
}
} else if (data.status === JobStatus.FAILED) {
message.error('Failed to duplicate base')
await loadProjects('workspace')
}
}
},
)
$e('a:base:duplicate')
}
const tableDelete = () => { const tableDelete = () => {
isTableDeleteDialogVisible.value = true isTableDeleteDialogVisible.value = true
@ -791,12 +751,7 @@ const projectDelete = () => {
:base-id="base?.id" :base-id="base?.id"
/> />
<DlgProjectDelete v-model:visible="isProjectDeleteDialogVisible" :base-id="base?.id" /> <DlgProjectDelete v-model:visible="isProjectDeleteDialogVisible" :base-id="base?.id" />
<DlgProjectDuplicate <DlgProjectDuplicate v-if="selectedProjectToDuplicate" v-model="isDuplicateDlgOpen" :base="selectedProjectToDuplicate" />
v-if="selectedProjectToDuplicate"
v-model="isDuplicateDlgOpen"
:base="selectedProjectToDuplicate"
:on-ok="DlgProjectDuplicateOnOk"
/>
<GeneralModal v-model:visible="isErdModalOpen" size="large"> <GeneralModal v-model:visible="isErdModalOpen" size="large">
<div class="h-[80vh]"> <div class="h-[80vh]">
<LazyDashboardSettingsErd :source-id="activeBaseId" /> <LazyDashboardSettingsErd :source-id="activeBaseId" />

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

@ -6,7 +6,6 @@ import { isEeUI, useVModel } from '#imports'
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
base: BaseType base: BaseType
onOk: (jobData: { name: string; id: string }) => Promise<void>
}>() }>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])

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

@ -4,7 +4,6 @@ import { isEeUI, useApi, useVModel, useWorkspace } from '#imports'
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
onOk: (jobData: { name: string; id: string }) => Promise<void>
}>() }>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])

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

@ -7,7 +7,6 @@ import type { TabType } from '#imports'
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
table: TableType table: TableType
onOk: (jobData: { name: string; id: string }) => Promise<void>
}>() }>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])

2
packages/nc-gui/components/nc/Pagination.vue

@ -4,7 +4,7 @@ const props = defineProps<{
total: number total: number
pageSize: number pageSize: number
entityName?: string entityName?: string
mode: 'simple' | 'full' mode?: 'simple' | 'full'
}>() }>()
const emits = defineEmits(['update:current', 'update:pageSize']) const emits = defineEmits(['update:current', 'update:pageSize'])

43
packages/nc-gui/components/workspace/ProjectList.vue

@ -11,19 +11,16 @@ const { updateProjectTitle } = workspaceStore
const { activePage } = storeToRefs(workspaceStore) const { activePage } = storeToRefs(workspaceStore)
const basesStore = useBases() const basesStore = useBases()
const { loadProjects } = basesStore
const { basesList, isProjectsLoading } = storeToRefs(basesStore) const { basesList, isProjectsLoading } = storeToRefs(basesStore)
const { navigateToProject } = useGlobal() const { navigateToProject } = useGlobal()
// const filteredProjects = computed(() => bases.value?.filter((p) => !p.deleted) || []) // const filteredProjects = computed(() => bases.value?.filter((p) => !p.deleted) || [])
const { $e, $poller } = useNuxtApp() const { $e } = useNuxtApp()
const { isUIAllowed } = useRoles() const { isUIAllowed } = useRoles()
const { refreshCommandPalette } = useCommandPalette()
const showProjectDeleteModal = ref(false) const showProjectDeleteModal = ref(false)
const toBeDeletedProjectId = ref<string | undefined>() const toBeDeletedProjectId = ref<string | undefined>()
@ -142,37 +139,6 @@ const workspaceMoveProjectOnSuccess = async (workspaceId: string) => {
const isDuplicateDlgOpen = ref(false) const isDuplicateDlgOpen = ref(false)
const selectedProjectToDuplicate = ref() const selectedProjectToDuplicate = ref()
const DlgProjectDuplicateOnOk = async (jobData: { id: string }) => {
await loadProjects('workspace')
$poller.subscribe(
{ id: jobData.id },
async (data: {
id: string
status?: string
data?: {
error?: {
message: string
}
message?: string
result?: any
}
}) => {
if (data.status !== 'close') {
if (data.status === JobStatus.COMPLETED) {
await loadProjects('workspace')
refreshCommandPalette()
} else if (data.status === JobStatus.FAILED) {
message.error('Failed to duplicate base')
await loadProjects('workspace')
}
}
},
)
$e('a:base:duplicate')
}
const duplicateProject = (base: BaseType) => { const duplicateProject = (base: BaseType) => {
selectedProjectToDuplicate.value = base selectedProjectToDuplicate.value = base
isDuplicateDlgOpen.value = true isDuplicateDlgOpen.value = true
@ -404,12 +370,7 @@ const setIcon = async (icon: string, base: BaseType) => {
:base="selectedProjectToMove" :base="selectedProjectToMove"
@success="workspaceMoveProjectOnSuccess" @success="workspaceMoveProjectOnSuccess"
/> />
<DlgProjectDuplicate <DlgProjectDuplicate v-if="selectedProjectToDuplicate" v-model="isDuplicateDlgOpen" :base="selectedProjectToDuplicate" />
v-if="selectedProjectToDuplicate"
v-model="isDuplicateDlgOpen"
:base="selectedProjectToDuplicate"
:on-ok="DlgProjectDuplicateOnOk"
/>
</div> </div>
</template> </template>

6
packages/nc-gui/store/config.ts

@ -7,7 +7,9 @@ export const useConfigStore = defineStore('configStore', () => {
const sidebarStore = useSidebarStore() const sidebarStore = useSidebarStore()
const viewsStore = useViewsStore() const viewsStore = useViewsStore()
const { activeViewTitleOrId } = storeToRefs(viewsStore)
const tablesStore = useTablesStore() const tablesStore = useTablesStore()
const { activeTableId } = storeToRefs(tablesStore)
const isViewPortMobile = () => width.value < MAX_WIDTH_FOR_MOBILE_MODE const isViewPortMobile = () => width.value < MAX_WIDTH_FOR_MOBILE_MODE
@ -47,7 +49,7 @@ export const useConfigStore = defineStore('configStore', () => {
const handleSidebarOpenOnMobileForNonViews = () => { const handleSidebarOpenOnMobileForNonViews = () => {
if (!isViewPortMobile()) return if (!isViewPortMobile()) return
if (!viewsStore.activeViewTitleOrId && !tablesStore.activeTableId) { if (!activeViewTitleOrId && !activeTableId) {
nextTick(() => { nextTick(() => {
sidebarStore.isLeftSidebarOpen = true sidebarStore.isLeftSidebarOpen = true
}) })
@ -56,7 +58,7 @@ export const useConfigStore = defineStore('configStore', () => {
} }
} }
watch([viewsStore.activeViewTitleOrId, tablesStore.activeTableId], () => { watch([activeViewTitleOrId, activeTableId], () => {
handleSidebarOpenOnMobileForNonViews() handleSidebarOpenOnMobileForNonViews()
}) })

Loading…
Cancel
Save