conductor/examples/project-definitions/valid-conductor-tutorial.json

277 lines
8.8 KiB
JSON

{
"$schema": "../../shared/schemas/conductor-project.schema.json",
"schemaVersion": "0.1.0",
"project": {
"id": "proj_conductor_tutorial",
"name": "Conductor Tutorial — Post Workshop",
"description": "A safe two-page tutorial using JSONPlaceholder's simulated REST API.",
"pages": [
{
"id": "page_create_post",
"name": "Create a Post",
"slug": "create-post",
"showInNavigation": true,
"description": "Submit a simulated post and inspect the response.",
"order": 0,
"components": [
{
"id": "cmp_create_title",
"type": "Label",
"name": "createHeading",
"position": { "x": 24, "y": 20 },
"size": { "width": 600, "height": 40 },
"properties": {
"label": "Create a simulated post",
"value": "Create a simulated post",
"visible": true
}
},
{
"id": "cmp_post_title",
"type": "TextInput",
"name": "postTitle",
"position": { "x": 24, "y": 80 },
"size": { "width": 500, "height": 64 },
"properties": {
"label": "Post title",
"placeholder": "What did you learn?",
"defaultValue": "My first Conductor application",
"required": true,
"visible": true,
"disabled": false
}
},
{
"id": "cmp_post_body",
"type": "TextArea",
"name": "postBody",
"position": { "x": 24, "y": 160 },
"size": { "width": 500, "height": 130 },
"properties": {
"label": "Post body",
"placeholder": "Write a short message",
"defaultValue": "I connected components to a REST action and mapped its response.",
"required": true,
"visible": true,
"disabled": false
}
},
{
"id": "cmp_submit_post",
"type": "Button",
"name": "submitPost",
"position": { "x": 24, "y": 312 },
"size": { "width": 180, "height": 44 },
"properties": {
"label": "Create post",
"visible": true,
"disabled": false
},
"events": [
{ "event": "onClick", "actionId": "action_create_post" }
]
},
{
"id": "cmp_created_id",
"type": "StatusPanel",
"name": "createdPostId",
"position": { "x": 224, "y": 312 },
"size": { "width": 300, "height": 64 },
"properties": {
"label": "Created post ID",
"value": "Not submitted",
"visible": true
}
},
{
"id": "cmp_create_response",
"type": "JsonViewer",
"name": "createResponse",
"position": { "x": 560, "y": 80 },
"size": { "width": 560, "height": 296 },
"properties": {
"label": "API response",
"defaultValue": null,
"visible": true
}
},
{
"id": "cmp_go_browse",
"type": "Button",
"name": "goToBrowse",
"position": { "x": 24, "y": 410 },
"size": { "width": 220, "height": 44 },
"properties": {
"label": "Browse sample posts",
"visible": true,
"disabled": false
},
"events": [
{ "event": "onClick", "navigateToPageId": "page_browse_posts" }
]
}
],
"events": []
},
{
"id": "page_browse_posts",
"name": "Browse Posts",
"slug": "browse-posts",
"showInNavigation": true,
"description": "Load sample records and inspect a selected row.",
"order": 1,
"components": [
{
"id": "cmp_browse_title",
"type": "Label",
"name": "browseHeading",
"position": { "x": 24, "y": 20 },
"size": { "width": 600, "height": 40 },
"properties": {
"label": "Posts for sample user 1",
"value": "Posts for sample user 1",
"visible": true
}
},
{
"id": "cmp_refresh_posts",
"type": "Button",
"name": "refreshPosts",
"position": { "x": 24, "y": 76 },
"size": { "width": 160, "height": 44 },
"properties": {
"label": "Refresh posts",
"visible": true,
"disabled": false
},
"events": [
{ "event": "onClick", "actionId": "action_load_posts" }
]
},
{
"id": "cmp_back_create",
"type": "Button",
"name": "backToCreate",
"position": { "x": 204, "y": 76 },
"size": { "width": 180, "height": 44 },
"properties": {
"label": "Back to create",
"visible": true,
"disabled": false
},
"events": [
{ "event": "onClick", "navigateToPageId": "page_create_post" }
]
},
{
"id": "cmp_posts_table",
"type": "Table",
"name": "postsTable",
"position": { "x": 24, "y": 144 },
"size": { "width": 700, "height": 480 },
"properties": {
"label": "Sample posts",
"columns": [
{ "key": "id", "header": "ID", "width": 80 },
{ "key": "userId", "header": "User", "width": 90 },
{ "key": "title", "header": "Title", "width": 480 }
],
"rows": [],
"visible": true,
"disabled": false
}
},
{
"id": "cmp_selected_post",
"type": "JsonViewer",
"name": "selectedPost",
"position": { "x": 756, "y": 144 },
"size": { "width": 404, "height": 480 },
"properties": {
"label": "Selected post",
"defaultValue": null,
"visible": true
}
}
],
"events": [
{ "event": "onLoad", "actionId": "action_load_posts" }
]
}
],
"actions": [
{
"id": "action_create_post",
"name": "Create simulated post",
"description": "Sends component and variable values to JSONPlaceholder. The service simulates creation without storing data.",
"method": "POST",
"url": "https://jsonplaceholder.typicode.com/posts",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json; charset=UTF-8"
},
"queryParameters": {},
"pathParameters": {},
"bodyTemplate": "{\"title\":\"{{components.postTitle.value}}\",\"body\":\"{{components.postBody.value}}\",\"userId\":{{variables.defaultUserId}}}",
"authenticationType": "anonymous"
},
{
"id": "action_load_posts",
"name": "Load sample posts",
"description": "Loads the ten sample posts belonging to JSONPlaceholder user 1.",
"method": "GET",
"url": "https://jsonplaceholder.typicode.com/posts",
"headers": {
"Accept": "application/json"
},
"queryParameters": {
"userId": "{{variables.defaultUserId}}"
},
"pathParameters": {},
"bodyTemplate": "",
"authenticationType": "anonymous"
}
],
"bindings": [
{
"id": "binding_created_id",
"source": "actions.action_create_post.response.body.id",
"target": "components.createdPostId.value",
"trigger": "onSuccess"
},
{
"id": "binding_create_response",
"source": "actions.action_create_post.response.body",
"target": "components.createResponse.value",
"trigger": "onSuccess"
},
{
"id": "binding_posts_rows",
"source": "actions.action_load_posts.response.body",
"target": "components.postsTable.rows",
"trigger": "onSuccess"
},
{
"id": "binding_selected_post",
"source": "components.postsTable.selectedRow",
"target": "components.selectedPost.value",
"trigger": "onChange"
}
],
"variables": {
"defaultUserId": {
"type": "number",
"defaultValue": 1,
"scope": "global",
"description": "Sample user used by both tutorial actions."
}
},
"settings": {
"theme": "system",
"defaultPageId": "page_create_post",
"canvasWidth": 1200,
"canvasHeight": 700
}
}
}