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