Dynamic filter: Enrich columns (#9877)
* WIP * Allow related fields in Dynamic Filter * REST URL check https first * Only allow related fields in dynamic filter column editor
This commit is contained in:
parent
c1f38699a5
commit
09cf4f8bbc
|
@ -8,6 +8,7 @@
|
|||
getSchemaForDatasource,
|
||||
} from "builderStore/dataBinding"
|
||||
import { currentAsset } from "builderStore"
|
||||
import { getFields } from "helpers/searchFields"
|
||||
|
||||
export let componentInstance
|
||||
export let value = []
|
||||
|
@ -21,9 +22,14 @@
|
|||
|
||||
$: datasource = getDatasourceForProvider($currentAsset, componentInstance)
|
||||
$: schema = getSchema($currentAsset, datasource)
|
||||
$: options = Object.keys(schema || {})
|
||||
$: options = allowCellEditing
|
||||
? Object.keys(schema || {})
|
||||
: enrichedSchemaFields?.map(field => field.name)
|
||||
$: sanitisedValue = getValidColumns(value, options)
|
||||
$: updateBoundValue(sanitisedValue)
|
||||
$: enrichedSchemaFields = getFields(Object.values(schema) || [], {
|
||||
allowLinks: true,
|
||||
})
|
||||
|
||||
const getSchema = (asset, datasource) => {
|
||||
const schema = getSchemaForDatasource(asset, datasource).schema
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
|
||||
const cleanUrl = inputUrl =>
|
||||
url
|
||||
?.replace(/(http)|(https)|[{}:]/g, "")
|
||||
?.replace(/(https)|(http)|[{}:]/g, "")
|
||||
?.replaceAll(".", "_")
|
||||
?.replaceAll("/", " ")
|
||||
?.trim() || inputUrl
|
||||
|
|
|
@ -57,6 +57,9 @@
|
|||
const onFieldChange = (expression, field) => {
|
||||
// Update the field type
|
||||
expression.type = schemaFields.find(x => x.name === field)?.type
|
||||
expression.externalType = schemaFields.find(
|
||||
x => x.name === field
|
||||
)?.externalType
|
||||
|
||||
// Ensure a valid operator is set
|
||||
const validOperators = LuceneUtils.getValidOperatorsForType(
|
||||
|
|
|
@ -81,6 +81,7 @@ export const getRelationshipSchemaAdditions = async schema => {
|
|||
Object.keys(linkSchema || {}).forEach(linkKey => {
|
||||
relationshipAdditions[`${fieldKey}.${linkKey}`] = {
|
||||
type: linkSchema[linkKey].type,
|
||||
externalType: linkSchema[linkKey].externalType,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue