Browse Source

fix: warnings in ui

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6314/head
mertmit 1 year ago
parent
commit
9b20269d08
  1. 5
      packages/nc-gui/components/dashboard/settings/DataSources.vue
  2. 4
      packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue
  3. 8
      packages/nc-gui/components/dlg/ViewCreate.vue
  4. 8
      packages/nc-gui/components/nc/Button.vue
  5. 7
      packages/nc-gui/components/nc/Tabs.vue
  6. 2
      packages/nc-gui/components/project/AccessSettings.vue
  7. 5
      packages/nc-gui/components/project/AllTables.vue
  8. 8
      packages/nc-gui/components/project/InviteProjectCollabSection.vue
  9. 1
      packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue
  10. 2
      packages/nc-gui/components/workspace/CollaboratorsList.vue

5
packages/nc-gui/components/dashboard/settings/DataSources.vue

@ -52,6 +52,7 @@ async function loadBases(changed?: boolean) {
try { try {
if (changed) refreshCommandPalette() if (changed) refreshCommandPalette()
await until(() => !!project.value.id).toBeTruthy()
isReloading.value = true isReloading.value = true
vReload.value = true vReload.value = true
const baseList = await $api.base.list(project.value.id as string) const baseList = await $api.base.list(project.value.id as string)
@ -164,8 +165,7 @@ const forceAwaken = () => {
onMounted(async () => { onMounted(async () => {
if (sources.value.length === 0) { if (sources.value.length === 0) {
await loadBases() loadBases()
await loadMetaDiff()
} }
}) })
@ -174,7 +174,6 @@ watch(
async (reload) => { async (reload) => {
if (reload && !isReloading.value) { if (reload && !isReloading.value) {
await loadBases() await loadBases()
await loadMetaDiff()
} }
}, },
) )

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

@ -350,8 +350,8 @@ onMounted(async () => {
// todo: replace setTimeout and follow better approach // todo: replace setTimeout and follow better approach
setTimeout(() => { setTimeout(() => {
const input = form.value?.$el?.querySelector('input[type=text]') const input = form.value?.$el?.querySelector('input[type=text]')
input.setSelectionRange(0, formState.value.title.length) input?.setSelectionRange(0, formState.value.title.length)
input.focus() input?.focus()
}, 500) }, 500)
}) })
}) })

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

