This commit is contained in:
Adria Navarro 2023-07-19 11:06:59 +02:00
parent a9cb838847
commit 16764e6634
2 changed files with 32 additions and 4 deletions

View File

@ -0,0 +1,28 @@
<script>
import { views } from "stores/backend"
import { syncURLToState } from "helpers/urlStateSync"
import * as routify from "@roxi/routify"
import { onDestroy } from "svelte"
import { store } from "builderStore"
$: viewName = $views.selectedViewName
$: store.actions.websocket.selectResource(viewName)
const stopSyncing = syncURLToState({
urlParam: "id",
stateKey: "selectedViewId",
validate: id => $views.list?.some(view => view._id === id),
update: id => {
const view = $views.list.find(v => v._id === id)
views.select(view.name)
},
fallbackUrl: "../",
store: views,
routify,
decode: decodeURIComponent,
})
onDestroy(stopSyncing)
</script>
<slot />

View File

@ -1,15 +1,15 @@
<script> <script>
import { views } from "stores/backend"
import { Grid } from "@budibase/frontend-core"
import { API } from "api" import { API } from "api"
import { Grid } from "@budibase/frontend-core"
import { views } from "stores/backend"
export let id $: selectedView = $views.selected
</script> </script>
<div class="wrapper"> <div class="wrapper">
<Grid <Grid
{API} {API}
tableId={id} tableId={selectedView?._id}
datasourceType="viewV2" datasourceType="viewV2"
showAvatars={false} showAvatars={false}
showControls={false} showControls={false}