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