improve database.select performance

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-19 13:51:21 +01:00
parent b12b6b39b5
commit 1462d8dd55
3 changed files with 9 additions and 119 deletions

View File

@ -22,14 +22,15 @@ export const getBackendUiStore = () => {
reset: () => store.set({ ...INITIAL_BACKEND_UI_STATE }), reset: () => store.set({ ...INITIAL_BACKEND_UI_STATE }),
database: { database: {
select: async db => { select: async db => {
const tablesResponse = await api.get(`/api/tables`) const [tables, datasources, queries, integrations] = await Promise.all([
const tables = await tablesResponse.json() api.get(`/api/tables`).then(r => r.json()),
const datasourcesResponse = await api.get(`/api/datasources`) api.get(`/api/datasources`).then(r => r.json()),
const datasources = await datasourcesResponse.json() api.get(`/api/queries`).then(r => r.json()),
const queriesResponse = await api.get(`/api/queries`) api.get("/api/integrations").then(r => r.json())
const queries = await queriesResponse.json() ])
const integrationsResponse = await api.get("/api/integrations")
const integrations = await integrationsResponse.json() console.log(tables)
const permissionLevels = await store.actions.permissions.fetchLevels() const permissionLevels = await store.actions.permissions.fetchLevels()
store.update(state => { store.update(state => {

View File

@ -1,111 +0,0 @@
export const componentsAndScreens = () => ({
components: [
{
_instanceName: "TextBox",
tags: ["Text", "input"],
children: false,
props: {
size: { type: "options", options: ["small", "medium", "large"] },
isPassword: "bool",
placeholder: "string",
label: "string",
},
},
{
_instanceName: "Button",
tags: ["input"],
children: true,
props: {
size: { type: "options", options: ["small", "medium", "large"] },
css: "string",
contentText: "string",
},
},
{
_instanceName: "div",
tags: ["input"],
props: {
width: "number",
},
},
{
_instanceName: "Row View",
tags: ["row"],
props: {
data: "state",
},
},
],
screens: [
{
props: {
_component: "budibase-components/TextBox",
_instanceName: "SmallTextbox",
size: "small",
},
},
{
name: "common/PasswordBox",
tags: ["mask"],
props: {
_component: "budibase-components/TextBox",
_instanceName: "PasswordBox",
isPassword: true,
size: "small",
},
},
{
props: {
_component: "budibase-components/Button",
_instanceName: "PrimaryButton",
css: "btn-primary",
},
},
{
route: "",
props: {
_component: "budibase-components/div",
width: 100,
_instanceName: "Screen 1",
_children: [
{
_component: "budibase-components/Button",
contentText: "Button 1",
_instanceName: "Button 1",
},
{
_component: "budibase-components/Button",
contentText: "Button 2",
_instanceName: "Button 2",
},
{
_component: "budibase-components/TextBox",
_instanceName: "TextBox",
isPassword: true,
size: "small",
},
],
},
},
{
props: {
_component: "budibase-components/div",
_instanceName: "Field",
_children: [
{
_component: "common/SmallTextbox",
},
],
},
},
],
})
export const stripStandardProps = props => {
delete props._id
delete props._styles
}