conductor/examples/project-definitions/valid-dropdown-response-mapping.json

157 lines
4.8 KiB
JSON

{
"$schema": "../../shared/schemas/conductor-project.schema.json",
"schemaVersion": "0.1.0",
"project": {
"id": "proj_dropdown_response_mapping",
"name": "Dropdown Response Mapping Demo",
"description": "Step 17.3 example: a REST action populates a Dropdown's options at runtime via an onSuccess binding. The button POSTs to httpbin.org/anything which echoes the body; the binding maps response.body.json.options to hostDropdown.options.",
"pages": [
{
"id": "page_main",
"name": "Main Page",
"order": 0,
"components": [
{
"id": "lbl_title",
"type": "Label",
"name": "titleLabel",
"position": { "x": 40, "y": 16 },
"size": { "width": 480, "height": 28 },
"properties": {
"label": "Dropdown Response Mapping Demo — Step 17.3",
"visible": true,
"disabled": false
},
"events": []
},
{
"id": "dropdown_host",
"type": "Dropdown",
"name": "hostDropdown",
"position": { "x": 40, "y": 56 },
"size": { "width": 280, "height": 72 },
"properties": {
"label": "Host",
"placeholder": "Select a host",
"options": [
{ "label": "(Fallback) Local", "value": "local" }
],
"value": "",
"visible": true,
"disabled": false
},
"events": []
},
{
"id": "btn_load",
"type": "Button",
"name": "loadOptionsButton",
"position": { "x": 40, "y": 144 },
"size": { "width": 180, "height": 40 },
"properties": {
"label": "Load Options",
"visible": true,
"disabled": false
},
"events": [
{
"event": "onClick",
"actionId": "action_load_hosts"
}
]
},
{
"id": "btn_use",
"type": "Button",
"name": "useSelectionButton",
"position": { "x": 240, "y": 144 },
"size": { "width": 200, "height": 40 },
"properties": {
"label": "Fetch Selected Host",
"visible": true,
"disabled": false
},
"events": [
{
"event": "onClick",
"actionId": "action_use_selection"
}
]
},
{
"id": "viewer_result",
"type": "JsonViewer",
"name": "resultsViewer",
"position": { "x": 40, "y": 200 },
"size": { "width": 580, "height": 300 },
"properties": {
"label": "Response",
"visible": true,
"disabled": false
},
"events": []
}
],
"events": []
}
],
"actions": [
{
"id": "action_load_hosts",
"name": "Load Host Options",
"description": "POST to httpbin.org/anything with a body containing options. HTTPBin echoes the parsed JSON body at response.body.json. The onSuccess binding maps .json.options to hostDropdown.options.",
"method": "POST",
"url": "https://httpbin.org/anything",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"queryParameters": {},
"pathParameters": {},
"bodyTemplate": "{\"options\":[{\"label\":\"Host One\",\"value\":\"host1\"},{\"label\":\"Host Two\",\"value\":\"host2\"},{\"label\":\"Host Three\",\"value\":\"host3\"}]}",
"authenticationType": "anonymous"
},
{
"id": "action_use_selection",
"name": "Fetch Selected Host",
"description": "GET to httpbin.org/get passing the currently selected host as a query parameter. Template: {{components.hostDropdown.value}}.",
"method": "GET",
"url": "https://httpbin.org/get",
"headers": {
"Accept": "application/json"
},
"queryParameters": {
"host": "{{components.hostDropdown.value}}"
},
"pathParameters": {},
"bodyTemplate": "",
"authenticationType": "anonymous"
}
],
"bindings": [
{
"id": "mapping_hosts_to_dropdown",
"source": "actions.action_load_hosts.response.body.json.options",
"target": "components.hostDropdown.options",
"trigger": "onSuccess"
},
{
"id": "bind_response_to_viewer",
"source": "actions.action_use_selection.response.body",
"target": "components.resultsViewer.value",
"trigger": "onSuccess"
}
],
"variables": {},
"settings": {}
}
}