Move licence check out of frontend-core
This commit is contained in:
parent
6ce0b3c368
commit
4dbfa28feb
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { viewsV2 } from "stores/builder"
|
import { viewsV2 } from "stores/builder"
|
||||||
import { admin } from "stores/portal"
|
import { admin, licensing } from "stores/portal"
|
||||||
import { Grid } from "@budibase/frontend-core"
|
import { Grid } from "@budibase/frontend-core"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
||||||
|
@ -28,7 +28,8 @@
|
||||||
showAvatars={false}
|
showAvatars={false}
|
||||||
on:updatedatasource={handleGridViewUpdate}
|
on:updatedatasource={handleGridViewUpdate}
|
||||||
isCloud={$admin.cloud}
|
isCloud={$admin.cloud}
|
||||||
allowReadonlyColumns
|
showReadonlyColumnsOptions
|
||||||
|
canSetReadonlyColumns={$licensing.isViewReadonlyColumnsEnabled}
|
||||||
>
|
>
|
||||||
<svelte:fragment slot="filter">
|
<svelte:fragment slot="filter">
|
||||||
<GridFilterButton />
|
<GridFilterButton />
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<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"
|
||||||
|
|
||||||
export let allowReadonlyColumns = false
|
export let showReadonlyColumnsOptions = false
|
||||||
|
export let canSetReadonlyColumns = false
|
||||||
|
|
||||||
const { columns, datasource, stickyColumn, dispatch } = getContext("grid")
|
const { columns, datasource, stickyColumn, dispatch } = getContext("grid")
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@
|
||||||
return restricted ? `Columns (${restricted} restricted)` : "Columns"
|
return restricted ? `Columns (${restricted} restricted)` : "Columns"
|
||||||
}
|
}
|
||||||
|
|
||||||
$: isViewReadonlyColumnsEnabled = $licensing.isViewReadonlyColumnsEnabled
|
|
||||||
|
|
||||||
const PERMISSION_OPTIONS = {
|
const PERMISSION_OPTIONS = {
|
||||||
WRITABLE: "writable",
|
WRITABLE: "writable",
|
||||||
READONLY: "readonly",
|
READONLY: "readonly",
|
||||||
|
@ -51,10 +49,10 @@
|
||||||
$: READONLY_OPTION = {
|
$: READONLY_OPTION = {
|
||||||
icon: "Visibility",
|
icon: "Visibility",
|
||||||
value: PERMISSION_OPTIONS.READONLY,
|
value: PERMISSION_OPTIONS.READONLY,
|
||||||
tooltip: isViewReadonlyColumnsEnabled
|
tooltip: canSetReadonlyColumns
|
||||||
? "Read only"
|
? "Read only"
|
||||||
: "Read only (premium feature)",
|
: "Read only (premium feature)",
|
||||||
disabled: !isViewReadonlyColumnsEnabled,
|
disabled: !canSetReadonlyColumns,
|
||||||
}
|
}
|
||||||
const HIDDEN_OPTION = {
|
const HIDDEN_OPTION = {
|
||||||
icon: "VisibilityOff",
|
icon: "VisibilityOff",
|
||||||
|
@ -62,7 +60,7 @@
|
||||||
tooltip: "Hidden",
|
tooltip: "Hidden",
|
||||||
}
|
}
|
||||||
|
|
||||||
$: options = allowReadonlyColumns
|
$: options = showReadonlyColumnsOptions
|
||||||
? [EDIT_OPTION, READONLY_OPTION, HIDDEN_OPTION]
|
? [EDIT_OPTION, READONLY_OPTION, HIDDEN_OPTION]
|
||||||
: [EDIT_OPTION, HIDDEN_OPTION]
|
: [EDIT_OPTION, HIDDEN_OPTION]
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,8 @@
|
||||||
export let buttons = null
|
export let buttons = null
|
||||||
export let darkMode
|
export let darkMode
|
||||||
export let isCloud = null
|
export let isCloud = null
|
||||||
export let allowReadonlyColumns = false
|
export let showReadonlyColumnsOptions = false
|
||||||
|
export let canSetReadonlyColumns = false
|
||||||
|
|
||||||
// Unique identifier for DOM nodes inside this instance
|
// Unique identifier for DOM nodes inside this instance
|
||||||
const gridID = `grid-${Math.random().toString().slice(2)}`
|
const gridID = `grid-${Math.random().toString().slice(2)}`
|
||||||
|
@ -154,7 +155,10 @@
|
||||||
<div class="controls-left">
|
<div class="controls-left">
|
||||||
<slot name="filter" />
|
<slot name="filter" />
|
||||||
<SortButton />
|
<SortButton />
|
||||||
<ColumnsSettingButton {allowReadonlyColumns} />
|
<ColumnsSettingButton
|
||||||
|
{showReadonlyColumnsOptions}
|
||||||
|
{canSetReadonlyColumns}
|
||||||
|
/>
|
||||||
<SizeButton />
|
<SizeButton />
|
||||||
<slot name="controls" />
|
<slot name="controls" />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue