-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
254 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
apps/frontend/src/lib/components/blocks/dashboard/dashboard-widget-table.gql
This file was deleted.
Oops, something went wrong.
24 changes: 18 additions & 6 deletions
24
apps/frontend/src/lib/components/blocks/dashboard/dashboard-widget.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,45 @@ | ||
<script lang="ts"> | ||
import { TableFactory, type IWidgetDTO } from "@undb/table" | ||
import { GetDashboardWidgetShareTableStore, GetDashboardWidgetTableStore } from "$houdini" | ||
import { GetDashboardWidgetShareTableStore } from "$houdini" | ||
import Widget from "../widget/widget.svelte" | ||
import { setTable } from "$lib/store/table.store" | ||
import { writable } from "svelte/store" | ||
import { getIsLocal } from "$lib/store/data-service.store" | ||
import { getDataService } from "$lib/store/data-service.store" | ||
import { createQuery } from "@tanstack/svelte-query" | ||
export let tableId: string | undefined | ||
export let shareId: string | undefined = undefined | ||
export let readonly = false | ||
export let widget: IWidgetDTO | ||
export let movePointerDown: ((e: Event) => void) | undefined = undefined | ||
export let resizePointerDown: ((e: Event) => void) | undefined = undefined | ||
const store = new GetDashboardWidgetTableStore() | ||
const isLocal = getIsLocal() | ||
const shareStore = new GetDashboardWidgetShareTableStore() | ||
$: if (tableId) { | ||
if (shareId) { | ||
shareStore.fetch({ variables: { shareId, tableId } }) | ||
} else { | ||
store.fetch({ variables: { tableId } }) | ||
} | ||
} | ||
$: table = shareId ? $shareStore.data?.tableByShareDashboard : $store.data?.table | ||
const getTable = createQuery({ | ||
queryFn: async () => { | ||
const dataService = await getDataService(isLocal) | ||
return dataService.table.getTable({ tableId: tableId! }) | ||
}, | ||
queryKey: ["dashboard-widget-table", tableId], | ||
enabled: !!tableId && !shareId, | ||
}) | ||
$: table = shareId ? $shareStore.data?.tableByShareDashboard : $getTable.data | ||
$: tableDo = table ? new TableFactory().fromJSON(table) : undefined | ||
$: if (tableDo) { | ||
setTable(writable(tableDo)) | ||
} | ||
</script> | ||
|
||
<Widget table={tableDo} {widget} {tableId} {shareId} {movePointerDown} {resizePointerDown} /> | ||
<Widget table={tableDo} {widget} {tableId} {shareId} {movePointerDown} {resizePointerDown} {readonly} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,6 @@ | |
<ShareViewButton /> | ||
{/if} | ||
<RecordsSearch /> | ||
<ViewWidgetButton /> | ||
<ViewWidgetButton {readonly} /> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.