forked from tsai/budibase
23 changed files with 239 additions and 2959 deletions
@ -0,0 +1,14 @@ |
|||||
|
<script> |
||||
|
import { Body } from "@budibase/bbui" |
||||
|
</script> |
||||
|
|
||||
|
<div class="root"> |
||||
|
<Body size="S">This action doesn't require any additional settings.</Body> |
||||
|
</div> |
||||
|
|
||||
|
<style> |
||||
|
.root { |
||||
|
max-width: 800px; |
||||
|
margin: 0 auto; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,62 @@ |
|||||
|
<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> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<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 /> |
||||
File diff suppressed because it is too large
@ -1,5 +1,5 @@ |
|||||
const postgres = require("./postgres") |
const postgres = require("./postgres") |
||||
|
|
||||
module.exports = { |
module.exports = { |
||||
postgres, |
POSTGRES_PLUS: postgres, |
||||
} |
} |
||||
|
|||||
File diff suppressed because it is too large
Loading…
Reference in new issue