Making it possible to create an internal table from the plus symbol.
This commit is contained in:
parent
4dec87795a
commit
3ab4a5d83c
|
@ -5,14 +5,17 @@
|
|||
import ICONS from "../icons"
|
||||
|
||||
export let integration = {}
|
||||
|
||||
let integrations = []
|
||||
const INTERNAL = "BUDIBASE"
|
||||
|
||||
async function fetchIntegrations() {
|
||||
const response = await api.get("/api/integrations")
|
||||
const json = await response.json()
|
||||
|
||||
integrations = json
|
||||
integrations = {
|
||||
[INTERNAL]: { datasource: {} },
|
||||
...json,
|
||||
}
|
||||
return json
|
||||
}
|
||||
|
||||
|
@ -21,7 +24,7 @@
|
|||
|
||||
// build the schema
|
||||
const schema = {}
|
||||
for (let key in selected.datasource) {
|
||||
for (let key of Object.keys(selected.datasource)) {
|
||||
schema[key] = selected.datasource[key].default
|
||||
}
|
||||
|
||||
|
|
|
@ -2,15 +2,21 @@
|
|||
import { goto } from "@roxi/routify"
|
||||
import { datasources } from "stores/backend"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Input, Label, ModalContent } from "@budibase/bbui"
|
||||
import { Input, Label, ModalContent, Modal, Context } from "@budibase/bbui"
|
||||
import TableIntegrationMenu from "../TableIntegrationMenu/index.svelte"
|
||||
import CreateTableModal from "components/backend/TableNavigator/modals/CreateTableModal.svelte"
|
||||
import analytics from "analytics"
|
||||
import { getContext } from "svelte"
|
||||
|
||||
let error = ""
|
||||
const modalContext = getContext(Context.Modal)
|
||||
|
||||
let tableModal
|
||||
let name
|
||||
let error = ""
|
||||
let integration
|
||||
|
||||
$: checkOpenModal(integration && integration.type === "BUDIBASE")
|
||||
|
||||
function checkValid(evt) {
|
||||
const datasourceName = evt.target.value
|
||||
if (
|
||||
|
@ -22,6 +28,12 @@
|
|||
error = ""
|
||||
}
|
||||
|
||||
function checkOpenModal(isInternal) {
|
||||
if (isInternal) {
|
||||
tableModal.show()
|
||||
}
|
||||
}
|
||||
|
||||
async function saveDatasource() {
|
||||
const { type, plus, ...config } = integration
|
||||
|
||||
|
@ -40,6 +52,9 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:this={tableModal} on:hide={modalContext.hide}>
|
||||
<CreateTableModal bind:name />
|
||||
</Modal>
|
||||
<ModalContent
|
||||
title="Create Datasource"
|
||||
size="L"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { goto } from "@roxi/routify"
|
||||
import { goto, url } from "@roxi/routify"
|
||||
import { store } from "builderStore"
|
||||
import { tables } from "stores/backend"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
$: tableNames = $tables.list.map(table => table.name)
|
||||
|
||||
let name
|
||||
export let name
|
||||
let dataImport
|
||||
let error = ""
|
||||
let createAutoscreens = true
|
||||
|
@ -91,7 +91,11 @@
|
|||
}
|
||||
|
||||
// Navigate to new table
|
||||
$goto(`../../table/${table._id}`)
|
||||
const currentUrl = $url()
|
||||
const path = currentUrl.endsWith("data")
|
||||
? `./table/${table._id}`
|
||||
: `../../table/${table._id}`
|
||||
$goto(path)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
let selected = "Sources"
|
||||
let modal
|
||||
|
||||
$: isExternal =
|
||||
$params.selectedDatasource &&
|
||||
$params.selectedDatasource !== BUDIBASE_INTERNAL_DB
|
||||
|
|
Loading…
Reference in New Issue