Browse Source

chore(gui-v2): cleanup

pull/2877/head
braks 2 years ago
parent
commit
42109fa4a7
  1. 4
      packages/nc-gui-v2/components/cell/Attachment.vue
  2. 13
      packages/nc-gui-v2/components/dashboard/TreeView.vue
  3. 1
      packages/nc-gui-v2/components/dashboard/settings/AppStore.vue
  4. 2
      packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue
  5. 2
      packages/nc-gui-v2/components/smartsheet/Toolbar.vue
  6. 3
      packages/nc-gui-v2/components/tabs/Smartsheet.vue
  7. 3
      packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue
  8. 13
      packages/nc-gui-v2/pages/index/index.vue
  9. 5
      packages/nc-gui-v2/pages/nc/[projectId]/index.vue
  10. 4
      packages/nc-gui-v2/pages/nc/[projectId]/index/index.vue
  11. 4
      packages/nc-gui-v2/pages/projects/index.vue
  12. 2
      packages/nc-gui-v2/pages/projects/index/index.vue
  13. 1
      packages/nc-gui-v2/pages/projects/index/list.vue
  14. 2
      packages/nc-gui-v2/plugins/i18n.ts
  15. 4
      packages/nc-gui-v2/plugins/tele.ts
  16. 2
      packages/nc-gui-v2/utils/projectCreateUtils.ts

4
packages/nc-gui-v2/components/cell/Attachment.vue

@ -3,8 +3,8 @@ import { useToast } from 'vue-toastification'
import { inject, ref, useProject, watchEffect } from '#imports' import { inject, ref, useProject, watchEffect } from '#imports'
import { useNuxtApp } from '#app' import { useNuxtApp } from '#app'
import { ColumnInj, MetaInj } from '~/context' import { ColumnInj, MetaInj } from '~/context'
import { NOCO } from '~/lib/constants' import { NOCO } from '~/lib'
import { isImage } from '~/utils/fileUtils' import { isImage } from '~/utils'
import MaterialPlusIcon from '~icons/mdi/plus' import MaterialPlusIcon from '~icons/mdi/plus'
import MaterialArrowExpandIcon from '~icons/mdi/arrow-expand' import MaterialArrowExpandIcon from '~icons/mdi/arrow-expand'

13
packages/nc-gui-v2/components/dashboard/TreeView.vue

