1
0
Fork 0
mirror of synced 2024-07-01 20:41:03 +12:00

Adding settings tab for SQL datasources.

This commit is contained in:
mike12345567 2023-06-28 11:59:53 +01:00
parent 1b2781b7f8
commit 25d0f3f518
3 changed files with 23 additions and 13 deletions

View file

@ -10,6 +10,7 @@
import RestAuthenticationPanel from "./_components/panels/Authentication/index.svelte"
import RestVariablesPanel from "./_components/panels/Variables/index.svelte"
import PromptQueryModal from "./_components/PromptQueryModal.svelte"
import { helpers } from "@budibase/shared-core"
let selectedPanel = null
let panelOptions = []
@ -39,6 +40,10 @@
panelOptions = ["Queries"]
selectedPanel = "Queries"
}
// always the last option for SQL
if (helpers.isSQL(datasource)) {
panelOptions.push("Settings")
}
}
</script>
@ -82,6 +87,8 @@
<RestAuthenticationPanel {datasource} />
{:else if selectedPanel === "Variables"}
<RestVariablesPanel {datasource} />
{:else if selectedPanel === "Settings"}
<Body>Settings</Body>
{:else}
<Body>Something went wrong</Body>
{/if}

View file

@ -1,6 +1,7 @@
import { SourceName, SqlQuery, Datasource, Table } from "@budibase/types"
import { DocumentType, SEPARATOR } from "../db/utils"
import { FieldTypes, BuildSchemaErrors, InvalidColumns } from "../constants"
import { helpers } from "@budibase/shared-core"
const DOUBLE_SEPARATOR = `${SEPARATOR}${SEPARATOR}`
const ROW_ID_REGEX = /^\[.*]$/g
@ -178,18 +179,7 @@ export function getSqlQuery(query: SqlQuery | string): SqlQuery {
}
}
export function isSQL(datasource: Datasource): boolean {
if (!datasource || !datasource.source) {
return false
}
const SQL = [
SourceName.POSTGRES,
SourceName.SQL_SERVER,
SourceName.MYSQL,
SourceName.ORACLE,
]
return SQL.indexOf(datasource.source) !== -1
}
export const isSQL = helpers.isSQL
export function isIsoDateString(str: string) {
if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) {

View file

@ -1,5 +1,18 @@
import { SourceName } from "@budibase/types"
import { Datasource, SourceName } from "@budibase/types"
export function isGoogleSheets(type: SourceName) {
return type === SourceName.GOOGLE_SHEETS
}
export function isSQL(datasource: Datasource): boolean {
if (!datasource || !datasource.source) {
return false
}
const SQL = [
SourceName.POSTGRES,
SourceName.SQL_SERVER,
SourceName.MYSQL,
SourceName.ORACLE,
]
return SQL.indexOf(datasource.source) !== -1
}