mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-17 18:32:35 +00:00
Resolve "multiple rows selection: AI field generation on right-click gets no rows in the frontend"
This commit is contained in:
parent
6b3728e165
commit
38975cd985
3 changed files with 38 additions and 10 deletions
changelog/entries/unreleased/bug
premium/web-frontend/modules/baserow_premium/components/views/grid/fields
web-frontend/modules/database/components/view/grid
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "bug",
|
||||
"message": "Fix selecting more than 120 rows when triggering AI value generation.",
|
||||
"issue_number": 2979,
|
||||
"bullet_points": [],
|
||||
"created_at": "2024-09-14"
|
||||
}
|
|
@ -2,7 +2,10 @@
|
|||
<li class="context__menu-item">
|
||||
<a
|
||||
class="context__menu-item-link"
|
||||
:class="{ disabled: !modelAvailable || !hasPremium }"
|
||||
:class="{
|
||||
disabled: !modelAvailable || !hasPremium,
|
||||
'context__menu-item-link--loading': loading,
|
||||
}"
|
||||
@click.prevent.stop="generateAIFieldValues()"
|
||||
>
|
||||
<i class="context__menu-item-icon iconoir-magic-wand"></i>
|
||||
|
@ -22,8 +25,8 @@ export default {
|
|||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
rows: {
|
||||
type: Array,
|
||||
getRows: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
storePrefix: {
|
||||
|
@ -35,6 +38,11 @@ export default {
|
|||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
workspace() {
|
||||
return this.$store.getters['workspace/get'](this.database.workspace.id)
|
||||
|
@ -61,7 +69,19 @@ export default {
|
|||
return
|
||||
}
|
||||
|
||||
const rowIds = this.rows.map((row) => row.id)
|
||||
this.loading = true
|
||||
let rows = []
|
||||
|
||||
try {
|
||||
rows = await this.getRows()
|
||||
} catch (error) {
|
||||
notifyIf(error, 'rows')
|
||||
return
|
||||
}
|
||||
|
||||
const rowIds = rows.map((row) => row.id)
|
||||
this.loading = false
|
||||
|
||||
const fieldId = this.field.id
|
||||
this.$store.dispatch(
|
||||
this.storePrefix + 'view/grid/setPendingFieldOperations',
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
v-for="(contextItemComponent, index) in getMultiSelectContextItems()"
|
||||
:key="index"
|
||||
:field="getSelectedField()"
|
||||
:rows="getSelectedRows()"
|
||||
:get-rows="getSelectedRowsFunction"
|
||||
:store-prefix="storePrefix"
|
||||
:database="database"
|
||||
@click=";[$refs.rowContext.hide()]"
|
||||
|
@ -1562,11 +1562,12 @@ export default {
|
|||
](this.fields)
|
||||
return selectedFields.length === 1 ? selectedFields[0] : null
|
||||
},
|
||||
/**
|
||||
* Returns the selected rows if any rows are selected, otherwise returns an empty array.
|
||||
*/
|
||||
getSelectedRows() {
|
||||
return this.$store.getters[this.storePrefix + 'view/grid/getSelectedRows']
|
||||
async getSelectedRowsFunction() {
|
||||
const fieldsAndRows = await this.$store.dispatch(
|
||||
this.storePrefix + 'view/grid/getCurrentSelection',
|
||||
{ fields: this.fields }
|
||||
)
|
||||
return fieldsAndRows[1]
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue