Merge pull request #11346 from Budibase/fix/remove-unsupported-relationship-ux

Hide the 'Define Relationships' button when an integration does not support relationships
This commit is contained in:
Andrew Kingston 2023-07-25 16:12:33 +01:00 committed by GitHub
commit 8f859ccee4
1 changed files with 13 additions and 2 deletions

View File

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