lint fix
This commit is contained in:
parent
8f0324bd53
commit
976d8b3b54
|
@ -1,7 +1,10 @@
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import { tables as tablesStore, queries as queriesStores } from 'builderStore/store/backend/'
|
import {
|
||||||
|
tables as tablesStore,
|
||||||
|
queries as queriesStores,
|
||||||
|
} from "builderStore/store/backend/"
|
||||||
import { findComponentPath } from "./storeUtils"
|
import { findComponentPath } from "./storeUtils"
|
||||||
import { makePropSafe } from "@budibase/string-templates"
|
import { makePropSafe } from "@budibase/string-templates"
|
||||||
import { TableNames } from "../constants"
|
import { TableNames } from "../constants"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
|
|
||||||
const INITIAL_BACKEND_UI_STATE = {
|
const INITIAL_BACKEND_UI_STATE = {}
|
||||||
}
|
|
||||||
|
|
||||||
export const getBackendUiStore = () => {
|
export const getBackendUiStore = () => {
|
||||||
const store = writable({ ...INITIAL_BACKEND_UI_STATE })
|
const store = writable({ ...INITIAL_BACKEND_UI_STATE })
|
||||||
|
|
|
@ -20,7 +20,7 @@ function createDatasourcesStore() {
|
||||||
},
|
},
|
||||||
select: async datasourceId => {
|
select: async datasourceId => {
|
||||||
update(state => ({ ...state, selected: datasourceId }))
|
update(state => ({ ...state, selected: datasourceId }))
|
||||||
queries.update(state => ({...state, selected: null}))
|
queries.update(state => ({ ...state, selected: null }))
|
||||||
},
|
},
|
||||||
save: async datasource => {
|
save: async datasource => {
|
||||||
const response = await api.post("/api/datasources", datasource)
|
const response = await api.post("/api/datasources", datasource)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { writable } from "svelte/store"
|
import { writable, get } from "svelte/store"
|
||||||
import { datasources, integrations } from "./"
|
import { datasources, integrations } from "./"
|
||||||
import api from "../../api"
|
import api from "../../api"
|
||||||
|
|
||||||
function createQueriesStore() {
|
function createQueriesStore() {
|
||||||
const { subscribe, set, update } = writable({list: [], selected: null})
|
const { subscribe, set, update } = writable({ list: [], selected: null })
|
||||||
|
|
||||||
return {
|
return {
|
||||||
subscribe,
|
subscribe,
|
||||||
|
@ -12,7 +12,7 @@ function createQueriesStore() {
|
||||||
fetch: async () => {
|
fetch: async () => {
|
||||||
const response = await api.get(`/api/queries`)
|
const response = await api.get(`/api/queries`)
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
update(state => ({...state, list: json}))
|
update(state => ({ ...state, list: json }))
|
||||||
return json
|
return json
|
||||||
},
|
},
|
||||||
save: async (datasourceId, query) => {
|
save: async (datasourceId, query) => {
|
||||||
|
@ -44,7 +44,7 @@ function createQueriesStore() {
|
||||||
} else {
|
} else {
|
||||||
queries.push(json)
|
queries.push(json)
|
||||||
}
|
}
|
||||||
return { list: queries, selected: json._id}
|
return { list: queries, selected: json._id }
|
||||||
})
|
})
|
||||||
return json
|
return json
|
||||||
},
|
},
|
||||||
|
@ -55,9 +55,7 @@ function createQueriesStore() {
|
||||||
delete: async query => {
|
delete: async query => {
|
||||||
await api.delete(`/api/queries/${query._id}/${query._rev}`)
|
await api.delete(`/api/queries/${query._id}/${query._rev}`)
|
||||||
update(state => {
|
update(state => {
|
||||||
state.list = state.list.filter(
|
state.list = state.list.filter(existing => existing._id !== query._id)
|
||||||
existing => existing._id !== query._id
|
|
||||||
)
|
|
||||||
if (state.selected === query._id) {
|
if (state.selected === query._id) {
|
||||||
state.selected = null
|
state.selected = null
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { writable,get } from "svelte/store"
|
import { writable, get } from "svelte/store"
|
||||||
import { views } from './'
|
import { views } from "./"
|
||||||
|
|
||||||
function createRowsStore() {
|
function createRowsStore() {
|
||||||
const { subscribe } = writable([])
|
const { subscribe } = writable([])
|
||||||
|
@ -12,4 +12,3 @@ function createRowsStore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const rows = createRowsStore()
|
export const rows = createRowsStore()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { writable, get } from "svelte/store"
|
import { writable, get } from "svelte/store"
|
||||||
import { views } from './'
|
import { views } from "./"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import api from "../../api"
|
import api from "../../api"
|
||||||
|
|
||||||
|
@ -14,18 +14,18 @@ function createTablesStore() {
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
const tablesResponse = await api.get(`/api/tables`)
|
const tablesResponse = await api.get(`/api/tables`)
|
||||||
const tables = await tablesResponse.json()
|
const tables = await tablesResponse.json()
|
||||||
update(state => ({...state, list: tables}))
|
update(state => ({ ...state, list: tables }))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function select(table) {
|
async function select(table) {
|
||||||
if (!table) {
|
if (!table) {
|
||||||
console.log('Setting selected to null')
|
console.log("Setting selected to null")
|
||||||
update(state => ({
|
update(state => ({
|
||||||
...state,
|
...state,
|
||||||
selected: {}
|
selected: {},
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
console.log('Setting selected to null')
|
console.log("Setting selected to null")
|
||||||
update(state => ({
|
update(state => ({
|
||||||
...state,
|
...state,
|
||||||
selected: table,
|
selected: table,
|
||||||
|
@ -81,7 +81,7 @@ function createTablesStore() {
|
||||||
update(state => ({
|
update(state => ({
|
||||||
...state,
|
...state,
|
||||||
list: state.list.filter(existing => existing._id !== table._id),
|
list: state.list.filter(existing => existing._id !== table._id),
|
||||||
selected: {}
|
selected: {},
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
saveField: ({ originalName, field, primaryDisplay = false, indexes }) => {
|
saveField: ({ originalName, field, primaryDisplay = false, indexes }) => {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import api from "../../api"
|
||||||
function createViewsStore() {
|
function createViewsStore() {
|
||||||
const { subscribe, update } = writable({
|
const { subscribe, update } = writable({
|
||||||
list: [],
|
list: [],
|
||||||
selected: null
|
selected: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -9,7 +9,13 @@ import {
|
||||||
selectedAccessRole,
|
selectedAccessRole,
|
||||||
} from "builderStore"
|
} from "builderStore"
|
||||||
// Backendstores
|
// Backendstores
|
||||||
import { datasources, integrations, queries, database, tables } from 'builderStore/store/backend/'
|
import {
|
||||||
|
datasources,
|
||||||
|
integrations,
|
||||||
|
queries,
|
||||||
|
database,
|
||||||
|
tables,
|
||||||
|
} from "builderStore/store/backend/"
|
||||||
|
|
||||||
import { fetchComponentLibDefinitions } from "../loadComponentLibraries"
|
import { fetchComponentLibDefinitions } from "../loadComponentLibraries"
|
||||||
import api from "../api"
|
import api from "../api"
|
||||||
|
@ -61,7 +67,12 @@ export const getFrontendStore = () => {
|
||||||
await hostingStore.actions.fetch()
|
await hostingStore.actions.fetch()
|
||||||
|
|
||||||
// Initialise backend stores
|
// Initialise backend stores
|
||||||
const [_datasources, _integrations, _queries, _tables] = await Promise.all([
|
const [
|
||||||
|
_datasources,
|
||||||
|
_integrations,
|
||||||
|
_queries,
|
||||||
|
_tables,
|
||||||
|
] = await Promise.all([
|
||||||
api.get(`/api/datasources`).then(r => r.json()),
|
api.get(`/api/datasources`).then(r => r.json()),
|
||||||
api.get("/api/integrations").then(r => r.json()),
|
api.get("/api/integrations").then(r => r.json()),
|
||||||
api.get(`/api/queries`).then(r => r.json()),
|
api.get(`/api/queries`).then(r => r.json()),
|
||||||
|
@ -74,9 +85,8 @@ export const getFrontendStore = () => {
|
||||||
tables.set({
|
tables.set({
|
||||||
list: _tables,
|
list: _tables,
|
||||||
selected: {},
|
selected: {},
|
||||||
draft: {}
|
draft: {},
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
routing: {
|
routing: {
|
||||||
fetch: async () => {
|
fetch: async () => {
|
||||||
|
|
Loading…
Reference in New Issue