@ -1,15 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from '@vue/reactivity' import { computed } from '@vue/reactivity'
import { Modal } from 'ant-design-vue' import { Modal } from 'ant-design-vue'
import { UITypes } from 'nocodb-sdk'
import type { LinkToAnotherRecordType, TableType } from 'nocodb-sdk' import type { LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import { UITypes } from 'nocodb-sdk'
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
import { watchEffect } from '#imports' import SettingsModal from './settings/SettingsModal.vue'
import { useProject, useTabs, useUIPermission, watchEffect } from '#imports'
import { useNuxtApp, useRoute } from '#app' import { useNuxtApp, useRoute } from '#app'
import useProject from '~/composables/useProject' import { extractSdkResponseErrorMsg } from '~/utils'
import useTabs from '~/composables/useTabs'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils'
import MdiSettingIcon from '~icons/mdi/cog' import MdiSettingIcon from '~icons/mdi/cog'
import MdiTable from '~icons/mdi/table' import MdiTable from '~icons/mdi/table'
import MdiView from '~icons/mdi/eye-circle-outline' import MdiView from '~icons/mdi/eye-circle-outline'
@ -19,7 +18,7 @@ import MdiPlus from '~icons/mdi/plus-circle-outline'
import MdiDrag from '~icons/mdi/drag-vertical' import MdiDrag from '~icons/mdi/drag-vertical'
import MdiMenuIcon from '~icons/mdi/dots-vertical' import MdiMenuIcon from '~icons/mdi/dots-vertical'
import MdiAPIDocIcon from '~icons/mdi/open-in-new' import MdiAPIDocIcon from '~icons/mdi/open-in-new'
import SettingsModal from '~/components/dashboard/settings/SettingsModal.vue' import { TabType } from '~/composables'
const { addTab } = useTabs() const { addTab } = useTabs()
const toast = useToast() const toast = useToast()
@ -165,7 +164,7 @@ const deleteTable = (table: TableType) => {
await $api.dbTable.delete(table?.id as string) await $api.dbTable.delete(table?.id as string)
closeTab({ closeTab({
type: 'table', type: TabType.TABLE,
id: table.id, id: table.id,
title: table.title, title: table.title,
}) })

1
packages/nc-gui-v2/components/dashboard/settings/AppStore.vue

@ -4,6 +4,7 @@ import AppInstall from './app-store/AppInstall.vue'
import MdiEditIcon from '~icons/ic/round-edit' import MdiEditIcon from '~icons/ic/round-edit'
import MdiCloseCircleIcon from '~icons/mdi/close-circle-outline' import MdiCloseCircleIcon from '~icons/mdi/close-circle-outline'
import MdiPlusIcon from '~icons/mdi/plus' import MdiPlusIcon from '~icons/mdi/plus'
const { $api, $e } = useNuxtApp() const { $api, $e } = useNuxtApp()
const toast = useToast() const toast = useToast()

2
packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk' import type { ColumnType } from 'nocodb-sdk'
import { ColumnInj } from '../../context' import { ColumnInj } from '~/context'
import { provide } from '#imports' import { provide } from '#imports'
const { column } = defineProps<{ column: ColumnType & { meta: any } }>() const { column } = defineProps<{ column: ColumnType & { meta: any } }>()

2
packages/nc-gui-v2/components/smartsheet/Toolbar.vue

@ -1,5 +1,3 @@
<script setup lang="ts"></script>
<template> <template>
<div class="nc-table-toolbar w-full py-1 flex gap-1 items-center" style="z-index: 7"> <div class="nc-table-toolbar w-full py-1 flex gap-1 items-center" style="z-index: 7">
<SmartsheetToolbarSearchData class="flex-shrink" /> <SmartsheetToolbarSearchData class="flex-shrink" />

3
packages/nc-gui-v2/components/tabs/Smartsheet.vue

@ -1,9 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ColumnType, ViewType } from 'nocodb-sdk' import type { ColumnType, ViewType } from 'nocodb-sdk'
import { ViewTypes } from 'nocodb-sdk' import { ViewTypes } from 'nocodb-sdk'
import { computed, inject, provide, watch, watchEffect } from '#imports' import { computed, inject, provide, useMetas, watch, watchEffect } from '#imports'
import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj, TabMetaInj } from '~/context' import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj, TabMetaInj } from '~/context'
import useMetas from '~/composables/useMetas'
const { getMeta, metas } = useMetas() const { getMeta, metas } = useMetas()

3
packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue

@ -2,7 +2,8 @@
import type { ColumnType } from 'nocodb-sdk' import type { ColumnType } from 'nocodb-sdk'
import ItemChip from './components/ItemChip.vue' import ItemChip from './components/ItemChip.vue'
import { ColumnInj } from '~/context' import { ColumnInj } from '~/context'
import useManyToMany from '~/composables/useManyToMany' import { useManyToMany } from '#imports'
const column = inject(ColumnInj) const column = inject(ColumnInj)
const value = inject('value') const value = inject('value')
const active = false const active = false

13
packages/nc-gui-v2/pages/index/index.vue

