Untitled
unknown
plain_text
3 years ago
2.9 kB
5
Indexable
/* Dashbaord */
{
"type": "containerSimple",
"prps": {},
"wgts": [
{
"traits": [
{
"trait": "./input",
"traitPrps": {
"id": "field-username",
"idError": "field-username-error"
}
}
]
},
{
"id": "field-password",
"traits": [
{
"trait": "./input",
"traitPrps": {
"id": "field-password",
"idError": "field-password-error"
}
}
]
},
{
"type": "button",
"traits": [
{
"trait": "./save",
"traitPrps": {
"idsToSave": [
"field-username",
"field-password"
],
"errorIds": [
"field-username-error",
"field-password-error"
]
}
}
],
"prps": {}
}
]
}
/* Input trait */
{
"acceptPrps": {
"id": "string",
"idError": "string"
},
"type": "containerSimple",
"prps": {},
"wgts": [
{
"id": "%id%",
"type": "input",
"prps": {}
},
{
"id": "%idError%",
"type": "label",
"prps": {}
}
]
}
/* Save script */
{
"acceptPrps": {
"idsToSave": "array",
"errorIds": {
"dft": []
}
},
"prps": {
"fireScript": {
"actions": [
{
"type": "morphIterateArray",
"...": "...",
"pushVariable": "payload"
},
{
"traits": [
{
"trait": "./spreadSave",
"traitPrps": {
"payload": "{{variable.payload}}",
"extractResults": [
{
"...": "..."
},
{
"...": "..."
}
]
}
}
]
},
{
"traits": [
{
"trait": "./spreadShowErrors",
"traitPrps": {
"idsToSave": "$idsToSave$",
"errorIds": "$errorIds$",
"errors": "{{variable.returnedErrors}}"
}
}
]
}
]
}
}
}
/* Spreadie save */
{
"acceptPrps": {
"payload": "array",
"extractResults": {
"dft": []
}
},
"traitArray": [
{
"type": "setVariable",
"name": "newExtractResults",
"value": "$extractResults$"
}
{
"type": "pushVariable",
"name": "newExtractResults",
"value": {
"path": "response..........errorMessages",
"variable": "returnedErrors"
}
},
{
"type": "queryGateway",
"...": "...",
"extractResults": "{{variable.newExtractResults}}"
}
]
}
/* Spreadie show errors */
{
"acceptPrps": {
"idsToSave": "array",
"errorIds": "array",
"errors": []
},
"traitArray": [
{
"id": "sMorph",
"type": "morphIterateArray",
"value": "$errors$",
"chain": [
{
"id": "sIndex",
"type": "findIndexInArray",
"value": "$idsToSave$",
"comparison": {
"operator": "isEqual",
"value": "{{sIndex.varaible.record.fieldName",
"compareValue": "{{sMorph.veriable.record.field}}"
},
"storeAsVariable": "index"
},
{
"type": "setState",
"target": "$errorIds.((variable.index))$"
}
]
}
]
}Editor is loading...