Update grid flags to allow readonly modifications of schema
This commit is contained in:
parent
f9a8be507d
commit
5820996e4d
|
@ -21,9 +21,8 @@
|
|||
{allowEditRows}
|
||||
{allowDeleteRows}
|
||||
showControls={false}
|
||||
allowAddColumns={false}
|
||||
allowEditColumns={false}
|
||||
allowExpandRows={false}
|
||||
allowSchemaChanges={false}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
<MenuItem
|
||||
icon="Edit"
|
||||
on:click={editColumn}
|
||||
disabled={!$config.allowEditColumns || column.schema.disabled}
|
||||
disabled={!$config.allowSchemaChanges || column.schema.disabled}
|
||||
>
|
||||
Edit column
|
||||
</MenuItem>
|
||||
|
@ -171,7 +171,7 @@
|
|||
icon="Label"
|
||||
on:click={makeDisplayColumn}
|
||||
disabled={idx === "sticky" ||
|
||||
!$config.allowEditColumns ||
|
||||
!$config.allowSchemaChanges ||
|
||||
bannedDisplayColumnTypes.includes(column.schema.type)}
|
||||
>
|
||||
Use as display column
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
quiet
|
||||
size="M"
|
||||
on:click={() => dispatch("add-column")}
|
||||
disabled={!$config.allowAddColumns}
|
||||
disabled={!$config.allowSchemaChanges}
|
||||
>
|
||||
Add column
|
||||
</ActionButton>
|
||||
|
|
|
@ -35,11 +35,10 @@
|
|||
export let tableId = null
|
||||
export let schemaOverrides = null
|
||||
export let allowAddRows = true
|
||||
export let allowAddColumns = true
|
||||
export let allowEditColumns = true
|
||||
export let allowExpandRows = true
|
||||
export let allowEditRows = true
|
||||
export let allowDeleteRows = true
|
||||
export let allowSchemaChanges = true
|
||||
export let stripeRows = false
|
||||
export let collaboration = true
|
||||
export let showAvatars = true
|
||||
|
@ -53,8 +52,7 @@
|
|||
const schemaOverridesStore = writable(schemaOverrides)
|
||||
const config = writable({
|
||||
allowAddRows,
|
||||
allowAddColumns,
|
||||
allowEditColumns,
|
||||
allowSchemaChanges,
|
||||
allowExpandRows,
|
||||
allowEditRows,
|
||||
allowDeleteRows,
|
||||
|
@ -88,8 +86,7 @@
|
|||
$: schemaOverridesStore.set(schemaOverrides)
|
||||
$: config.set({
|
||||
allowAddRows,
|
||||
allowAddColumns,
|
||||
allowEditColumns,
|
||||
allowSchemaChanges,
|
||||
allowExpandRows,
|
||||
allowEditRows,
|
||||
allowDeleteRows,
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{/each}
|
||||
</div>
|
||||
</GridScrollWrapper>
|
||||
{#if $config.allowAddColumns}
|
||||
{#if $config.allowSchemaChanges}
|
||||
<div
|
||||
class="add"
|
||||
style="left:{left}px"
|
||||
|
|
|
@ -46,7 +46,7 @@ export const createStores = () => {
|
|||
}
|
||||
|
||||
export const deriveStores = context => {
|
||||
const { table, columns, stickyColumn, API, dispatch } = context
|
||||
const { table, columns, stickyColumn, API, dispatch, config } = context
|
||||
|
||||
// Updates the tables primary display column
|
||||
const changePrimaryDisplay = async column => {
|
||||
|
@ -95,7 +95,9 @@ export const deriveStores = context => {
|
|||
dispatch("updatetable", newTable)
|
||||
|
||||
// Update server
|
||||
await API.saveTable(newTable)
|
||||
if (get(config).allowSchemaChanges) {
|
||||
await API.saveTable(newTable)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue