mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* revert: undo unnecessary frontend changes fromf6a7d302fRevert all frontend changes introduced in "fix: bug in public view with hidden group by" (f6a7d302f). The backend changes from that commit are kept as they are the actual fix for the public view bug. The reverted frontend changes caused a regression where group bys would flicker (disappear and reappear) when changing the group by order, because activeGroupBys was being cleared at the start of every refresh. * fix: public view crash when group by is added or removed Add ViewType.forceViewRefresh() method that handles updating the view, fields, and (for grid views) activeGroupBys atomically during a force_view_refresh realtime event. This prevents components from accessing fields that have been removed or haven't been added yet. Also fix LinkRowFieldType.isEqual crashing with null/undefined values when rows have no linked items. * fix: inconsistency in counting hidden fields in grid view * fix issue deleting/restoring group bys
136 lines
3.4 KiB
Vue
136 lines
3.4 KiB
Vue
<template>
|
|
<div>
|
|
<a
|
|
ref="contextLink"
|
|
class="header__filter-link"
|
|
:class="{
|
|
'active active--error': hiddenFields.length > 0,
|
|
}"
|
|
@click="$refs.context.toggle($refs.contextLink, 'bottom', 'left', 4)"
|
|
>
|
|
<i class="header__filter-icon iconoir-eye-off"></i>
|
|
<span class="header__filter-name">{{
|
|
$t('gridViewHide.hideField', {
|
|
count: hiddenFields.length,
|
|
})
|
|
}}</span>
|
|
</a>
|
|
<ViewFieldsContext
|
|
ref="context"
|
|
:database="database"
|
|
:view="view"
|
|
:fields="fields"
|
|
:field-options="fieldOptions"
|
|
@update-all-field-options="updateAllFieldOptions"
|
|
@update-field-options-of-field="updateFieldOptionsOfField"
|
|
@update-order="orderFieldOptions"
|
|
></ViewFieldsContext>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { filterHiddenFieldsFunction } from '@baserow/modules/database/utils/view'
|
|
import { notifyIf } from '@baserow/modules/core/utils/error'
|
|
import ViewFieldsContext from '@baserow/modules/database/components/view/ViewFieldsContext'
|
|
|
|
export default {
|
|
name: 'GridViewHide',
|
|
components: { ViewFieldsContext },
|
|
props: {
|
|
database: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
fields: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
view: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
readOnly: {
|
|
type: Boolean,
|
|
required: true,
|
|
},
|
|
storePrefix: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
},
|
|
computed: {
|
|
hiddenFields() {
|
|
const isFieldHidden = filterHiddenFieldsFunction(this.fieldOptions)
|
|
return this.fields.filter((field) => isFieldHidden(field))
|
|
},
|
|
fieldOptions() {
|
|
return this.$store.getters[
|
|
this.storePrefix + 'view/grid/getAllFieldOptions'
|
|
]
|
|
},
|
|
},
|
|
methods: {
|
|
async updateAllFieldOptions({ newFieldOptions, oldFieldOptions }) {
|
|
try {
|
|
await this.$store.dispatch(
|
|
this.storePrefix + 'view/grid/updateAllFieldOptions',
|
|
{
|
|
newFieldOptions,
|
|
oldFieldOptions,
|
|
readOnly:
|
|
this.readOnly ||
|
|
!this.$hasPermission(
|
|
'database.table.view.update_field_options',
|
|
this.view,
|
|
this.database.workspace.id
|
|
),
|
|
}
|
|
)
|
|
} catch (error) {
|
|
notifyIf(error, 'view')
|
|
}
|
|
},
|
|
async updateFieldOptionsOfField({ field, values, oldValues }) {
|
|
try {
|
|
await this.$store.dispatch(
|
|
this.storePrefix + 'view/grid/updateFieldOptionsOfField',
|
|
{
|
|
field,
|
|
values,
|
|
oldValues,
|
|
readOnly:
|
|
this.readOnly ||
|
|
!this.$hasPermission(
|
|
'database.table.view.update_field_options',
|
|
this.view,
|
|
this.database.workspace.id
|
|
),
|
|
}
|
|
)
|
|
} catch (error) {
|
|
notifyIf(error, 'view')
|
|
}
|
|
},
|
|
async orderFieldOptions({ order }) {
|
|
try {
|
|
await this.$store.dispatch(
|
|
this.storePrefix + 'view/grid/updateFieldOptionsOrder',
|
|
{
|
|
order,
|
|
readOnly:
|
|
this.readOnly ||
|
|
!this.$hasPermission(
|
|
'database.table.view.update_field_options',
|
|
this.view,
|
|
this.database.workspace.id
|
|
),
|
|
}
|
|
)
|
|
} catch (error) {
|
|
notifyIf(error, 'view')
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|