restore page structure back to selected datasource

This commit is contained in:
Martin McKeaveney 2021-06-11 17:53:55 +01:00
parent 114eac4134
commit b546faab15
5 changed files with 1 additions and 76 deletions

View File

@ -17,7 +17,7 @@
return
}
queries.select(query)
$goto(`./datasource/${query.datasourceId}/query/${query._id}`)
$goto(`./datasource/${query.datasourceId}/${query._id}`)
}
onMount(() => {

View File

@ -1,13 +0,0 @@
<script>
import { params } from "@roxi/routify"
import { queries } from "stores/backend"
if ($params.query) {
const query = $queries.list.find(m => m._id === $params.query)
if (query) {
queries.select(query)
}
}
</script>
<slot />

View File

@ -1,62 +0,0 @@
<script>
import { params } from "@roxi/routify"
import { notifications } from "@budibase/bbui"
import { database, queries } from "stores/backend"
import api from "builderStore/api"
import Table from "components/backend/DataTable/Table.svelte"
let loading = false
let data = []
let schema = {}
async function fetchData() {
try {
const query = {
endpoint: {
datasourceId: $params.selectedDatasource,
operation: "READ",
// table name below
entityId: $params.entity,
},
resource: {
// fields: ["name", "age"],
},
filters: {
// string: {
// name: "John",
// },
},
}
const response = await api.post(`/api/datasources/query`, query)
const json = await response.json()
console.log(json)
} catch (err) {
notifications.error("Error fetching data")
console.error(err)
}
}
// $: selectedQuery = $queries.list.find(
// query => query._id === $queries.selected
// ) || {
// datasourceId: $params.selectedDatasource,
// parameters: [],
// fields: {},
// queryVerb: "read",
// }
fetchData()
</script>
<section>
<Table
{title}
{schema}
{data}
allowEditing={true}
{loading}
/>
</section>
<style>
</style>