Adding settings tab for SQL datasources.
This commit is contained in:
parent
1b2781b7f8
commit
25d0f3f518
|
@ -10,6 +10,7 @@
|
||||||
import RestAuthenticationPanel from "./_components/panels/Authentication/index.svelte"
|
import RestAuthenticationPanel from "./_components/panels/Authentication/index.svelte"
|
||||||
import RestVariablesPanel from "./_components/panels/Variables/index.svelte"
|
import RestVariablesPanel from "./_components/panels/Variables/index.svelte"
|
||||||
import PromptQueryModal from "./_components/PromptQueryModal.svelte"
|
import PromptQueryModal from "./_components/PromptQueryModal.svelte"
|
||||||
|
import { helpers } from "@budibase/shared-core"
|
||||||
|
|
||||||
let selectedPanel = null
|
let selectedPanel = null
|
||||||
let panelOptions = []
|
let panelOptions = []
|
||||||
|
@ -39,6 +40,10 @@
|
||||||
panelOptions = ["Queries"]
|
panelOptions = ["Queries"]
|
||||||
selectedPanel = "Queries"
|
selectedPanel = "Queries"
|
||||||
}
|
}
|
||||||
|
// always the last option for SQL
|
||||||
|
if (helpers.isSQL(datasource)) {
|
||||||
|
panelOptions.push("Settings")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -82,6 +87,8 @@
|
||||||
<RestAuthenticationPanel {datasource} />
|
<RestAuthenticationPanel {datasource} />
|
||||||
{:else if selectedPanel === "Variables"}
|
{:else if selectedPanel === "Variables"}
|
||||||
<RestVariablesPanel {datasource} />
|
<RestVariablesPanel {datasource} />
|
||||||
|
{:else if selectedPanel === "Settings"}
|
||||||
|
<Body>Settings</Body>
|
||||||
{:else}
|
{:else}
|
||||||
<Body>Something went wrong</Body>
|
<Body>Something went wrong</Body>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { SourceName, SqlQuery, Datasource, Table } from "@budibase/types"
|
import { SourceName, SqlQuery, Datasource, Table } from "@budibase/types"
|
||||||
import { DocumentType, SEPARATOR } from "../db/utils"
|
import { DocumentType, SEPARATOR } from "../db/utils"
|
||||||
import { FieldTypes, BuildSchemaErrors, InvalidColumns } from "../constants"
|
import { FieldTypes, BuildSchemaErrors, InvalidColumns } from "../constants"
|
||||||
|
import { helpers } from "@budibase/shared-core"
|
||||||
|
|
||||||
const DOUBLE_SEPARATOR = `${SEPARATOR}${SEPARATOR}`
|
const DOUBLE_SEPARATOR = `${SEPARATOR}${SEPARATOR}`
|
||||||
const ROW_ID_REGEX = /^\[.*]$/g
|
const ROW_ID_REGEX = /^\[.*]$/g
|
||||||
|
@ -178,18 +179,7 @@ export function getSqlQuery(query: SqlQuery | string): SqlQuery {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSQL(datasource: Datasource): boolean {
|
export const isSQL = helpers.isSQL
|
||||||
if (!datasource || !datasource.source) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
const SQL = [
|
|
||||||
SourceName.POSTGRES,
|
|
||||||
SourceName.SQL_SERVER,
|
|
||||||
SourceName.MYSQL,
|
|
||||||
SourceName.ORACLE,
|
|
||||||
]
|
|
||||||
return SQL.indexOf(datasource.source) !== -1
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isIsoDateString(str: string) {
|
export function isIsoDateString(str: string) {
|
||||||
if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) {
|
if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) {
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
import { SourceName } from "@budibase/types"
|
import { Datasource, SourceName } from "@budibase/types"
|
||||||
|
|
||||||
export function isGoogleSheets(type: SourceName) {
|
export function isGoogleSheets(type: SourceName) {
|
||||||
return type === SourceName.GOOGLE_SHEETS
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue