1
0
Fork 0
mirror of synced 2024-10-03 19:43:32 +13:00

Remove the define relationship button in the datatable when relationships are unsupported

This commit is contained in:
Dean 2023-07-25 11:46:22 +01:00
parent 02c538c315
commit e8dd3f9d90

View file

@ -1,5 +1,5 @@
<script>
import { datasources, tables } from "stores/backend"
import { datasources, tables, integrations } from "stores/backend"
import EditRolesButton from "./buttons/EditRolesButton.svelte"
import { TableNames } from "constants"
import { Grid } from "@budibase/frontend-core"
@ -27,6 +27,17 @@
$: isUsersTable = id === TableNames.USERS
$: isInternal = $tables.selected?.type !== "external"
$: datasource = $datasources.list.find(datasource => {
return datasource._id === $tables.selected.sourceId
})
const relationshipSupport = datasource => {
const integration = $integrations[datasource?.source]
return !isInternal && integration?.relationships !== false
}
$: relationshipsEnabled = relationshipSupport(datasource)
const handleGridTableUpdate = async e => {
tables.replaceTable(id, e.detail)
@ -58,7 +69,7 @@
<GridCreateViewButton />
{/if}
<GridManageAccessButton />
{#if !isInternal}
{#if relationshipsEnabled}
<GridRelationshipButton />
{/if}
{#if isUsersTable}