Remove more usage of accumulators because they're evil
This commit is contained in:
parent
6c38eb5a4c
commit
02d2f9d875
|
@ -15,6 +15,8 @@
|
||||||
import {
|
import {
|
||||||
tables as tablesStore,
|
tables as tablesStore,
|
||||||
queries as queriesStore,
|
queries as queriesStore,
|
||||||
|
viewsV2 as viewsV2Store,
|
||||||
|
views as viewsStore,
|
||||||
} from "stores/backend"
|
} from "stores/backend"
|
||||||
import { datasources, integrations } from "stores/backend"
|
import { datasources, integrations } from "stores/backend"
|
||||||
import BindingBuilder from "components/integration/QueryBindingBuilder.svelte"
|
import BindingBuilder from "components/integration/QueryBindingBuilder.svelte"
|
||||||
|
@ -39,32 +41,16 @@
|
||||||
tableId: m._id,
|
tableId: m._id,
|
||||||
type: "table",
|
type: "table",
|
||||||
}))
|
}))
|
||||||
$: viewsV1 = $tablesStore.list.reduce(
|
$: viewsV1 = $viewsStore.list.map(view => ({
|
||||||
(acc, table) => [
|
|
||||||
...acc,
|
|
||||||
...Object.values(table.views || {})
|
|
||||||
.filter(view => view.version !== 2)
|
|
||||||
.map(view => ({
|
|
||||||
...view,
|
...view,
|
||||||
label: view.name,
|
label: view.name,
|
||||||
type: "view",
|
type: "view",
|
||||||
})),
|
}))
|
||||||
],
|
$: viewsV2 = $viewsV2Store.list.map(view => ({
|
||||||
[]
|
|
||||||
)
|
|
||||||
$: viewsV2 = $tablesStore.list.reduce(
|
|
||||||
(acc, table) => [
|
|
||||||
...acc,
|
|
||||||
...Object.values(table.views || {})
|
|
||||||
.filter(view => view.version === 2)
|
|
||||||
.map(view => ({
|
|
||||||
...view,
|
...view,
|
||||||
label: view.name,
|
label: view.name,
|
||||||
type: "viewV2",
|
type: "viewV2",
|
||||||
})),
|
}))
|
||||||
],
|
|
||||||
[]
|
|
||||||
)
|
|
||||||
$: views = [...(viewsV1 || []), ...(viewsV2 || [])]
|
$: 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)
|
||||||
|
|
Loading…
Reference in New Issue