Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions backend/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,29 @@ DATABASE_PASSWORD=os.getenv('DATABASE_PASSWORD')
DATABASE_OPTIONS=os.getenv('DATABASE_OPTIONS')
try:
options = json.loads(DATABASE_OPTIONS or "{}")
psycopg.connect(
conn = psycopg.connect(
dbname=DATABASE_NAME,
user=DATABASE_USER,
password=DATABASE_PASSWORD,
host=DATABASE_HOST,
port=DATABASE_PORT,
**options
)
conn.close()
except Exception as e:
print(f"Error: Failed to connect to the postgresql database at {DATABASE_HOST}")
print("Please see the error below for more details:")
print(e)
print("Trying again without any DATABASE_OPTIONS:")
try:
psycopg.connect(
conn = psycopg.connect(
dbname=DATABASE_NAME,
user=DATABASE_USER,
password=DATABASE_PASSWORD,
host=DATABASE_HOST,
port=DATABASE_PORT,
)
conn.close()
except Exception as e:
print(f"Error: Failed to connect to the postgresql database at {DATABASE_HOST} without the {DATABASE_OPTIONS}")
print("Please see the error below for more details:")
Expand All @@ -109,9 +111,10 @@ except ImportError:
import os
DATABASE_URL=os.getenv('DATABASE_URL')
try:
psycopg.connect(
conn = psycopg.connect(
DATABASE_URL
)
conn.close()
except psycopg.OperationalError as e:
print(f"Error: Failed to connect to the postgresql database at {DATABASE_URL}")
print("Please see the error below for more details:")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "bug",
"message": "Fix AI field keyboard shortcuts",
"issue_origin": "github",
"issue_number": 4499,
"domain": "database",
"bullet_points": [],
"created_at": "2026-01-09"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<div
v-if="(!value || (!opened && generating)) && !readOnly"
v-if="(!value || generating) && !readOnly"
ref="cell"
class="grid-view__cell active"
>
Expand Down Expand Up @@ -31,22 +31,26 @@
:row="row"
:all-fields-in-table="allFieldsInTable"
v-bind="$attrs"
@editing-changed="(e) => (editing = e)"
@update="(...args) => $emit('update', ...args)"
@select-below="(...args) => $emit('selectBelow', ...args)"
@add-row-after="(...args) => $emit('add-row-after', ...args)"
>
<template v-if="!readOnly && editing" #default="{ editing }">
<template v-if="!readOnly && editing" #default>
<div style="background-color: #fff; padding: 8px">
<ButtonText
v-if="!isDeactivated"
icon="iconoir-magic-wand"
:disabled="!modelAvailable || generating"
:loading="generating"
@click.prevent.stop="generate()"
@mousedown.prevent.stop="generate()"
>
{{ $t('gridViewFieldAI.regenerate') }}
</ButtonText>
<ButtonText
v-else
icon="iconoir-lock"
@click.prevent.stop="$refs.clickModal.show()"
@mousedown.prevent.stop="$refs.clickModal.show()"
>
{{ $t('gridViewFieldAI.regenerate') }}
</ButtonText>
Expand All @@ -67,12 +71,17 @@
<script>
import { isElement } from '@baserow/modules/core/utils/dom'
import gridField from '@baserow/modules/database/mixins/gridField'
import gridFieldInput from '@baserow/modules/database/mixins/gridFieldInput'
import gridFieldAI from '@baserow_premium/mixins/gridFieldAI'

export default {
name: 'GridViewFieldAI',
mixins: [gridField, gridFieldInput, gridFieldAI],
mixins: [gridField, gridFieldAI],
data() {
return {
editing: false,
keydownEventListener: null,
}
},
computed: {
fieldName() {
return this.$registry.get('field', this.field.type).getName()
Expand All @@ -98,20 +107,54 @@ export default {
},
},
methods: {
save() {
this.opened = false
this.editing = false
this.afterSave()
select() {
this.keydownEventListener = (event) => {
if (event.key === 'Enter') {
// When the field is selected but doesn't have any generated value yet,
// we want to trigger AI generation
if (!this.value && !this.readOnly) {
this.generate()
}
}
}
document.body.addEventListener('keydown', this.keydownEventListener)
},
beforeUnSelect() {
document.body.removeEventListener('keydown', this.keydownEventListener)
},
canKeyDown() {
if (this.$refs.cell && typeof this.$refs.cell.canKeyDown === 'function') {
return this.$refs.cell.canKeyDown()
}
return true
},
canSaveByPressingEnter(event) {
return this.$refs.cell.canSaveByPressingEnter(event)
canKeyboardShortcut() {
// Since this component is based on gridField mixin
// we need to make sure that keyboard shortcuts are
// restricted only to non-editing mode
if (
this.$refs.cell &&
typeof this.$refs.cell.canKeyboardShortcut === 'function'
) {
return this.$refs.cell.canKeyboardShortcut()
}
return true
},
canUnselectByClickingOutside(event) {
if (this.isDeactivated && this.workspace) {
return !isElement(this.$refs.clickModal.$el, event.target)
}
return true
},
canSelectNext(event) {
if (
this.$refs.cell &&
typeof this.$refs.cell.canSelectNext === 'function'
) {
return this.$refs.cell.canSelectNext(event)
}
return true
},
},
}
</script>
6 changes: 1 addition & 5 deletions web-frontend/modules/core/mixins/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,7 @@ export default {
this.handleUpAndDownArrowPress(event)
}
// Allow the Enter key to select the value that is currently being focused
if (
this.open &&
event.key === 'Enter' &&
this.focusedDropdownItem !== null
) {
if (this.open && event.key === 'Enter') {
// Prevent submitting the whole form when pressing the enter key while the
// dropdown is open.
event.preventDefault()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,19 @@ import FieldSelectOptionsDropdown from '@baserow/modules/database/components/fie
export default {
components: { FieldSelectOptionsDropdown },
mixins: [gridField, singleSelectField],
emits: ['editing-changed'],
data() {
return {
editing: false,
}
},
watch: {
editing: {
handler(newValue) {
this.$emit('editing-changed', newValue)
},
immediate: true,
},
},
}
</script>
4 changes: 4 additions & 0 deletions web-frontend/modules/database/mixins/gridField.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export default {
'unselect',
'unselected',
'update',
'selectPrevious',
'selectAbove',
'selectNext',
'selectBelow',
],
props: {
/**
Expand Down
9 changes: 7 additions & 2 deletions web-frontend/modules/database/mixins/gridFieldInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { isPrintableUnicodeCharacterKeyPress } from '@baserow/modules/core/utils
* example for the text and number fields. It depends on the gridField mixin.
*/
export default {
emits: ['edit', 'selectBelow', 'update'],

emits: ['edit', 'selectBelow', 'update', 'editing-changed'],
data() {
return {
/**
Expand All @@ -31,6 +30,12 @@ export default {
this.$emit('edit', this.prepareValue(newCopy), this.value)
}
},
editing: {
handler(newValue) {
this.$emit('editing-changed', newValue)
},
immediate: true,
},
},
mounted() {
this.leftMouseDownListener = (event) => {
Expand Down
Loading