@ -156,7 +156,13 @@ function init() {
} }
async function onSubmit() { async function onSubmit() {
const isValid = await formValidator.value?.validateFields() let isValid = null
try {
isValid = await formValidator.value?.validateFields()
} catch (e) {
console.error(e)
}
if (isValid && form.type) { if (isValid && form.type) {
const _meta = unref(meta) const _meta = unref(meta)

8
packages/nc-gui/components/nc/Button.vue

@ -33,6 +33,8 @@ const emits = defineEmits(['update:loading'])
const slots = useSlots() const slots = useSlots()
const NcButton = ref<HTMLElement | null>(null)
const size = computed(() => props.size) const size = computed(() => props.size)
const type = computed(() => props.type) const type = computed(() => props.type)
@ -63,10 +65,15 @@ const onBlur = () => {
isFocused.value = false isFocused.value = false
isClicked.value = false isClicked.value = false
} }
useEventListener(NcButton, 'mousedown', () => {
isClicked.value = true
})
</script> </script>
<template> <template>
<a-button <a-button
ref="NcButton"
:disabled="props.disabled" :disabled="props.disabled"
:loading="loading" :loading="loading"
:type="type" :type="type"
@ -80,7 +87,6 @@ const onBlur = () => {
}" }"
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
@mousedown="isClicked = true"
> >
<div <div
class="flex flex-row gap-x-2.5 w-full" class="flex flex-row gap-x-2.5 w-full"

7
packages/nc-gui/components/nc/Tabs.vue

@ -3,17 +3,10 @@ const props = defineProps<{
modelValue?: string modelValue?: string
centered?: boolean centered?: boolean
}>() }>()
const emits = defineEmits<{
(event: 'update:modelValue', data: string): void
}>()
const vModel = useVModel(props, 'modelValue', emits)
</script> </script>
<template> <template>
<a-tabs <a-tabs
v-model:activeKey="vModel"
class="nc-tabs" class="nc-tabs"
:class="{ :class="{
centered: props.centered, centered: props.centered,

2
packages/nc-gui/components/project/AccessSettings.vue

@ -154,7 +154,7 @@ const accessibleRoles = computed<(typeof ProjectRoles)[keyof typeof ProjectRoles
v-else-if="!collaborators?.length" v-else-if="!collaborators?.length"
class="nc-collaborators-list w-full h-full flex flex-col items-center justify-center mt-36" class="nc-collaborators-list w-full h-full flex flex-col items-center justify-center mt-36"
> >
<Empty description="No collaborators found" /> <a-empty description="No collaborators found" />
</div> </div>
<div v-else class="nc-collaborators-list nc-scrollbar-md"> <div v-else class="nc-collaborators-list nc-scrollbar-md">
<div class="nc-collaborators-list-header"> <div class="nc-collaborators-list-header">

5
packages/nc-gui/components/project/AllTables.vue

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { stringifyRolesObj } from 'nocodb-sdk'
import type { BaseType, TableType } from 'nocodb-sdk' import type { BaseType, TableType } from 'nocodb-sdk'
import dayjs from 'dayjs' import dayjs from 'dayjs'
@ -8,6 +9,8 @@ const { openedProject } = storeToRefs(useProjects())
const { isUIAllowed } = useUIPermission() const { isUIAllowed } = useUIPermission()
const { allRoles } = useRoles()
const { $e } = useNuxtApp() const { $e } = useNuxtApp()
const isImportModalOpen = ref(false) const isImportModalOpen = ref(false)
@ -71,7 +74,7 @@ function openTableCreateDialog(baseIndex?: number | undefined) {
<template> <template>
<div class="nc-all-tables-view"> <div class="nc-all-tables-view">
<div v-if="isUIAllowed('tableCreate', false, roles)" class="flex flex-row gap-x-6 pb-3 pt-6"> <div v-if="isUIAllowed('tableCreate', false, stringifyRolesObj(allRoles))" class="flex flex-row gap-x-6 pb-3 pt-6">
<div class="nc-project-view-all-table-btn" data-testid="proj-view-btn__add-new-table" @click="openTableCreateDialog()"> <div class="nc-project-view-all-table-btn" data-testid="proj-view-btn__add-new-table" @click="openTableCreateDialog()">
<GeneralIcon icon="addOutlineBox" /> <GeneralIcon icon="addOutlineBox" />
<div class="label">{{ $t('general.new') }} {{ $t('objects.table') }}</div> <div class="label">{{ $t('general.new') }} {{ $t('objects.table') }}</div>

8
packages/nc-gui/components/project/InviteProjectCollabSection.vue

@ -23,7 +23,13 @@ const usersData = ref<{
roles?: string roles?: string
}>() }>()
const isInvitingCollaborators = ref(false)
const inviteCollaborator = async () => { const inviteCollaborator = async () => {
isInvitingCollaborators.value = true
if (isInvitingCollaborators.value) return
try { try {
usersData.value = await inviteUser(inviteData) usersData.value = await inviteUser(inviteData)
usersData.roles = inviteData.roles usersData.roles = inviteData.roles
@ -35,6 +41,8 @@ const inviteCollaborator = async () => {
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
isInvitingCollaborators.value = false
} }
const inviteUrl = computed(() => const inviteUrl = computed(() =>

1
packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue

@ -145,7 +145,6 @@ watch(open, () => {
<NcDropdown <NcDropdown
v-model:visible="open" v-model:visible="open"
offset-y offset-y
class=""
:trigger="['click']" :trigger="['click']"
overlay-class-name="nc-dropdown-group-by-menu nc-toolbar-dropdown" overlay-class-name="nc-dropdown-group-by-menu nc-toolbar-dropdown"
> >

2
packages/nc-gui/components/workspace/CollaboratorsList.vue

@ -48,7 +48,7 @@ const accessibleRoles = computed<WorkspaceUserRoles[]>(() => {
</a-input> </a-input>
</div> </div>
<div v-if="!filterCollaborators?.length" class="w-full h-full flex flex-col items-center justify-center mt-36"> <div v-if="!filterCollaborators?.length" class="w-full h-full flex flex-col items-center justify-center mt-36">
<Empty description="No collaborators found" /> <a-empty description="No collaborators found" />
</div> </div>
<table v-else class="nc-collaborators-list-table !nc-scrollbar-md"> <table v-else class="nc-collaborators-list-table !nc-scrollbar-md">
<thead> <thead>

Loading…
Cancel
Save