Disable row import button for users table and add optional chaining to spreadsheetsocket invocations to fix tests
This commit is contained in:
parent
d331072f9a
commit
91ee5be7c5
|
@ -39,9 +39,7 @@
|
||||||
{#if !isInternal}
|
{#if !isInternal}
|
||||||
<SheetRelationshipButton />
|
<SheetRelationshipButton />
|
||||||
{/if}
|
{/if}
|
||||||
{#if !isUsersTable}
|
<SheetImportButton disabled={isUsersTable} />
|
||||||
<SheetImportButton />
|
|
||||||
{/if}
|
|
||||||
<SheetExportButton />
|
<SheetExportButton />
|
||||||
<SheetFilterButton />
|
<SheetFilterButton />
|
||||||
<SheetAddColumnModal />
|
<SheetAddColumnModal />
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
import ImportButton from "../ImportButton.svelte"
|
import ImportButton from "../ImportButton.svelte"
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
|
|
||||||
|
export let disabled = false
|
||||||
|
|
||||||
const { rows, tableId } = getContext("sheet")
|
const { rows, tableId } = getContext("sheet")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ImportButton tableId={$tableId} on:importrows={rows.actions.refreshData} />
|
<ImportButton
|
||||||
|
{disabled}
|
||||||
|
tableId={$tableId}
|
||||||
|
on:importrows={rows.actions.refreshData}
|
||||||
|
/>
|
||||||
|
|
|
@ -50,7 +50,7 @@ export async function patch(ctx: any): Promise<any> {
|
||||||
ctx.body = row
|
ctx.body = row
|
||||||
|
|
||||||
// Notify websocket change
|
// Notify websocket change
|
||||||
spreadsheetSocket.emit("row-update", { id: row._id })
|
spreadsheetSocket?.emit("row-update", { id: row._id })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(400, err)
|
ctx.throw(400, err)
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ export const save = async (ctx: any) => {
|
||||||
ctx.body = row
|
ctx.body = row
|
||||||
|
|
||||||
// Notify websocket change
|
// Notify websocket change
|
||||||
spreadsheetSocket.emit("row-update", { id: row._id })
|
spreadsheetSocket?.emit("row-update", { id: row._id })
|
||||||
}
|
}
|
||||||
export async function fetchView(ctx: any) {
|
export async function fetchView(ctx: any) {
|
||||||
const tableId = getTableId(ctx)
|
const tableId = getTableId(ctx)
|
||||||
|
@ -115,7 +115,7 @@ export async function destroy(ctx: any) {
|
||||||
for (let row of rows) {
|
for (let row of rows) {
|
||||||
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row)
|
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row)
|
||||||
// Notify websocket change
|
// Notify websocket change
|
||||||
spreadsheetSocket.emit("row-update", { id: row._id })
|
spreadsheetSocket?.emit("row-update", { id: row._id })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let resp = await quotas.addQuery(() => pickApi(tableId).destroy(ctx), {
|
let resp = await quotas.addQuery(() => pickApi(tableId).destroy(ctx), {
|
||||||
|
@ -126,7 +126,7 @@ export async function destroy(ctx: any) {
|
||||||
row = resp.row
|
row = resp.row
|
||||||
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row)
|
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row)
|
||||||
// Notify websocket change
|
// Notify websocket change
|
||||||
spreadsheetSocket.emit("row-update", { id: row._id })
|
spreadsheetSocket?.emit("row-update", { id: row._id })
|
||||||
}
|
}
|
||||||
ctx.status = 200
|
ctx.status = 200
|
||||||
// for automations include the row that was deleted
|
// for automations include the row that was deleted
|
||||||
|
|
Loading…
Reference in New Issue