Skip to content

Commit

Permalink
Merge branch 'develop' into no-tar
Browse files Browse the repository at this point in the history
  • Loading branch information
mertmit committed May 10, 2024
2 parents e2967a2 + 1616c6b commit dae8bc0
Show file tree
Hide file tree
Showing 72 changed files with 1,385 additions and 773 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release-executables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
- name : Install nocodb, other dependencies and build executables
run: |
cd ./scripts/pkg-executable
# downgrade sqlite3 to 5.1.6 until build related issues are resolved
# https://github.com/TryGhost/node-sqlite3/issues/1748
node ../downgradeSqlite.js
# Install nocodb version based on provided tag name
npm i -E nocodb@${{ github.event.inputs.tag || inputs.tag }}
Expand Down
8 changes: 8 additions & 0 deletions packages/nc-gui/assets/nc-icons/alert-triangle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion packages/nc-gui/components/account/UserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ const openDeleteModal = (user: UserType) => {
<div class="max-w-195 mx-auto h-full">
<div class="text-2xl text-left font-weight-bold mb-4" data-rec="true">{{ $t('title.userMgmt') }}</div>
<div class="py-2 flex gap-4 items-center justify-between">
<a-input v-model:value="searchText" class="!max-w-90 !rounded-md" placeholder="Search members" @change="loadUsers()">
<a-input
v-model:value="searchText"
class="!max-w-90 !rounded-md"
:placeholder="$t('title.searchMembers')"
@change="loadUsers()"
>
<template #prefix>
<PhMagnifyingGlassBold class="!h-3.5 text-gray-500" />
</template>
Expand Down
6 changes: 4 additions & 2 deletions packages/nc-gui/components/cell/Currency.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { VNodeRef } from '@vue/runtime-core'
interface Props {
modelValue: number | null | undefined
placeholder?: string
hidePrefix?: boolean
}
const props = defineProps<Props>()
Expand Down Expand Up @@ -92,7 +94,7 @@ onMounted(() => {

<template>
<div
v-if="isForm && !isEditColumn"
v-if="isForm && !isEditColumn && !hidePrefix"
class="nc-currency-code h-full !bg-gray-100 border-r border-gray-200 px-3 mr-1 flex items-center"
>
<span>
Expand All @@ -106,7 +108,7 @@ onMounted(() => {
type="number"
class="nc-cell-field h-full border-none rounded-md py-1 outline-none focus:outline-none focus:ring-0"
:class="isForm && !isEditColumn ? 'flex flex-1' : 'w-full'"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
:placeholder="placeholder !== undefined ? placeholder : isEditColumn ? $t('labels.optional') : ''"
:disabled="readOnly"
@blur="onBlur"
@keydown.enter="onKeydownEnter"
Expand Down
3 changes: 2 additions & 1 deletion packages/nc-gui/components/cell/Decimal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface Props {
// for sqlite, when we clear a cell or empty the cell, it returns ""
// otherwise, it is null type
modelValue?: number | null | string
placeholder?: string
}
interface Emits {
Expand Down Expand Up @@ -101,7 +102,7 @@ watch(isExpandedFormOpen, () => {
class="nc-cell-field outline-none py-1 border-none rounded-md w-full h-full"
type="number"
:step="precision"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
:placeholder="placeholder !== undefined ? placeholder : isEditColumn ? $t('labels.optional') : ''"
style="letter-spacing: 0.06rem"
@blur="editEnabled = false"
@keydown.down.stop="onKeyDown"
Expand Down
3 changes: 2 additions & 1 deletion packages/nc-gui/components/cell/Percent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { VNodeRef } from '@vue/runtime-core'
interface Props {
modelValue?: number | string | null
placeholder?: string
}
const props = defineProps<Props>()
Expand Down Expand Up @@ -144,7 +145,7 @@ const onTabPress = (e: KeyboardEvent) => {
v-model="vModel"
class="nc-cell-field w-full !border-none !outline-none focus:ring-0 py-1"
:type="inputType"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
:placeholder="placeholder !== undefined ? placeholder : isEditColumn ? $t('labels.optional') : ''"
@blur="onBlur"
@focus="onFocus"
@keydown.down.stop
Expand Down
6 changes: 2 additions & 4 deletions packages/nc-gui/components/cell/PhoneNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const isEditColumn = inject(EditColumnInj, ref(false))
const column = inject(ColumnInj)!
const isSurveyForm = inject(IsSurveyFormInj, ref(false))
const isForm = inject(IsFormInj)!
const readOnly = inject(ReadonlyInj, ref(false))
Expand All @@ -33,7 +33,7 @@ const vModel = computed({
get: () => value,
set: (val) => {
localState.value = val
if (!parseProp(column.value.meta)?.validate || (val && isMobilePhone(val)) || !val || isSurveyForm.value) {
if (!parseProp(column.value.meta)?.validate || (val && isMobilePhone(val)) || !val || isForm.value) {
emit('update:modelValue', val)
}
},
Expand All @@ -43,8 +43,6 @@ const validPhoneNumber = computed(() => vModel.value && isMobilePhone(vModel.val
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!
const isForm = inject(IsFormInj)!
const focus: VNodeRef = (el) =>
!isExpandedFormOpen.value && !isEditColumn.value && !isForm.value && (el as HTMLInputElement)?.focus()
Expand Down
18 changes: 9 additions & 9 deletions packages/nc-gui/components/cell/RichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const props = withDefaults(
const emits = defineEmits(['update:value', 'focus', 'blur'])
const { isFormField, hiddenBubbleMenuOptions } = toRefs(props)
const { fullMode, isFormField, hiddenBubbleMenuOptions } = toRefs(props)
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!
Expand Down Expand Up @@ -219,16 +219,16 @@ if (isFormField.value) {
})
}
watch(editorDom, () => {
if (!editorDom.value) return
onMounted(() => {
if (fullMode.value) {
setEditorContent(vModel.value, true)
setEditorContent(vModel.value, true)
if ((isForm.value && !isSurveyForm.value) || isFormField.value) return
if ((isForm.value && !isSurveyForm.value) || isFormField.value) return
// Focus editor after editor is mounted
setTimeout(() => {
editor.value?.chain().focus().run()
}, 50)
nextTick(() => {
editor.value?.chain().focus().run()
})
}
})
useEventListener(
Expand Down
4 changes: 2 additions & 2 deletions packages/nc-gui/components/cell/attachment/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const handleFileDelete = (i: number) => {
<div
v-if="active || (isForm && visibleItems.length)"
class="xs:hidden h-6 w-5 group cursor-pointer flex gap-1 items-center active:(ring ring-accent ring-opacity-100) rounded border-none p-1 hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)"
class="xs:hidden h-6 w-5.5 group cursor-pointer flex gap-1 items-center active:(ring ring-accent ring-opacity-100) rounded border-none p-1 hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)"
>
<component :is="iconMap.reload" v-if="isLoading" :class="{ 'animate-infinite animate-spin': isLoading }" />
Expand All @@ -342,7 +342,7 @@ const handleFileDelete = (i: number) => {
<component
:is="iconMap.expand"
class="flex-none transform dark:(!text-white) group-hover:(!text-grey-800 scale-120) text-gray-500 text-[2rem] h-3"
class="flex-none transform dark:(!text-white) group-hover:(!text-grey-800 scale-120) text-gray-500 text-sm"
@click.stop="onExpand"
/>
</NcTooltip>
Expand Down
92 changes: 90 additions & 2 deletions packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const basesStore = useBases()
const { isMobileMode } = useGlobal()
const { createProject: _createProject, updateProject, getProjectMetaInfo } = basesStore
const { api } = useApi()
const { createProject: _createProject, updateProject, getProjectMetaInfo, loadProject } = basesStore
const { bases } = storeToRefs(basesStore)
Expand All @@ -49,6 +51,16 @@ const editMode = ref(false)
const tempTitle = ref('')
const sourceRenameHelpers = ref<
Record<
string,
{
editMode: boolean
tempTitle: string
}
>
>({})
const activeBaseId = ref('')
const isErdModalOpen = ref<Boolean>(false)
Expand Down Expand Up @@ -102,6 +114,52 @@ const enableEditMode = () => {
})
}
const enableEditModeForSource = (sourceId: string) => {
const source = base.value.sources?.find((s) => s.id === sourceId)
if (!source?.id) return
sourceRenameHelpers.value[source.id] = {
editMode: true,
tempTitle: source.alias || '',
}
nextTick(() => {
const input: HTMLInputElement | null = document.querySelector(`[data-source-rename-input-id="${sourceId}"]`)
if (!input) return
input?.focus()
input?.select()
input?.scrollIntoView()
})
}
const updateSourceTitle = async (sourceId: string) => {
const source = base.value.sources?.find((s) => s.id === sourceId)
if (!source?.id || !sourceRenameHelpers.value[source.id]) return
if (sourceRenameHelpers.value[source.id].tempTitle) {
sourceRenameHelpers.value[source.id].tempTitle = sourceRenameHelpers.value[source.id].tempTitle.trim()
}
if (!sourceRenameHelpers.value[source.id].tempTitle) return
try {
await api.source.update(source.base_id, source.id, {
alias: sourceRenameHelpers.value[source.id].tempTitle,
})
await loadProject(source.base_id, true)
delete sourceRenameHelpers.value[source.id]
$e('a:source:rename')
refreshViewTabTitle?.()
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
} finally {
refreshCommandPalette()
}
}
const updateProjectTitle = async () => {
if (tempTitle.value) {
tempTitle.value = tempTitle.value.trim()
Expand Down Expand Up @@ -672,7 +730,20 @@ const onTableIdCopy = async () => {
<GeneralBaseLogo
class="flex-none min-w-4 !xs:(min-w-4.25 w-4.25 text-sm) !text-gray-600 !group-hover:text-gray-800"
/>
<input
v-if="source.id && sourceRenameHelpers[source.id]?.editMode"
ref="input"
v-model="sourceRenameHelpers[source.id].tempTitle"
class="flex-grow leading-1 outline-0 ring-none capitalize !text-inherit !bg-transparent flex-1 mr-4"
:data-source-rename-input-id="source.id"
@click.stop
@keydown.enter.stop.prevent
@keyup.enter="updateSourceTitle(source.id!)"
@keyup.esc="updateSourceTitle(source.id!)"
@blur="updateSourceTitle(source.id!)"
/>
<NcTooltip
v-else
class="nc-sidebar-node-title capitalize text-ellipsis overflow-hidden select-none"
:style="{ wordBreak: 'keep-all', whiteSpace: 'nowrap', display: 'inline' }"
:class="{
Expand All @@ -688,7 +759,13 @@ const onTableIdCopy = async () => {
<NcTooltip class="xs:(hidden) flex items-center mr-1">
<template #title>{{ $t('objects.externalDb') }}</template>
<GeneralIcon icon="info" class="flex-none text-gray-400 hover:text-gray-700 mr-1" />
<GeneralIcon
icon="info"
class="flex-none text-gray-400 hover:text-gray-700 nc-sidebar-node-btn"
:class="{
'!hidden': !isBasesOptionsOpen[source!.id!],
}"
/>
</NcTooltip>
</div>
<div class="flex flex-row items-center gap-x-0.25">
Expand Down Expand Up @@ -716,6 +793,17 @@ const onTableIdCopy = async () => {
}"
@click="isBasesOptionsOpen[source!.id!] = false"
>
<NcMenuItem
v-if="isUIAllowed('baseRename')"
data-testid="nc-sidebar-source-rename"
@click="enableEditModeForSource(source.id!)"
>
<GeneralIcon icon="rename" class="group-hover:text-black" />
{{ $t('general.rename') }}
</NcMenuItem>
<NcDivider />
<!-- ERD View -->
<NcMenuItem key="erd" @click="openErdView(source)">
<div v-e="['c:source:erd']" class="flex gap-2 items-center">
Expand Down

0 comments on commit dae8bc0

Please sign in to comment.