@ -4,8 +4,7 @@ import type { ProjectType } from 'nocodb-sdk'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
import { navigateTo } from '#app' import { navigateTo } from '#app'
import { computed, onMounted } from '#imports' import { computed, onMounted } from '#imports'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' import { extractSdkResponseErrorMsg } from '~/utils'
import MdiDeleteOutline from '~icons/mdi/delete-outline' import MdiDeleteOutline from '~icons/mdi/delete-outline'
import MdiEditOutline from '~icons/mdi/edit-outline' import MdiEditOutline from '~icons/mdi/edit-outline'
import MdiRefresh from '~icons/mdi/refresh' import MdiRefresh from '~icons/mdi/refresh'
@ -18,7 +17,7 @@ const toast = useToast()
const filterQuery = ref('') const filterQuery = ref('')
const loading = ref(true) const loading = ref(true)
const projects = ref() const projects = ref<ProjectType[]>()
const loadProjects = async () => { const loadProjects = async () => {
loading.value = true loading.value = true
@ -28,8 +27,10 @@ const loadProjects = async () => {
} }
const filteredProjects = computed(() => { const filteredProjects = computed(() => {
return projects.value.filter( return (
(project) => !filterQuery.value || project.title?.toLowerCase?.().includes(filterQuery.value.toLowerCase()), projects.value?.filter(
(project) => !filterQuery.value || project.title?.toLowerCase?.().includes(filterQuery.value.toLowerCase()),
) ?? []
) )
}) })
@ -44,7 +45,7 @@ const deleteProject = (project: ProjectType) => {
try { try {
$e('c:project:delete') $e('c:project:delete')
await $api.project.delete(project.id as string) await $api.project.delete(project.id as string)
projects.value.splice(projects.value.indexOf(project), 1) projects.value?.splice(projects.value.indexOf(project), 1)
} catch (e) { } catch (e) {
toast.error(await extractSdkResponseErrorMsg(e)) toast.error(await extractSdkResponseErrorMsg(e))
} }

5
packages/nc-gui-v2/pages/nc/[projectId]/index.vue

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import useTabs from '~/composables/useTabs' import { useTabs } from '#imports'
import { TabType } from '~/composables'
const route = useRoute() const route = useRoute()
const { loadProject, loadTables } = useProject(route.params.projectId as string) const { loadProject, loadTables } = useProject(route.params.projectId as string)
@ -7,7 +8,7 @@ const { addTab } = useTabs()
const { $state } = useNuxtApp() const { $state } = useNuxtApp()
if (!route.params.type) { if (!route.params.type) {
addTab({ type: 'auth', title: 'Team & Auth' }) addTab({ type: TabType.AUTH, title: 'Team & Auth' })
} }
await loadProject(route.params.projectId as string) await loadProject(route.params.projectId as string)

4
packages/nc-gui-v2/pages/nc/[projectId]/index/index.vue

@ -1,7 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import useTabs from '~/composables/useTabs'
import { TabMetaInj } from '~/context' import { TabMetaInj } from '~/context'
import useUIPermission from '~/composables/useUIPermission' import { useTabs, useUIPermission } from '#imports'
import MdiPlusIcon from '~icons/mdi/plus' import MdiPlusIcon from '~icons/mdi/plus'
import MdiTableIcon from '~icons/mdi/table' import MdiTableIcon from '~icons/mdi/table'
import MdiCsvIcon from '~icons/mdi/file-document-outline' import MdiCsvIcon from '~icons/mdi/file-document-outline'
@ -9,7 +8,6 @@ import MdiExcelIcon from '~icons/mdi/file-excel'
import MdiJSONIcon from '~icons/mdi/code-json' import MdiJSONIcon from '~icons/mdi/code-json'
import MdiAirTableIcon from '~icons/mdi/table-large' import MdiAirTableIcon from '~icons/mdi/table-large'
import MdiRequestDataSourceIcon from '~icons/mdi/open-in-new' import MdiRequestDataSourceIcon from '~icons/mdi/open-in-new'
import MdiAccountGroupIcon from '~icons/mdi/account-group'
const { tabs, activeTabIndex, activeTab, closeTab } = useTabs() const { tabs, activeTabIndex, activeTab, closeTab } = useTabs()

4
packages/nc-gui-v2/pages/projects/index.vue

@ -1,16 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode } from '@vue/runtime-core'
import { Modal } from 'ant-design-vue' import { Modal } from 'ant-design-vue'
import type { ProjectType } from 'nocodb-sdk' import type { ProjectType } from 'nocodb-sdk'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
import { navigateTo } from '#app' import { navigateTo } from '#app'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' import { extractSdkResponseErrorMsg } from '~/utils'
import MaterialSymbolsFormatListBulletedRounded from '~icons/material-symbols/format-list-bulleted-rounded' import MaterialSymbolsFormatListBulletedRounded from '~icons/material-symbols/format-list-bulleted-rounded'
import MaterialSymbolsGridView from '~icons/material-symbols/grid-view' import MaterialSymbolsGridView from '~icons/material-symbols/grid-view'
import MdiPlus from '~icons/mdi/plus' import MdiPlus from '~icons/mdi/plus'
import MdiDatabaseOutline from '~icons/mdi/database-outline' import MdiDatabaseOutline from '~icons/mdi/database-outline'
import MdiFolderOutline from '~icons/mdi/folder-outline' import MdiFolderOutline from '~icons/mdi/folder-outline'
import ExclamationCircleOutlined from '~icons/mdi/information-outline'
const navDrawerOptions = [ const navDrawerOptions = [
{ {

2
packages/nc-gui-v2/pages/projects/index/index.vue

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ProjectType } from 'nocodb-sdk' import type { ProjectType } from 'nocodb-sdk'
import { navigateTo } from '#app' import { navigateTo } from '#app'
import useColors from '~/composables/useColors' import { useColors } from '#imports'
import MdiMenuDown from '~icons/mdi/menu-down' import MdiMenuDown from '~icons/mdi/menu-down'
import MdiDeleteOutline from '~icons/mdi/delete-outline' import MdiDeleteOutline from '~icons/mdi/delete-outline'
import MdiPlus from '~icons/mdi/plus' import MdiPlus from '~icons/mdi/plus'

1
packages/nc-gui-v2/pages/projects/index/list.vue

@ -1,7 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ProjectType } from 'nocodb-sdk' import type { ProjectType } from 'nocodb-sdk'
import { navigateTo } from '#app' import { navigateTo } from '#app'
import MdiDeleteOutline from '~icons/mdi/delete-outline' import MdiDeleteOutline from '~icons/mdi/delete-outline'
import MdiEditOutline from '~icons/mdi/edit-outline' import MdiEditOutline from '~icons/mdi/edit-outline'

2
packages/nc-gui-v2/plugins/i18n.ts

@ -46,7 +46,7 @@ export const createI18nPlugin = async () =>
export default defineNuxtPlugin(async (nuxtApp) => { export default defineNuxtPlugin(async (nuxtApp) => {
const i18n = await createI18nPlugin() const i18n = await createI18nPlugin()
nuxtApp.vueApp.i18n = i18n.global nuxtApp.vueApp.i18n = i18n.global as any
nuxtApp.vueApp.use(i18n) nuxtApp.vueApp.use(i18n)
}) })

4
packages/nc-gui-v2/plugins/tele.ts

@ -1,7 +1,7 @@
import { defineNuxtPlugin } from 'nuxt/app' import { defineNuxtPlugin } from 'nuxt/app'
import type { Socket } from 'socket.io-client' import type { Socket } from 'socket.io-client'
import io from 'socket.io-client' import io from 'socket.io-client'
import type { GlobalState } from '~/lib/types' import type { UseGlobalReturn } from '~/composables/useGlobal/types'
// todo: ignore init if tele disabled // todo: ignore init if tele disabled
export default defineNuxtPlugin(async (nuxtApp) => { export default defineNuxtPlugin(async (nuxtApp) => {
@ -81,7 +81,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
} }
} }
watch((nuxtApp.$state as GlobalState).token, (newToken, oldToken) => { watch((nuxtApp.$state as UseGlobalReturn).token, (newToken, oldToken) => {
if (newToken && newToken !== oldToken) init(newToken) if (newToken && newToken !== oldToken) init(newToken)
else if (!newToken) socket.disconnect() else if (!newToken) socket.disconnect()
}) })

2
packages/nc-gui-v2/utils/projectCreateUtils.ts

@ -1,4 +1,4 @@
import { ClientType } from '~/lib/enums' import { ClientType } from '~/lib'
export interface ProjectCreateForm { export interface ProjectCreateForm {
title: string title: string

Loading…
Cancel
Save