Lock readonly

This commit is contained in:
Adria Navarro 2024-05-30 11:07:30 +02:00
parent 1dd5c67392
commit 8e72f1f0fa
2 changed files with 14 additions and 2 deletions

View File

@ -138,6 +138,11 @@ export const createLicensingStore = () => {
const isViewPermissionsEnabled = license.features.includes( const isViewPermissionsEnabled = license.features.includes(
Constants.Features.VIEW_PERMISSIONS Constants.Features.VIEW_PERMISSIONS
) )
const isViewReadonlyColumnsEnabled = license.features.includes(
Constants.Features.VIEW_READONLY_COLUMNS
)
store.update(state => { store.update(state => {
return { return {
...state, ...state,
@ -157,6 +162,7 @@ export const createLicensingStore = () => {
triggerAutomationRunEnabled, triggerAutomationRunEnabled,
isViewPermissionsEnabled, isViewPermissionsEnabled,
perAppBuildersEnabled, perAppBuildersEnabled,
isViewReadonlyColumnsEnabled,
} }
}) })
}, },

View File

@ -1,6 +1,7 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import { ActionButton, Popover, Icon, notifications } from "@budibase/bbui" import { ActionButton, Popover, Icon, notifications } from "@budibase/bbui"
import { licensing } from "stores/portal"
import { getColumnIcon } from "../lib/utils" import { getColumnIcon } from "../lib/utils"
import ToggleActionButtonGroup from "./ToggleActionButtonGroup.svelte" import ToggleActionButtonGroup from "./ToggleActionButtonGroup.svelte"
@ -32,6 +33,8 @@
return hidden ? `Columns (${hidden} restricted)` : "Columns" return hidden ? `Columns (${hidden} restricted)` : "Columns"
} }
$: isViewReadonlyColumnsEnabled = $licensing.isViewReadonlyColumnsEnabled
const PERMISSION_OPTIONS = { const PERMISSION_OPTIONS = {
WRITABLE: "writable", WRITABLE: "writable",
READONLY: "readonly", READONLY: "readonly",
@ -43,10 +46,13 @@
value: PERMISSION_OPTIONS.WRITABLE, value: PERMISSION_OPTIONS.WRITABLE,
tooltip: "Writable", tooltip: "Writable",
} }
const READONLY_OPTION = { $: READONLY_OPTION = {
icon: "Visibility", icon: "Visibility",
value: PERMISSION_OPTIONS.READONLY, value: PERMISSION_OPTIONS.READONLY,
tooltip: "Read only", tooltip: isViewReadonlyColumnsEnabled
? "Read only"
: "Read only (premium feature)",
disabled: !isViewReadonlyColumnsEnabled,
} }
const HIDDEN_OPTION = { const HIDDEN_OPTION = {
icon: "VisibilityOff", icon: "VisibilityOff",