Code review updates
This commit is contained in:
parent
09bf4ecd42
commit
2e807fdc3d
|
@ -359,8 +359,9 @@ const getProviderContextBindings = (asset, dataProviders) => {
|
||||||
providerId,
|
providerId,
|
||||||
// Table ID is used by JSON fields to know what table the field is in
|
// Table ID is used by JSON fields to know what table the field is in
|
||||||
tableId: table?._id,
|
tableId: table?._id,
|
||||||
category: "Dataprovider",
|
category: component._instanceName,
|
||||||
display: { name: readableBinding, type: fieldSchema.type },
|
icon: def.icon,
|
||||||
|
display: { name: fieldSchema.name || key, type: fieldSchema.type },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -388,6 +389,7 @@ const getUserBindings = () => {
|
||||||
fieldSchema,
|
fieldSchema,
|
||||||
providerId: "user",
|
providerId: "user",
|
||||||
category: "Current User",
|
category: "Current User",
|
||||||
|
icon: "User",
|
||||||
display: fieldSchema,
|
display: fieldSchema,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -406,14 +408,16 @@ const getDeviceBindings = () => {
|
||||||
runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`,
|
runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`,
|
||||||
readableBinding: `Device.Mobile`,
|
readableBinding: `Device.Mobile`,
|
||||||
category: "Device",
|
category: "Device",
|
||||||
display: { type: "string", name: "mobile" },
|
icon: "DevicePhone",
|
||||||
|
display: { type: "boolean", name: "mobile" },
|
||||||
})
|
})
|
||||||
bindings.push({
|
bindings.push({
|
||||||
type: "context",
|
type: "context",
|
||||||
runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`,
|
runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`,
|
||||||
readableBinding: `Device.Tablet`,
|
readableBinding: `Device.Tablet`,
|
||||||
category: "Device",
|
category: "Device",
|
||||||
display: { type: "string", name: "tablet" },
|
icon: "DevicePhone",
|
||||||
|
display: { type: "boolean", name: "tablet" },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return bindings
|
return bindings
|
||||||
|
@ -437,7 +441,8 @@ const getSelectedRowsBindings = asset => {
|
||||||
"selectedRows"
|
"selectedRows"
|
||||||
)}`,
|
)}`,
|
||||||
readableBinding: `${table._instanceName}.Selected rows`,
|
readableBinding: `${table._instanceName}.Selected rows`,
|
||||||
category: "Dataprovider",
|
category: "Selected rows",
|
||||||
|
icon: "ViewRow",
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -470,6 +475,7 @@ const getStateBindings = () => {
|
||||||
runtimeBinding: `${safeState}.${makePropSafe(key)}`,
|
runtimeBinding: `${safeState}.${makePropSafe(key)}`,
|
||||||
readableBinding: `State.${key}`,
|
readableBinding: `State.${key}`,
|
||||||
category: "State",
|
category: "State",
|
||||||
|
icon: "AutomatedSegment",
|
||||||
display: { name: key },
|
display: { name: key },
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
@ -494,12 +500,16 @@ const getUrlBindings = asset => {
|
||||||
runtimeBinding: `${safeURL}.${makePropSafe(param)}`,
|
runtimeBinding: `${safeURL}.${makePropSafe(param)}`,
|
||||||
readableBinding: `URL.${param}`,
|
readableBinding: `URL.${param}`,
|
||||||
category: "URL",
|
category: "URL",
|
||||||
|
icon: "RailTop",
|
||||||
|
display: { type: "string" },
|
||||||
}))
|
}))
|
||||||
const queryParamsBinding = {
|
const queryParamsBinding = {
|
||||||
type: "context",
|
type: "context",
|
||||||
runtimeBinding: makePropSafe("query"),
|
runtimeBinding: makePropSafe("query"),
|
||||||
readableBinding: "Query params",
|
readableBinding: "Query params",
|
||||||
category: "URL",
|
category: "URL",
|
||||||
|
icon: "RailTop",
|
||||||
|
display: { type: "object" },
|
||||||
}
|
}
|
||||||
return urlParamBindings.concat([queryParamsBinding])
|
return urlParamBindings.concat([queryParamsBinding])
|
||||||
}
|
}
|
||||||
|
@ -511,7 +521,8 @@ const getRoleBindings = () => {
|
||||||
runtimeBinding: `trim "${role._id}"`,
|
runtimeBinding: `trim "${role._id}"`,
|
||||||
readableBinding: `Role.${role.name}`,
|
readableBinding: `Role.${role.name}`,
|
||||||
category: "Role",
|
category: "Role",
|
||||||
display: { name: role.name },
|
icon: "UserGroup",
|
||||||
|
display: { type: "string", name: role.name },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,15 +49,6 @@
|
||||||
let hbsValue = initialValueJS ? null : value
|
let hbsValue = initialValueJS ? null : value
|
||||||
|
|
||||||
let selectedCategory = null
|
let selectedCategory = null
|
||||||
let categoryIcons = {
|
|
||||||
Device: "DevicePhone",
|
|
||||||
"Current User": "User",
|
|
||||||
Helpers: "MagicWand",
|
|
||||||
Dataprovider: "Data",
|
|
||||||
State: "AutomatedSegment",
|
|
||||||
URL: "RailTop",
|
|
||||||
Role: "UserGroup",
|
|
||||||
}
|
|
||||||
|
|
||||||
let popover
|
let popover
|
||||||
let popoverAnchor
|
let popoverAnchor
|
||||||
|
@ -66,6 +57,16 @@
|
||||||
$: usingJS = mode === "JavaScript"
|
$: usingJS = mode === "JavaScript"
|
||||||
$: searchRgx = new RegExp(search, "ig")
|
$: searchRgx = new RegExp(search, "ig")
|
||||||
$: categories = Object.entries(groupBy("category", bindings))
|
$: categories = Object.entries(groupBy("category", bindings))
|
||||||
|
|
||||||
|
$: bindingIcons = bindings?.reduce((acc, ele) => {
|
||||||
|
if (ele.icon) {
|
||||||
|
acc[ele.category] = acc[ele.category] || ele.icon
|
||||||
|
}
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
$: categoryIcons = { ...bindingIcons, Helpers: "MagicWand" }
|
||||||
|
|
||||||
$: filteredCategories = categories
|
$: filteredCategories = categories
|
||||||
.map(([name, categoryBindings]) => ({
|
.map(([name, categoryBindings]) => ({
|
||||||
name,
|
name,
|
||||||
|
@ -84,13 +85,7 @@
|
||||||
return helper.label.match(searchRgx) || helper.description.match(searchRgx)
|
return helper.label.match(searchRgx) || helper.description.match(searchRgx)
|
||||||
})
|
})
|
||||||
|
|
||||||
$: categoryNames = [
|
$: categoryNames = [...categories.map(cat => cat[0]), "Helpers"]
|
||||||
...categories.reduce((acc, cat) => {
|
|
||||||
acc.push(cat[0])
|
|
||||||
return acc
|
|
||||||
}, []),
|
|
||||||
"Helpers",
|
|
||||||
]
|
|
||||||
|
|
||||||
$: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`)
|
$: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue