mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-10 15:47:32 +00:00
Resolve "Grid view crash with a lookup to a duration field"
This commit is contained in:
parent
8cf0d6aa90
commit
af3ae6934c
3 changed files with 65 additions and 10 deletions
backend/templates
changelog/entries/unreleased/bug
web-frontend/modules/database/mixins
|
@ -407,6 +407,45 @@
|
|||
"order": 29,
|
||||
"primary": false,
|
||||
"duration_format": "h:mm:ss"
|
||||
},
|
||||
{
|
||||
"id": 4701,
|
||||
"type": "formula",
|
||||
"name": "Formula Duration",
|
||||
"order": 30,
|
||||
"primary": false,
|
||||
"error": null,
|
||||
"date_include_time": null,
|
||||
"nullable": true,
|
||||
"date_show_tzinfo": null,
|
||||
"date_format": null,
|
||||
"date_force_timezone": null,
|
||||
"number_decimal_places": null,
|
||||
"date_time_format": null,
|
||||
"duration_format": "h:mm:ss",
|
||||
"array_formula_type": null,
|
||||
"formula": "field(\"Duration\") + date_interval('1 h')",
|
||||
"formula_type": "duration"
|
||||
},
|
||||
{
|
||||
"id": 4702,
|
||||
"type": "lookup",
|
||||
"name": "Lookup duration",
|
||||
"order": 31,
|
||||
"primary": false,
|
||||
"error": null,
|
||||
"date_include_time": null,
|
||||
"nullable": true,
|
||||
"date_show_tzinfo": null,
|
||||
"date_format": null,
|
||||
"date_force_timezone": null,
|
||||
"number_decimal_places": null,
|
||||
"date_time_format": null,
|
||||
"array_formula_type": "duration",
|
||||
"through_field_id": 4686,
|
||||
"through_field_name": "Related",
|
||||
"target_field_id": 4200,
|
||||
"target_field_name": "Duration"
|
||||
}
|
||||
],
|
||||
"views": [
|
||||
|
@ -745,7 +784,7 @@
|
|||
"bram@baserow.io"
|
||||
],
|
||||
"field_4697": "100.00",
|
||||
"field_4700": "1:23:45"
|
||||
"field_4700": "1:23:45"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -810,6 +849,14 @@
|
|||
"date_time_format": "24",
|
||||
"date_show_tzinfo": false,
|
||||
"date_force_timezone": null
|
||||
},
|
||||
{
|
||||
"id": 4200,
|
||||
"type": "duration",
|
||||
"name": "Duration",
|
||||
"order": 5,
|
||||
"primary": false,
|
||||
"duration_format": "h:mm:ss"
|
||||
}
|
||||
],
|
||||
"views": [
|
||||
|
@ -879,7 +926,8 @@
|
|||
"field_4684": "1",
|
||||
"field_4685": 2497,
|
||||
"field_4690": "true",
|
||||
"field_4692": "2023-10-01T19:12:41+00:00"
|
||||
"field_4692": "2023-10-01T19:12:41+00:00",
|
||||
"field_4200": "0:30:00"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
|
@ -890,7 +938,8 @@
|
|||
"field_4684": "2",
|
||||
"field_4685": 2498,
|
||||
"field_4690": "true",
|
||||
"field_4692": "2023-10-02T19:12:44+00:00"
|
||||
"field_4692": "2023-10-02T19:12:44+00:00",
|
||||
"field_4200": "1:00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "bug",
|
||||
"message": "Fix bug blocking grid view access after creating a lookup to a duration field.",
|
||||
"issue_number": 2333,
|
||||
"bullet_points": [],
|
||||
"created_at": "2024-02-06"
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import { DurationFieldType } from '@baserow/modules/database/fieldTypes'
|
||||
import { formatDurationValue } from '@baserow/modules/database/utils/duration'
|
||||
|
||||
/**
|
||||
* This mixin contains some method overrides for validating and formatting the
|
||||
|
@ -12,11 +13,6 @@ export default {
|
|||
formattedValue: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
fieldType() {
|
||||
return this.$registry.get('field', DurationFieldType.getType())
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
this.updateFormattedValue(this.field, value)
|
||||
|
@ -36,7 +32,9 @@ export default {
|
|||
return this.errorMsg
|
||||
},
|
||||
formatValue(field, value) {
|
||||
return this.fieldType.formatValue(field, value)
|
||||
// This function is used also in functional components,
|
||||
// so we cannot get the field type from the registry here.
|
||||
return formatDurationValue(value, field.duration_format)
|
||||
},
|
||||
updateFormattedValue(field, value) {
|
||||
this.formattedValue = this.formatValue(field, value)
|
||||
|
@ -46,7 +44,8 @@ export default {
|
|||
if (this.errorMsg !== null) {
|
||||
return
|
||||
}
|
||||
const newCopy = this.fieldType.parseInputValue(field, value)
|
||||
const fieldType = this.$registry.get('field', DurationFieldType.getType())
|
||||
const newCopy = fieldType.parseInputValue(field, value)
|
||||
if (newCopy !== this.copy) {
|
||||
this.copy = newCopy
|
||||
return newCopy
|
||||
|
|
Loading…
Add table
Reference in a new issue