Flag checks on frontend
This commit is contained in:
parent
5f40737e9c
commit
8a2bc639ea
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { datasources, tables, integrations, appStore } from "stores/builder"
|
||||
import { themeStore, admin } from "stores/portal"
|
||||
import { themeStore, admin, licensing } from "stores/portal"
|
||||
import EditRolesButton from "./buttons/EditRolesButton.svelte"
|
||||
import { TableNames } from "constants"
|
||||
import { Grid } from "@budibase/frontend-core"
|
||||
|
@ -18,6 +18,8 @@
|
|||
import GridEditColumnModal from "components/backend/DataTable/modals/grid/GridEditColumnModal.svelte"
|
||||
import GridUsersTableButton from "components/backend/DataTable/modals/grid/GridUsersTableButton.svelte"
|
||||
import { DB_TYPE_EXTERNAL } from "constants/backend"
|
||||
import { isEnabled } from "helpers/featureFlags"
|
||||
import { FeatureFlag } from "@budibase/types"
|
||||
|
||||
const userSchemaOverrides = {
|
||||
firstName: { displayName: "First name", disabled: true },
|
||||
|
@ -66,6 +68,7 @@
|
|||
canDeleteRows={!isUsersTable}
|
||||
canEditRows={!isUsersTable || !$appStore.features.disableUserMetadata}
|
||||
canEditColumns={!isUsersTable || !$appStore.features.disableUserMetadata}
|
||||
canSetRelationshipSchemas={isEnabled(FeatureFlag.ENRICHED_RELATIONSHIPS)}
|
||||
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
|
||||
showAvatars={false}
|
||||
on:updatedatasource={handleGridTableUpdate}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
||||
import GridFilterButton from "components/backend/DataTable/buttons/grid/GridFilterButton.svelte"
|
||||
import GridManageAccessButton from "components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte"
|
||||
import { isEnabled } from "helpers/featureFlags"
|
||||
import { FeatureFlag } from "@budibase/types"
|
||||
|
||||
$: id = $viewsV2.selected?.id
|
||||
$: datasource = {
|
||||
|
@ -29,6 +31,7 @@
|
|||
on:updatedatasource={handleGridViewUpdate}
|
||||
isCloud={$admin.cloud}
|
||||
allowViewReadonlyColumns={$licensing.isViewReadonlyColumnsEnabled}
|
||||
canSetRelationshipSchemas={isEnabled(FeatureFlag.ENRICHED_RELATIONSHIPS)}
|
||||
>
|
||||
<svelte:fragment slot="filter">
|
||||
<GridFilterButton />
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
export let columns
|
||||
export let fromRelationshipField
|
||||
|
||||
const { datasource, dispatch, cache } = getContext("grid")
|
||||
const { datasource, dispatch, cache, config } = getContext("grid")
|
||||
|
||||
$: canSetRelationshipSchemas = $config.canSetRelationshipSchemas
|
||||
|
||||
let relationshipPanelAnchor
|
||||
let relationshipFieldName
|
||||
|
@ -30,8 +32,6 @@
|
|||
{}
|
||||
)
|
||||
|
||||
$: allowRelationshipSchemas = true // TODO
|
||||
|
||||
$: displayColumns = columns.map(c => {
|
||||
const isRequired =
|
||||
c.primaryDisplay || helpers.schema.isRequired(c.schema.constraints)
|
||||
|
@ -196,7 +196,7 @@
|
|||
value={columnToPermissionOptions(column)}
|
||||
options={column.options}
|
||||
/>
|
||||
{#if allowRelationshipSchemas && column.schema.type === FieldType.LINK && columnToPermissionOptions(column) !== FieldPermissions.HIDDEN}
|
||||
{#if canSetRelationshipSchemas && column.schema.type === FieldType.LINK && columnToPermissionOptions(column) !== FieldPermissions.HIDDEN}
|
||||
<div class="relationship-columns">
|
||||
<ActionButton
|
||||
on:click={e => {
|
||||
|
@ -214,7 +214,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{#if allowRelationshipSchemas}
|
||||
{#if canSetRelationshipSchemas}
|
||||
<Popover
|
||||
on:close={() => (relationshipFieldName = null)}
|
||||
open={relationshipFieldName}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
export let canDeleteRows = true
|
||||
export let canEditColumns = true
|
||||
export let canSaveSchema = true
|
||||
export let canSetRelationshipSchemas = false
|
||||
export let stripeRows = false
|
||||
export let quiet = false
|
||||
export let collaboration = true
|
||||
|
@ -99,6 +100,7 @@
|
|||
canDeleteRows,
|
||||
canEditColumns,
|
||||
canSaveSchema,
|
||||
canSetRelationshipSchemas,
|
||||
stripeRows,
|
||||
quiet,
|
||||
collaboration,
|
||||
|
|
Loading…
Reference in New Issue