mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
feat(workflow_editor, data_table): add components, functions, and styles for advanced data table and workflow editor
This commit is contained in:
222
packages/data_table/components/ui.json
Normal file
222
packages/data_table/components/ui.json
Normal file
@@ -0,0 +1,222 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/json-script-components.schema.json",
|
||||
"schemaVersion": "2.0.0",
|
||||
"package": "data_table",
|
||||
"description": "Advanced data table components with rich features",
|
||||
"components": [
|
||||
{
|
||||
"id": "data_grid",
|
||||
"name": "DataGrid",
|
||||
"description": "Advanced data table with sorting, filtering, pagination, and export",
|
||||
"props": [
|
||||
{
|
||||
"name": "columns",
|
||||
"type": "array",
|
||||
"required": true,
|
||||
"description": "Column definitions"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "array",
|
||||
"required": true,
|
||||
"description": "Data rows"
|
||||
},
|
||||
{
|
||||
"name": "sortable",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "filterable",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "pagination",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "pageSize",
|
||||
"type": "number",
|
||||
"default": 10
|
||||
},
|
||||
{
|
||||
"name": "selection",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "exportable",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
],
|
||||
"state": [
|
||||
{
|
||||
"name": "sortColumn",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"name": "sortDirection",
|
||||
"type": "string",
|
||||
"default": "asc"
|
||||
},
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "object",
|
||||
"default": {}
|
||||
},
|
||||
{
|
||||
"name": "currentPage",
|
||||
"type": "number",
|
||||
"default": 1
|
||||
},
|
||||
{
|
||||
"name": "selectedRows",
|
||||
"type": "array",
|
||||
"default": []
|
||||
}
|
||||
],
|
||||
"handlers": {
|
||||
"init": "init.initialize",
|
||||
"sort": "sorting.sortByColumn",
|
||||
"filter": "filtering.applyFilters",
|
||||
"paginate": "pagination.changePage",
|
||||
"export": "export.exportData",
|
||||
"select": "selection.toggleRow"
|
||||
},
|
||||
"render": {
|
||||
"type": "element",
|
||||
"template": {
|
||||
"type": "Box",
|
||||
"className": "data-grid-container space-y-4",
|
||||
"children": [
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{filterable || exportable}}",
|
||||
"then": {
|
||||
"type": "Box",
|
||||
"className": "flex justify-between items-center",
|
||||
"children": [
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{filterable}}",
|
||||
"then": {
|
||||
"type": "Input",
|
||||
"type": "search",
|
||||
"placeholder": "Search...",
|
||||
"onChange": "filter"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{exportable}}",
|
||||
"then": {
|
||||
"type": "Button",
|
||||
"variant": "outline",
|
||||
"onClick": "export",
|
||||
"children": [
|
||||
{
|
||||
"type": "Icon",
|
||||
"name": "Download",
|
||||
"size": 16
|
||||
},
|
||||
"Export"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Table",
|
||||
"className": "data-table",
|
||||
"children": [
|
||||
{
|
||||
"type": "TableHead",
|
||||
"children": [
|
||||
{
|
||||
"type": "TableRow",
|
||||
"children": {
|
||||
"type": "loop",
|
||||
"items": "{{columns}}",
|
||||
"iterator": "column",
|
||||
"key": "{{column.id}}",
|
||||
"template": {
|
||||
"type": "TableCell",
|
||||
"className": "{{sortable ? 'cursor-pointer' : ''}}",
|
||||
"onClick": "{{sortable ? sort : null}}",
|
||||
"children": [
|
||||
"{{column.label}}",
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{sortable && sortColumn === column.id}}",
|
||||
"then": {
|
||||
"type": "Icon",
|
||||
"name": "{{sortDirection === 'asc' ? 'ArrowUp' : 'ArrowDown'}}",
|
||||
"size": 14
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "TableBody",
|
||||
"children": {
|
||||
"type": "loop",
|
||||
"items": "{{data}}",
|
||||
"iterator": "row",
|
||||
"key": "{{row.id}}",
|
||||
"template": {
|
||||
"type": "TableRow",
|
||||
"className": "{{selectedRows.includes(row.id) ? 'selected' : ''}}",
|
||||
"children": {
|
||||
"type": "loop",
|
||||
"items": "{{columns}}",
|
||||
"iterator": "column",
|
||||
"key": "{{column.id}}",
|
||||
"template": {
|
||||
"type": "TableCell",
|
||||
"children": "{{row[column.id]}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{pagination}}",
|
||||
"then": {
|
||||
"type": "Box",
|
||||
"className": "flex justify-between items-center",
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"variant": "caption",
|
||||
"children": "Page {{currentPage}}"
|
||||
},
|
||||
{
|
||||
"type": "Pagination",
|
||||
"count": "{{Math.ceil(data.length / pageSize)}}",
|
||||
"page": "{{currentPage}}",
|
||||
"onChange": "paginate"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"exports": {
|
||||
"components": ["DataGrid"]
|
||||
}
|
||||
}
|
||||
64
packages/data_table/package.json
Normal file
64
packages/data_table/package.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/package-metadata.schema.json",
|
||||
"packageId": "data_table",
|
||||
"name": "Data Table",
|
||||
"version": "1.0.0",
|
||||
"description": "Advanced data table components with sorting, filtering, and pagination",
|
||||
"author": "MetaBuilder",
|
||||
"license": "MIT",
|
||||
"category": "ui",
|
||||
"minLevel": 1,
|
||||
"primary": false,
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"lua_test": "*"
|
||||
},
|
||||
"exports": {
|
||||
"components": [
|
||||
"DataGrid",
|
||||
"DataTable"
|
||||
],
|
||||
"scripts": [
|
||||
"init",
|
||||
"sorting",
|
||||
"filtering",
|
||||
"pagination",
|
||||
"selection",
|
||||
"export"
|
||||
]
|
||||
},
|
||||
"tests": {
|
||||
"scripts": [
|
||||
"tests/metadata.test.lua",
|
||||
"tests/components.test.lua",
|
||||
"tests/filtering.test.lua",
|
||||
"tests/sorting.test.lua",
|
||||
"tests/pagination.test.lua",
|
||||
"tests/selection.test.lua",
|
||||
"tests/export.test.lua"
|
||||
],
|
||||
"parameterized": [
|
||||
{
|
||||
"parameters": "tests/metadata.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/components.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/filtering.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/sorting.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/pagination.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/selection.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/export.cases.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
147
packages/data_table/scripts/functions.json
Normal file
147
packages/data_table/scripts/functions.json
Normal file
@@ -0,0 +1,147 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/json-script.schema.json",
|
||||
"schemaVersion": "2.2.0",
|
||||
"package": "data_table",
|
||||
"description": "Data table operations for sorting, filtering, pagination, and export",
|
||||
"functions": [
|
||||
{
|
||||
"id": "init_initialize",
|
||||
"name": "initialize",
|
||||
"exported": true,
|
||||
"description": "Initialize data table",
|
||||
"category": "lifecycle",
|
||||
"luaScript": "init.lua"
|
||||
},
|
||||
{
|
||||
"id": "sorting_sort_column",
|
||||
"name": "sortByColumn",
|
||||
"exported": true,
|
||||
"description": "Sort table by column",
|
||||
"category": "sorting",
|
||||
"luaScript": "sorting.lua"
|
||||
},
|
||||
{
|
||||
"id": "sorting_toggle_direction",
|
||||
"name": "toggleSortDirection",
|
||||
"exported": true,
|
||||
"description": "Toggle sort direction",
|
||||
"category": "sorting",
|
||||
"luaScript": "sorting.lua"
|
||||
},
|
||||
{
|
||||
"id": "filtering_apply",
|
||||
"name": "applyFilters",
|
||||
"exported": true,
|
||||
"description": "Apply filters to data",
|
||||
"category": "filtering",
|
||||
"luaScript": "filtering.lua"
|
||||
},
|
||||
{
|
||||
"id": "filtering_search",
|
||||
"name": "searchData",
|
||||
"exported": true,
|
||||
"description": "Search across all columns",
|
||||
"category": "filtering",
|
||||
"luaScript": "filtering.lua"
|
||||
},
|
||||
{
|
||||
"id": "filtering_filter_column",
|
||||
"name": "filterByColumn",
|
||||
"exported": true,
|
||||
"description": "Filter by specific column",
|
||||
"category": "filtering",
|
||||
"luaScript": "filtering.lua"
|
||||
},
|
||||
{
|
||||
"id": "pagination_change_page",
|
||||
"name": "changePage",
|
||||
"exported": true,
|
||||
"description": "Navigate to page",
|
||||
"category": "pagination",
|
||||
"luaScript": "pagination.lua"
|
||||
},
|
||||
{
|
||||
"id": "pagination_next",
|
||||
"name": "nextPage",
|
||||
"exported": true,
|
||||
"description": "Go to next page",
|
||||
"category": "pagination",
|
||||
"luaScript": "pagination.lua"
|
||||
},
|
||||
{
|
||||
"id": "pagination_previous",
|
||||
"name": "previousPage",
|
||||
"exported": true,
|
||||
"description": "Go to previous page",
|
||||
"category": "pagination",
|
||||
"luaScript": "pagination.lua"
|
||||
},
|
||||
{
|
||||
"id": "selection_toggle_row",
|
||||
"name": "toggleRow",
|
||||
"exported": true,
|
||||
"description": "Toggle row selection",
|
||||
"category": "selection",
|
||||
"luaScript": "selection.lua"
|
||||
},
|
||||
{
|
||||
"id": "selection_select_all",
|
||||
"name": "selectAll",
|
||||
"exported": true,
|
||||
"description": "Select all rows",
|
||||
"category": "selection",
|
||||
"luaScript": "selection.lua"
|
||||
},
|
||||
{
|
||||
"id": "selection_clear",
|
||||
"name": "clearSelection",
|
||||
"exported": true,
|
||||
"description": "Clear all selections",
|
||||
"category": "selection",
|
||||
"luaScript": "selection.lua"
|
||||
},
|
||||
{
|
||||
"id": "export_csv",
|
||||
"name": "exportToCSV",
|
||||
"exported": true,
|
||||
"description": "Export data to CSV",
|
||||
"category": "export",
|
||||
"luaScript": "export.lua"
|
||||
},
|
||||
{
|
||||
"id": "export_json",
|
||||
"name": "exportToJSON",
|
||||
"exported": true,
|
||||
"description": "Export data to JSON",
|
||||
"category": "export",
|
||||
"luaScript": "export.lua"
|
||||
},
|
||||
{
|
||||
"id": "export_data",
|
||||
"name": "exportData",
|
||||
"exported": true,
|
||||
"description": "Export data in specified format",
|
||||
"category": "export",
|
||||
"luaScript": "export.lua"
|
||||
}
|
||||
],
|
||||
"exports": {
|
||||
"functions": [
|
||||
"initialize",
|
||||
"sortByColumn",
|
||||
"toggleSortDirection",
|
||||
"applyFilters",
|
||||
"searchData",
|
||||
"filterByColumn",
|
||||
"changePage",
|
||||
"nextPage",
|
||||
"previousPage",
|
||||
"toggleRow",
|
||||
"selectAll",
|
||||
"clearSelection",
|
||||
"exportToCSV",
|
||||
"exportToJSON",
|
||||
"exportData"
|
||||
]
|
||||
}
|
||||
}
|
||||
48
packages/data_table/storybook/config.json
Normal file
48
packages/data_table/storybook/config.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/package-storybook.schema.json",
|
||||
"featured": false,
|
||||
"title": "Data Table",
|
||||
"description": "Advanced data table with sorting, filtering, and pagination",
|
||||
"stories": [
|
||||
{
|
||||
"name": "DataGrid",
|
||||
"render": "component",
|
||||
"description": "Full-featured data grid",
|
||||
"args": {
|
||||
"sortable": true,
|
||||
"filterable": true,
|
||||
"pagination": true,
|
||||
"selection": true,
|
||||
"exportable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "SimpleTable",
|
||||
"render": "component",
|
||||
"description": "Basic table without features",
|
||||
"args": {
|
||||
"sortable": false,
|
||||
"filterable": false,
|
||||
"pagination": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"renders": {
|
||||
"component": {
|
||||
"description": "Data grid component showcase",
|
||||
"featured": true
|
||||
}
|
||||
},
|
||||
"defaultContext": {
|
||||
"user": {
|
||||
"level": 1
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"renderFunctions": ["component"],
|
||||
"ignoredScripts": ["tests"]
|
||||
},
|
||||
"parameters": {
|
||||
"layout": "fullscreen"
|
||||
}
|
||||
}
|
||||
15
packages/data_table/styles/tokens.json
Normal file
15
packages/data_table/styles/tokens.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/package-styles.schema.json",
|
||||
"schemaVersion": "2.0.0",
|
||||
"colors": {
|
||||
"tableHeaderBg": "#f9fafb",
|
||||
"tableRowHover": "#f3f4f6",
|
||||
"tableRowSelected": "#e0e7ff",
|
||||
"tableBorder": "#e5e7eb",
|
||||
"sortIndicator": "#6366f1"
|
||||
},
|
||||
"spacing": {
|
||||
"cellPadding": "12px 16px",
|
||||
"tableMargin": "0 0 16px 0"
|
||||
}
|
||||
}
|
||||
290
packages/workflow_editor/components/ui.json
Normal file
290
packages/workflow_editor/components/ui.json
Normal file
@@ -0,0 +1,290 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/json-script-components.schema.json",
|
||||
"schemaVersion": "2.0.0",
|
||||
"package": "workflow_editor",
|
||||
"description": "Workflow editor and execution monitoring components",
|
||||
"components": [
|
||||
{
|
||||
"id": "workflow_editor",
|
||||
"name": "WorkflowEditor",
|
||||
"description": "Visual workflow editor with drag-and-drop node canvas",
|
||||
"props": [
|
||||
{
|
||||
"name": "workflowId",
|
||||
"type": "string",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"name": "initialWorkflow",
|
||||
"type": "object",
|
||||
"required": false
|
||||
}
|
||||
],
|
||||
"state": [
|
||||
{
|
||||
"name": "workflowName",
|
||||
"type": "string",
|
||||
"default": "Untitled Workflow"
|
||||
},
|
||||
{
|
||||
"name": "nodes",
|
||||
"type": "array",
|
||||
"default": []
|
||||
},
|
||||
{
|
||||
"name": "edges",
|
||||
"type": "array",
|
||||
"default": []
|
||||
},
|
||||
{
|
||||
"name": "selectedNode",
|
||||
"type": "string",
|
||||
"default": null
|
||||
},
|
||||
{
|
||||
"name": "isRunning",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
],
|
||||
"handlers": {
|
||||
"save": "editor.saveWorkflow",
|
||||
"run": "run.executeWorkflow",
|
||||
"addNode": "editor.addNode",
|
||||
"deleteNode": "editor.deleteNode",
|
||||
"connect": "editor.connectNodes"
|
||||
},
|
||||
"render": {
|
||||
"type": "element",
|
||||
"template": {
|
||||
"type": "Card",
|
||||
"variant": "outlined",
|
||||
"className": "workflow-editor-container",
|
||||
"children": [
|
||||
{
|
||||
"type": "Toolbar",
|
||||
"variant": "dense",
|
||||
"children": [
|
||||
{
|
||||
"type": "TextField",
|
||||
"size": "small",
|
||||
"label": "Workflow Name",
|
||||
"value": "{{workflowName}}",
|
||||
"onChange": "updateName"
|
||||
},
|
||||
{
|
||||
"type": "Button",
|
||||
"variant": "contained",
|
||||
"color": "primary",
|
||||
"size": "small",
|
||||
"disabled": "{{isRunning}}",
|
||||
"onClick": "run",
|
||||
"children": "{{isRunning ? 'Running...' : 'Run'}}"
|
||||
},
|
||||
{
|
||||
"type": "Button",
|
||||
"variant": "outlined",
|
||||
"size": "small",
|
||||
"onClick": "save",
|
||||
"children": "Save"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Box",
|
||||
"className": "workflow-editor-canvas",
|
||||
"sx": {
|
||||
"height": "500px",
|
||||
"border": "1px solid",
|
||||
"borderColor": "divider",
|
||||
"position": "relative"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"variant": "caption",
|
||||
"color": "secondary",
|
||||
"className": "p-4",
|
||||
"children": "Drag nodes from sidebar to create workflow"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Stack",
|
||||
"className": "workflow-editor-sidebar",
|
||||
"spacing": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"variant": "h6",
|
||||
"children": "Workflow Nodes"
|
||||
},
|
||||
{
|
||||
"type": "Button",
|
||||
"variant": "outlined",
|
||||
"size": "small",
|
||||
"onClick": "addNode",
|
||||
"children": "Add Step"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "workflow_run_card",
|
||||
"name": "WorkflowRunCard",
|
||||
"description": "Card showing workflow execution status",
|
||||
"props": [
|
||||
{
|
||||
"name": "runId",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "workflowName",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"enum": ["pending", "running", "success", "failed", "cancelled"]
|
||||
},
|
||||
{
|
||||
"name": "progress",
|
||||
"type": "number",
|
||||
"default": 0
|
||||
},
|
||||
{
|
||||
"name": "startTime",
|
||||
"type": "string",
|
||||
"required": false
|
||||
}
|
||||
],
|
||||
"handlers": {
|
||||
"cancel": "run.cancelWorkflow",
|
||||
"retry": "run.retryWorkflow"
|
||||
},
|
||||
"render": {
|
||||
"type": "element",
|
||||
"template": {
|
||||
"type": "Card",
|
||||
"variant": "outlined",
|
||||
"className": "workflow-run-card",
|
||||
"children": [
|
||||
{
|
||||
"type": "CardHeader",
|
||||
"title": "{{workflowName}}",
|
||||
"subtitle": "Run ID: {{runId}}"
|
||||
},
|
||||
{
|
||||
"type": "CardContent",
|
||||
"children": [
|
||||
{
|
||||
"type": "Chip",
|
||||
"size": "small",
|
||||
"color": "{{status === 'success' ? 'success' : status === 'failed' ? 'error' : status === 'running' ? 'primary' : 'default'}}",
|
||||
"label": "{{status.toUpperCase()}}"
|
||||
},
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{status === 'running'}}",
|
||||
"then": {
|
||||
"type": "LinearProgress",
|
||||
"value": "{{progress}}",
|
||||
"variant": "determinate"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"variant": "caption",
|
||||
"color": "secondary",
|
||||
"children": "Started: {{startTime}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "CardActions",
|
||||
"children": [
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{status === 'running'}}",
|
||||
"then": {
|
||||
"type": "Button",
|
||||
"size": "small",
|
||||
"color": "error",
|
||||
"onClick": "cancel",
|
||||
"children": "Cancel"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "conditional",
|
||||
"condition": "{{status === 'failed'}}",
|
||||
"then": {
|
||||
"type": "Button",
|
||||
"size": "small",
|
||||
"onClick": "retry",
|
||||
"children": "Retry"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "workflow_run_status",
|
||||
"name": "WorkflowRunStatus",
|
||||
"description": "Detailed workflow run status with step breakdown",
|
||||
"props": [
|
||||
{
|
||||
"name": "steps",
|
||||
"type": "array",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"render": {
|
||||
"type": "element",
|
||||
"template": {
|
||||
"type": "List",
|
||||
"className": "workflow-steps",
|
||||
"children": {
|
||||
"type": "loop",
|
||||
"items": "{{steps}}",
|
||||
"iterator": "step",
|
||||
"key": "{{step.id}}",
|
||||
"template": {
|
||||
"type": "Box",
|
||||
"className": "flex items-center gap-2 p-2",
|
||||
"children": [
|
||||
{
|
||||
"type": "Icon",
|
||||
"name": "{{step.status === 'success' ? 'CheckCircle' : step.status === 'failed' ? 'XCircle' : step.status === 'running' ? 'Loader' : 'Circle'}}",
|
||||
"size": 20,
|
||||
"color": "{{step.status === 'success' ? 'success' : step.status === 'failed' ? 'error' : 'default'}}"
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"children": "{{step.name}}"
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"variant": "caption",
|
||||
"color": "secondary",
|
||||
"children": "{{step.duration}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"exports": {
|
||||
"components": ["WorkflowEditor", "WorkflowRunCard", "WorkflowRunStatus"]
|
||||
}
|
||||
}
|
||||
147
packages/workflow_editor/entities/schema.json
Normal file
147
packages/workflow_editor/entities/schema.json
Normal file
@@ -0,0 +1,147 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/entities.schema.json",
|
||||
"schemaVersion": "2.0.0",
|
||||
"entities": [
|
||||
{
|
||||
"name": "Workflow",
|
||||
"version": "1.0",
|
||||
"description": "Workflow definition with nodes and edges",
|
||||
"primaryKey": "id",
|
||||
"timestamps": true,
|
||||
"softDelete": false,
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "uuid",
|
||||
"generated": true,
|
||||
"description": "Unique workflow identifier"
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"index": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"maxLength": 200
|
||||
},
|
||||
"description": {
|
||||
"type": "text",
|
||||
"nullable": true
|
||||
},
|
||||
"definition": {
|
||||
"type": "text",
|
||||
"required": true,
|
||||
"description": "JSON workflow definition with nodes and edges"
|
||||
},
|
||||
"status": {
|
||||
"type": "enum",
|
||||
"enum": ["draft", "active", "archived"],
|
||||
"default": "draft"
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"fields": ["tenantId"],
|
||||
"name": "idx_workflow_tenant"
|
||||
},
|
||||
{
|
||||
"fields": ["status"],
|
||||
"name": "idx_workflow_status"
|
||||
}
|
||||
],
|
||||
"acl": {
|
||||
"create": ["admin"],
|
||||
"read": ["admin"],
|
||||
"update": ["admin"],
|
||||
"delete": ["admin"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WorkflowRun",
|
||||
"version": "1.0",
|
||||
"description": "Workflow execution instance",
|
||||
"primaryKey": "id",
|
||||
"timestamps": true,
|
||||
"softDelete": false,
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "uuid",
|
||||
"generated": true
|
||||
},
|
||||
"workflowId": {
|
||||
"type": "uuid",
|
||||
"required": true,
|
||||
"index": true
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"index": true
|
||||
},
|
||||
"status": {
|
||||
"type": "enum",
|
||||
"enum": ["pending", "running", "success", "failed", "cancelled"],
|
||||
"default": "pending",
|
||||
"index": true
|
||||
},
|
||||
"startTime": {
|
||||
"type": "datetime",
|
||||
"nullable": true
|
||||
},
|
||||
"endTime": {
|
||||
"type": "datetime",
|
||||
"nullable": true
|
||||
},
|
||||
"progress": {
|
||||
"type": "integer",
|
||||
"default": 0,
|
||||
"description": "Progress percentage 0-100"
|
||||
},
|
||||
"result": {
|
||||
"type": "text",
|
||||
"nullable": true,
|
||||
"description": "JSON execution result"
|
||||
},
|
||||
"error": {
|
||||
"type": "text",
|
||||
"nullable": true,
|
||||
"description": "Error message if failed"
|
||||
}
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"fields": ["workflowId"],
|
||||
"name": "idx_run_workflow"
|
||||
},
|
||||
{
|
||||
"fields": ["status"],
|
||||
"name": "idx_run_status"
|
||||
},
|
||||
{
|
||||
"fields": ["startTime"],
|
||||
"name": "idx_run_start"
|
||||
}
|
||||
],
|
||||
"relations": [
|
||||
{
|
||||
"name": "workflow",
|
||||
"type": "belongsTo",
|
||||
"entity": "Workflow",
|
||||
"field": "workflowId",
|
||||
"onDelete": "Cascade"
|
||||
}
|
||||
],
|
||||
"acl": {
|
||||
"create": ["admin"],
|
||||
"read": ["admin"],
|
||||
"update": ["admin"],
|
||||
"delete": ["admin"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
50
packages/workflow_editor/jobs/tasks.json
Normal file
50
packages/workflow_editor/jobs/tasks.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/jobs.schema.json",
|
||||
"schemaVersion": "1.0.0",
|
||||
"package": "workflow_editor",
|
||||
"description": "Background jobs for workflow execution",
|
||||
"jobs": [
|
||||
{
|
||||
"id": "execute_workflow",
|
||||
"name": "Execute Workflow",
|
||||
"description": "Execute workflow in background",
|
||||
"handler": "run.executeWorkflow",
|
||||
"queue": "workflows",
|
||||
"priority": "normal",
|
||||
"retry": {
|
||||
"maxAttempts": 3,
|
||||
"backoff": "exponential",
|
||||
"backoffDelay": 1000
|
||||
},
|
||||
"timeout": 3600000
|
||||
},
|
||||
{
|
||||
"id": "cleanup_old_runs",
|
||||
"name": "Cleanup Old Workflow Runs",
|
||||
"description": "Remove old workflow run data",
|
||||
"handler": "status.cleanupOldRuns",
|
||||
"schedule": "0 2 * * *",
|
||||
"queue": "maintenance",
|
||||
"priority": "low",
|
||||
"retry": {
|
||||
"maxAttempts": 2,
|
||||
"backoff": "fixed",
|
||||
"backoffDelay": 5000
|
||||
}
|
||||
}
|
||||
],
|
||||
"queues": [
|
||||
{
|
||||
"name": "workflows",
|
||||
"concurrency": 5,
|
||||
"rateLimit": {
|
||||
"max": 100,
|
||||
"duration": 60000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "maintenance",
|
||||
"concurrency": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
46
packages/workflow_editor/package.json
Normal file
46
packages/workflow_editor/package.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/package-metadata.schema.json",
|
||||
"packageId": "workflow_editor",
|
||||
"name": "Workflow Editor",
|
||||
"version": "1.0.0",
|
||||
"description": "Workflow editor and execution monitoring components",
|
||||
"author": "MetaBuilder",
|
||||
"license": "MIT",
|
||||
"category": "editors",
|
||||
"minLevel": 5,
|
||||
"primary": true,
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"lua_test": "*"
|
||||
},
|
||||
"exports": {
|
||||
"components": [
|
||||
"WorkflowEditor",
|
||||
"WorkflowRunCard",
|
||||
"WorkflowRunStatus"
|
||||
],
|
||||
"scripts": [
|
||||
"editor",
|
||||
"status",
|
||||
"run"
|
||||
]
|
||||
},
|
||||
"tests": {
|
||||
"scripts": [
|
||||
"tests/status.test.lua",
|
||||
"tests/editor.test.lua",
|
||||
"tests/run.test.lua"
|
||||
],
|
||||
"parameterized": [
|
||||
{
|
||||
"parameters": "tests/status.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/editor.cases.json"
|
||||
},
|
||||
{
|
||||
"parameters": "tests/run.cases.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
102
packages/workflow_editor/scripts/functions.json
Normal file
102
packages/workflow_editor/scripts/functions.json
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/json-script.schema.json",
|
||||
"schemaVersion": "2.2.0",
|
||||
"package": "workflow_editor",
|
||||
"description": "Workflow creation, editing, and execution functions",
|
||||
"functions": [
|
||||
{
|
||||
"id": "editor_save",
|
||||
"name": "saveWorkflow",
|
||||
"exported": true,
|
||||
"description": "Save workflow definition",
|
||||
"category": "editor",
|
||||
"luaScript": "editor.lua"
|
||||
},
|
||||
{
|
||||
"id": "editor_load",
|
||||
"name": "loadWorkflow",
|
||||
"exported": true,
|
||||
"description": "Load workflow definition",
|
||||
"category": "editor",
|
||||
"luaScript": "editor.lua"
|
||||
},
|
||||
{
|
||||
"id": "editor_add_node",
|
||||
"name": "addNode",
|
||||
"exported": true,
|
||||
"description": "Add node to workflow",
|
||||
"category": "editor",
|
||||
"luaScript": "editor.lua"
|
||||
},
|
||||
{
|
||||
"id": "editor_delete_node",
|
||||
"name": "deleteNode",
|
||||
"exported": true,
|
||||
"description": "Delete node from workflow",
|
||||
"category": "editor",
|
||||
"luaScript": "editor.lua"
|
||||
},
|
||||
{
|
||||
"id": "editor_connect_nodes",
|
||||
"name": "connectNodes",
|
||||
"exported": true,
|
||||
"description": "Connect two workflow nodes",
|
||||
"category": "editor",
|
||||
"luaScript": "editor.lua"
|
||||
},
|
||||
{
|
||||
"id": "run_execute",
|
||||
"name": "executeWorkflow",
|
||||
"exported": true,
|
||||
"description": "Execute workflow",
|
||||
"category": "execution",
|
||||
"luaScript": "run.lua"
|
||||
},
|
||||
{
|
||||
"id": "run_cancel",
|
||||
"name": "cancelWorkflow",
|
||||
"exported": true,
|
||||
"description": "Cancel running workflow",
|
||||
"category": "execution",
|
||||
"luaScript": "run.lua"
|
||||
},
|
||||
{
|
||||
"id": "run_retry",
|
||||
"name": "retryWorkflow",
|
||||
"exported": true,
|
||||
"description": "Retry failed workflow",
|
||||
"category": "execution",
|
||||
"luaScript": "run.lua"
|
||||
},
|
||||
{
|
||||
"id": "status_get",
|
||||
"name": "getStatus",
|
||||
"exported": true,
|
||||
"description": "Get workflow run status",
|
||||
"category": "monitoring",
|
||||
"luaScript": "status.lua"
|
||||
},
|
||||
{
|
||||
"id": "status_list_runs",
|
||||
"name": "listRuns",
|
||||
"exported": true,
|
||||
"description": "List workflow runs",
|
||||
"category": "monitoring",
|
||||
"luaScript": "status.lua"
|
||||
}
|
||||
],
|
||||
"exports": {
|
||||
"functions": [
|
||||
"saveWorkflow",
|
||||
"loadWorkflow",
|
||||
"addNode",
|
||||
"deleteNode",
|
||||
"connectNodes",
|
||||
"executeWorkflow",
|
||||
"cancelWorkflow",
|
||||
"retryWorkflow",
|
||||
"getStatus",
|
||||
"listRuns"
|
||||
]
|
||||
}
|
||||
}
|
||||
56
packages/workflow_editor/storybook/config.json
Normal file
56
packages/workflow_editor/storybook/config.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/package-storybook.schema.json",
|
||||
"featured": true,
|
||||
"title": "Workflow Editor",
|
||||
"description": "Visual workflow editor and execution monitoring",
|
||||
"stories": [
|
||||
{
|
||||
"name": "WorkflowEditor",
|
||||
"render": "editor",
|
||||
"description": "Visual workflow editor with canvas"
|
||||
},
|
||||
{
|
||||
"name": "WorkflowRunCard",
|
||||
"render": "status",
|
||||
"description": "Workflow execution status card",
|
||||
"args": {
|
||||
"status": "running",
|
||||
"progress": 65
|
||||
}
|
||||
}
|
||||
],
|
||||
"renders": {
|
||||
"editor": {
|
||||
"description": "Workflow visual editor",
|
||||
"featured": true
|
||||
},
|
||||
"status": {
|
||||
"description": "Workflow run status"
|
||||
}
|
||||
},
|
||||
"defaultContext": {
|
||||
"user": {
|
||||
"id": "admin-user",
|
||||
"username": "admin",
|
||||
"level": 5
|
||||
}
|
||||
},
|
||||
"contextVariants": [
|
||||
{
|
||||
"name": "Super Admin",
|
||||
"description": "Full workflow editor access",
|
||||
"context": {
|
||||
"user": {
|
||||
"level": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"renderFunctions": ["editor", "status", "run"],
|
||||
"ignoredScripts": ["tests"]
|
||||
},
|
||||
"parameters": {
|
||||
"layout": "fullscreen"
|
||||
}
|
||||
}
|
||||
18
packages/workflow_editor/styles/tokens.json
Normal file
18
packages/workflow_editor/styles/tokens.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://metabuilder.dev/schemas/package-styles.schema.json",
|
||||
"schemaVersion": "2.0.0",
|
||||
"colors": {
|
||||
"workflowSuccess": "#10b981",
|
||||
"workflowFailed": "#ef4444",
|
||||
"workflowRunning": "#3b82f6",
|
||||
"workflowPending": "#9ca3af",
|
||||
"workflowCancelled": "#f59e0b",
|
||||
"nodeBackground": "#ffffff",
|
||||
"nodeBorder": "#d1d5db",
|
||||
"edgeColor": "#6b7280"
|
||||
},
|
||||
"spacing": {
|
||||
"nodePadding": "12px",
|
||||
"canvasMargin": "16px"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user