Browse Source
Merge pull request #5369 from Budibase/fix-query-block-search
Fixes for custom queries
pull/5399/head
Andrew Kingston
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
3 additions and
6 deletions
-
packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte
-
packages/builder/src/components/design/PropertiesPanel/PropertyControls/SearchFieldSelect.svelte
-
packages/client/src/components/app/forms/Form.svelte
|
|
|
@ -52,7 +52,6 @@ |
|
|
|
.map(query => ({ |
|
|
|
label: query.name, |
|
|
|
name: query.name, |
|
|
|
tableId: query._id, |
|
|
|
...query, |
|
|
|
type: "query", |
|
|
|
})) |
|
|
|
|
|
|
|
@ -15,16 +15,14 @@ |
|
|
|
|
|
|
|
const dispatch = createEventDispatcher() |
|
|
|
$: datasource = getDatasourceForProvider($currentAsset, componentInstance) |
|
|
|
$: schema = getSchemaForDatasource($currentAsset, datasource, { |
|
|
|
searchableSchema: true, |
|
|
|
}).schema |
|
|
|
$: schema = getSchemaForDatasource($currentAsset, datasource).schema |
|
|
|
$: options = getOptions(datasource, schema || {}) |
|
|
|
$: boundValue = getSelectedOption(value, options) |
|
|
|
|
|
|
|
function getOptions(ds, dsSchema) { |
|
|
|
let base = Object.values(dsSchema) |
|
|
|
if (!ds?.tableId) { |
|
|
|
return base |
|
|
|
return base.map(field => field.name) |
|
|
|
} |
|
|
|
const currentTable = $tables.list.find(table => table._id === ds.tableId) |
|
|
|
return getFields(base, { allowLinks: currentTable?.sql }).map( |
|
|
|
|
|
|
|
@ -80,7 +80,7 @@ |
|
|
|
} |
|
|
|
|
|
|
|
const fetchTable = async dataSource => { |
|
|
|
if (dataSource?.tableId) { |
|
|
|
if (dataSource?.tableId && dataSource?.type !== "query") { |
|
|
|
try { |
|
|
|
table = await API.fetchTableDefinition(dataSource.tableId) |
|
|
|
} catch (error) { |
|
|
|
|