125 lines
4.1 KiB
JSON
125 lines
4.1 KiB
JSON
{
|
|
"$schema": "../../shared/schemas/conductor-project.schema.json",
|
|
"schemaVersion": "0.1.0",
|
|
"project": {
|
|
"id": "proj_table_response_mapping",
|
|
"name": "Table Response Mapping Demo",
|
|
"description": "Step 17.5 example: a REST action populates a Table's rows at runtime via an onSuccess binding. The button POSTs to the local mock server (http://host.docker.internal:8787/anything) which echoes the body; the binding maps response.body.json.items to inventoryTable.rows. Start the mock server with: node examples/mock-server/conductor-mock-server.js",
|
|
|
|
"pages": [
|
|
{
|
|
"id": "page_main",
|
|
"name": "Main Page",
|
|
"order": 0,
|
|
"components": [
|
|
{
|
|
"id": "lbl_title",
|
|
"type": "Label",
|
|
"name": "titleLabel",
|
|
"position": { "x": 40, "y": 16 },
|
|
"size": { "width": 560, "height": 28 },
|
|
"properties": {
|
|
"label": "Table Response Mapping Demo — Step 17.5",
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": []
|
|
},
|
|
|
|
{
|
|
"id": "btn_load",
|
|
"type": "Button",
|
|
"name": "loadButton",
|
|
"position": { "x": 40, "y": 60 },
|
|
"size": { "width": 160, "height": 40 },
|
|
"properties": {
|
|
"label": "Load Inventory",
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": [
|
|
{
|
|
"event": "onClick",
|
|
"actionId": "action_get_inventory"
|
|
}
|
|
]
|
|
},
|
|
|
|
{
|
|
"id": "tbl_inventory",
|
|
"type": "Table",
|
|
"name": "inventoryTable",
|
|
"position": { "x": 40, "y": 120 },
|
|
"size": { "width": 560, "height": 220 },
|
|
"properties": {
|
|
"label": "Inventory",
|
|
"columns": [
|
|
{ "key": "hostname", "header": "Hostname" },
|
|
{ "key": "environment", "header": "Environment" },
|
|
{ "key": "status", "header": "Status" }
|
|
],
|
|
"rows": [
|
|
{
|
|
"hostname": "fallback-host",
|
|
"environment": "local",
|
|
"status": "configured"
|
|
}
|
|
],
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": []
|
|
},
|
|
|
|
{
|
|
"id": "viewer_response",
|
|
"type": "JsonViewer",
|
|
"name": "responseViewer",
|
|
"position": { "x": 40, "y": 360 },
|
|
"size": { "width": 560, "height": 200 },
|
|
"properties": {
|
|
"label": "",
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": []
|
|
}
|
|
]
|
|
}
|
|
],
|
|
|
|
"actions": [
|
|
{
|
|
"id": "action_get_inventory",
|
|
"name": "Get Inventory",
|
|
"description": "POSTs to the local Conductor mock server. The echoed response body contains json.items which is mapped to inventoryTable.rows. Start the mock server with: node examples/mock-server/conductor-mock-server.js",
|
|
"method": "POST",
|
|
"url": "http://host.docker.internal:8787/anything",
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
},
|
|
"bodyTemplate": "{\"items\":[{\"hostname\":\"host-one\",\"environment\":\"development\",\"status\":\"online\"},{\"hostname\":\"host-two\",\"environment\":\"test\",\"status\":\"offline\"},{\"hostname\":\"host-three\",\"environment\":\"production\",\"status\":\"online\"}]}",
|
|
"authenticationType": "anonymous"
|
|
}
|
|
],
|
|
|
|
"bindings": [
|
|
{
|
|
"id": "binding_inventory_rows",
|
|
"source": "actions.action_get_inventory.response.body.json.items",
|
|
"target": "components.inventoryTable.rows",
|
|
"trigger": "onSuccess"
|
|
},
|
|
{
|
|
"id": "binding_inventory_response",
|
|
"source": "actions.action_get_inventory.response.body",
|
|
"target": "components.responseViewer.value",
|
|
"trigger": "onSuccess"
|
|
}
|
|
],
|
|
|
|
"variables": {},
|
|
"settings": {}
|
|
}
|
|
}
|