Remove double checks

This commit is contained in:
Adria Navarro 2024-05-31 12:44:11 +02:00
parent 5444655237
commit 9ac462c390
3 changed files with 10 additions and 15 deletions

View File

@ -28,8 +28,7 @@
showAvatars={false}
on:updatedatasource={handleGridViewUpdate}
isCloud={$admin.cloud}
showReadonlyColumnsOptions
canSetReadonlyColumns={$licensing.isViewReadonlyColumnsEnabled}
allowViewReadonlyColumns={$licensing.isViewReadonlyColumnsEnabled}
>
<svelte:fragment slot="filter">
<GridFilterButton />

View File

@ -4,8 +4,7 @@
import { getColumnIcon } from "../lib/utils"
import ToggleActionButtonGroup from "./ToggleActionButtonGroup.svelte"
export let showReadonlyColumnsOptions = false
export let canSetReadonlyColumns = false
export let allowViewReadonlyColumns = false
const { columns, datasource, stickyColumn, dispatch } = getContext("grid")
@ -43,10 +42,10 @@
$: READONLY_OPTION = {
icon: "Visibility",
value: PERMISSION_OPTIONS.READONLY,
tooltip: canSetReadonlyColumns
tooltip: allowViewReadonlyColumns
? "Read only"
: "Read only (premium feature)",
disabled: !canSetReadonlyColumns,
disabled: !allowViewReadonlyColumns,
}
const HIDDEN_OPTION = {
icon: "VisibilityOff",
@ -54,7 +53,8 @@
tooltip: "Hidden",
}
$: options = showReadonlyColumnsOptions
$: options =
$datasource.type === "viewV2"
? [EDIT_OPTION, READONLY_OPTION, HIDDEN_OPTION]
: [EDIT_OPTION, HIDDEN_OPTION]

View File

@ -57,8 +57,7 @@
export let buttons = null
export let darkMode
export let isCloud = null
export let showReadonlyColumnsOptions = false
export let canSetReadonlyColumns = false
export let allowViewReadonlyColumns = false
// Unique identifier for DOM nodes inside this instance
const gridID = `grid-${Math.random().toString().slice(2)}`
@ -155,10 +154,7 @@
<div class="controls-left">
<slot name="filter" />
<SortButton />
<ColumnsSettingButton
{showReadonlyColumnsOptions}
{canSetReadonlyColumns}
/>
<ColumnsSettingButton {allowViewReadonlyColumns} />
<SizeButton />
<slot name="controls" />
</div>