Minor fix to add categories for rest bindings
This commit is contained in:
parent
7175ada5df
commit
5347a8339c
|
@ -82,6 +82,7 @@ export const getAuthBindings = () => {
|
||||||
readableBinding: fieldBinding.readable,
|
readableBinding: fieldBinding.readable,
|
||||||
fieldSchema: { type: "string", name: fieldBinding.key },
|
fieldSchema: { type: "string", name: fieldBinding.key },
|
||||||
providerId: "user",
|
providerId: "user",
|
||||||
|
category: "Current User",
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return bindings
|
return bindings
|
||||||
|
@ -93,7 +94,7 @@ export const getAuthBindings = () => {
|
||||||
* @param {string} prefix A contextual string prefix/path for a user readable binding
|
* @param {string} prefix A contextual string prefix/path for a user readable binding
|
||||||
* @return {object[]} An array containing readable/runtime binding objects
|
* @return {object[]} An array containing readable/runtime binding objects
|
||||||
*/
|
*/
|
||||||
export const toBindingsArray = (valueMap, prefix) => {
|
export const toBindingsArray = (valueMap, prefix, category) => {
|
||||||
if (!valueMap) {
|
if (!valueMap) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
@ -101,11 +102,20 @@ export const toBindingsArray = (valueMap, prefix) => {
|
||||||
if (!binding || !valueMap[binding]) {
|
if (!binding || !valueMap[binding]) {
|
||||||
return acc
|
return acc
|
||||||
}
|
}
|
||||||
acc.push({
|
|
||||||
|
let config = {
|
||||||
type: "context",
|
type: "context",
|
||||||
runtimeBinding: binding,
|
runtimeBinding: binding,
|
||||||
readableBinding: `${prefix}.${binding}`,
|
readableBinding: `${prefix}.${binding}`,
|
||||||
})
|
icon: "Brackets",
|
||||||
|
}
|
||||||
|
|
||||||
|
if (category) {
|
||||||
|
config.category = category
|
||||||
|
}
|
||||||
|
|
||||||
|
acc.push(config)
|
||||||
|
|
||||||
return acc
|
return acc
|
||||||
}, [])
|
}, [])
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,14 +60,20 @@
|
||||||
|
|
||||||
$: staticVariables = datasource?.config?.staticVariables || {}
|
$: staticVariables = datasource?.config?.staticVariables || {}
|
||||||
|
|
||||||
$: customRequestBindings = toBindingsArray(requestBindings, "Binding")
|
$: customRequestBindings = toBindingsArray(
|
||||||
|
requestBindings,
|
||||||
|
"Binding",
|
||||||
|
"Bindings"
|
||||||
|
)
|
||||||
$: globalDynamicRequestBindings = toBindingsArray(
|
$: globalDynamicRequestBindings = toBindingsArray(
|
||||||
globalDynamicBindings,
|
globalDynamicBindings,
|
||||||
|
"Dynamic",
|
||||||
"Dynamic"
|
"Dynamic"
|
||||||
)
|
)
|
||||||
$: dataSourceStaticBindings = toBindingsArray(
|
$: dataSourceStaticBindings = toBindingsArray(
|
||||||
staticVariables,
|
staticVariables,
|
||||||
"Datasource.Static"
|
"Datasource.Static",
|
||||||
|
"Datasource Static"
|
||||||
)
|
)
|
||||||
|
|
||||||
$: mergedBindings = [
|
$: mergedBindings = [
|
||||||
|
|
Loading…
Reference in New Issue