1
0
Fork 0
mirror of synced 2024-10-01 17:47:46 +13:00

some comments

This commit is contained in:
Michael Shanks 2020-09-11 09:53:02 +01:00
parent 3b21b15259
commit d951edad61
5 changed files with 14 additions and 2 deletions

View file

@ -83,6 +83,8 @@ const contextToBindables = (models, walkResult) => context => {
readableBinding: `${context.instance._instanceName}.${context.model.label}.${key}`,
})
// see ModelViewSelect.svelte for the format of context.model
// ... this allows us to bind to Model scheams, or View schemas
const model = models.find(m => m._id === context.model.modelId)
const schema = context.model.isModel
? model.schema

View file

@ -4,7 +4,7 @@ export function readableToRuntimeBinding(bindableProperties, textWithBindings) {
// Find all instances of mustasche
const boundValues = textWithBindings.match(CAPTURE_VAR_INSIDE_MUSTACHE)
// Replace with names:
// Replace readableBindings with runtimeBindings
boundValues &&
boundValues.forEach(boundValue => {
const binding = bindableProperties.find(({ readableBinding }) => {
@ -27,7 +27,7 @@ export function runtimeToReadableBinding(bindableProperties, textWithBindings) {
textWithBindings.match(CAPTURE_VAR_INSIDE_MUSTACHE)) ||
[]
// Replace with names:
// Replace runtimeBindings with readableBindings:
boundValues.forEach(v => {
const binding = bindableProperties.find(({ runtimeBinding }) => {
return v === `{{ ${runtimeBinding} }}`

View file

@ -1,4 +1,5 @@
<script>
// accepts an array of field names, and outputs an object of { FieldName: value }
import { Select, Label, TextButton, Spacer } from "@budibase/bbui"
import { store, backendUiStore } from "builderStore"
import fetchBindableProperties from "builderStore/fetchBindableProperties"
@ -51,6 +52,7 @@
const rebuildParameters = () => {
// rebuilds paramters.fields every time a field name or value is added
// as UI below is bound to "fields" array, but we need to output a { key: value }
const newParameterFields = {}
for (let field of fields) {
if (field.name) {

View file

@ -2,6 +2,11 @@ import NavigateTo from "./NavigateTo.svelte"
import UpdateRecord from "./UpdateRecord.svelte"
import CreateRecord from "./CreateRecord.svelte"
// defines what actions are available, when adding a new one
// the component is the setup panel for the action
// NOTE that the "name" is used by the client library,
// so if you want to change it, you must change it client lib too
export default [
{
name: "Create Record",

View file

@ -14,6 +14,7 @@ export const eventHandlers = routeTo => {
// when an event is called, this is what gets run
const runEventActions = async (actions, state) => {
if (!actions) return
// calls event handlers sequentially
for (let action of actions) {
const handler = handlers[action[EVENT_TYPE_MEMBER_NAME]]
const parameters = createParameters(action.parameters, state)
@ -26,6 +27,8 @@ export const eventHandlers = routeTo => {
return runEventActions
}
// this will take a parameters obj, iterate all keys, and do a mustache render
// for every string. It will work recursively if it encounnters an {}
const createParameters = (parameterTemplateObj, state) => {
const parameters = {}
for (let key in parameterTemplateObj) {