Add support for viewV2 datasources in client library
This commit is contained in:
parent
dcf26dd0cb
commit
06810d43d9
|
@ -39,15 +39,33 @@
|
|||
tableId: m._id,
|
||||
type: "table",
|
||||
}))
|
||||
$: views = $tablesStore.list.reduce((acc, cur) => {
|
||||
let viewsArr = Object.entries(cur.views || {}).map(([key, value]) => ({
|
||||
label: key,
|
||||
name: key,
|
||||
...value,
|
||||
type: "view",
|
||||
}))
|
||||
return [...acc, ...viewsArr]
|
||||
}, [])
|
||||
$: viewsV1 = $tablesStore.list.reduce(
|
||||
(acc, table) => [
|
||||
...acc,
|
||||
...Object.values(table.views || {})
|
||||
.filter(view => view.version !== 2)
|
||||
.map(view => ({
|
||||
...view,
|
||||
label: view.name,
|
||||
type: "view",
|
||||
})),
|
||||
],
|
||||
[]
|
||||
)
|
||||
$: viewsV2 = $tablesStore.list.reduce(
|
||||
(acc, table) => [
|
||||
...acc,
|
||||
...Object.values(table.views || {})
|
||||
.filter(view => view.version === 2)
|
||||
.map(view => ({
|
||||
...view,
|
||||
label: view.name,
|
||||
type: "viewV2",
|
||||
})),
|
||||
],
|
||||
[]
|
||||
)
|
||||
$: views = [...(viewsV1 || []), ...(viewsV2 || [])]
|
||||
$: queries = $queriesStore.list
|
||||
.filter(q => showAllQueries || q.queryVerb === "read" || q.readable)
|
||||
.map(query => ({
|
||||
|
|
|
@ -6,6 +6,7 @@ import RelationshipFetch from "@budibase/frontend-core/src/fetch/RelationshipFet
|
|||
import NestedProviderFetch from "@budibase/frontend-core/src/fetch/NestedProviderFetch.js"
|
||||
import FieldFetch from "@budibase/frontend-core/src/fetch/FieldFetch.js"
|
||||
import JSONArrayFetch from "@budibase/frontend-core/src/fetch/JSONArrayFetch.js"
|
||||
import ViewV2Fetch from "@budibase/frontend-core/src/fetch/ViewV2Fetch.js"
|
||||
|
||||
/**
|
||||
* Fetches the schema of any kind of datasource.
|
||||
|
@ -21,6 +22,7 @@ export const fetchDatasourceSchema = async (
|
|||
const handler = {
|
||||
table: TableFetch,
|
||||
view: ViewFetch,
|
||||
viewV2: ViewV2Fetch,
|
||||
query: QueryFetch,
|
||||
link: RelationshipFetch,
|
||||
provider: NestedProviderFetch,
|
||||
|
|
|
@ -13,7 +13,7 @@ export default class ViewV2Fetch extends DataFetch {
|
|||
}
|
||||
}
|
||||
|
||||
async getSchema(datasource, definition) {
|
||||
getSchema(datasource, definition) {
|
||||
return definition?.schema
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue