Skip to content

Commit

Permalink
Pass tableType
Browse files Browse the repository at this point in the history
  • Loading branch information
melohagan committed May 12, 2023
1 parent 99ef8be commit 2d543d9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
status: { name: "Status", disabled: true },
}
$: table = $tables.selected
$: isUsersTable = table?._id === TableNames.USERS
$: isInternal = table?.type !== "external"
$: id = $tables.selected?._id
$: isUsersTable = id === TableNames.USERS
$: isInternal = $tables.selected?.type !== "external"
</script>
<div class="wrapper">
<Grid
{API}
{table}
tableId={id}
tableType={$tables.selected?.type}
allowAddRows={!isUsersTable}
allowDeleteRows={!isUsersTable}
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { ActionButton, Modal } from "@budibase/bbui"
import ImportModal from "../modals/ImportModal.svelte"
export let table
export let tableId
export let tableType
export let disabled
let modal
Expand All @@ -12,5 +13,5 @@
Import
</ActionButton>
<Modal bind:this={modal}>
<ImportModal tableId={table?._id} tableType={table?.type} on:importrows />
<ImportModal {tableId} {tableType} on:importrows />
</Modal>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
export let disabled = false
const { rows, tableId } = getContext("grid")
const { rows, tableId, tableType } = getContext("grid")
</script>

<ImportButton
{disabled}
tableId={$tableId}
{tableType}
on:importrows={rows.actions.refreshData}
/>
8 changes: 5 additions & 3 deletions packages/frontend-core/src/components/grid/layout/Grid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
} from "../lib/constants"
export let API = null
export let table = null
export let tableId = null
export let tableType = null
export let schemaOverrides = null
export let allowAddRows = true
export let allowAddColumns = true
Expand All @@ -45,7 +46,7 @@
const rand = Math.random()
// State stores
const tableIdStore = writable(table?._id)
const tableIdStore = writable(tableId)
const schemaOverridesStore = writable(schemaOverrides)
const config = writable({
allowAddRows,
Expand All @@ -62,6 +63,7 @@
rand,
config,
tableId: tableIdStore,
tableType,
schemaOverrides: schemaOverridesStore,
}
context = { ...context, ...createEventManagers() }
Expand All @@ -79,7 +81,7 @@
} = context
// Keep stores up to date
$: tableIdStore.set(table?._id)
$: tableIdStore.set(tableId)
$: schemaOverridesStore.set(schemaOverrides)
$: config.set({
allowAddRows,
Expand Down

0 comments on commit 2d543d9

Please sign in to comment.