* @brief Register group CRUD commands. */
| 574 | * @brief Register group CRUD commands. |
| 575 | */ |
| 576 | void API::Handlers::ProjectHandler::registerGroupCommands() |
| 577 | { |
| 578 | auto& registry = CommandRegistry::instance(); |
| 579 | const auto empty = emptySchema(); |
| 580 | |
| 581 | registry.registerCommand( |
| 582 | QStringLiteral("project.group.add"), |
| 583 | QStringLiteral("Create a new visualization group. Pick widgetType by data shape:\n" |
| 584 | " - 5 (NoGroupWidget): just hold related datasets together; per-" |
| 585 | "dataset widgets render individually. Default for arbitrary " |
| 586 | "scalar data.\n" |
| 587 | " - 4 (MultiPlot): N values plotted on a shared time axis. The " |
| 588 | "right choice for correlated signals (sensor-array, multi-channel " |
| 589 | "ADC).\n" |
| 590 | " - 0 (DataGrid): tabular numeric readout. Good for long lists " |
| 591 | "of scalars where graphing isn't useful.\n" |
| 592 | " - 1/2/3 (Accelerometer / Gyroscope / GPS): typed 3-axis IMU or " |
| 593 | "GPS group. Datasets must follow conventional widget tags " |
| 594 | "(\"x\", \"y\", \"z\" for IMUs; \"lat\", \"lon\", \"alt\" for GPS).\n" |
| 595 | " - 6 (Plot3D, Pro): 3D point trail from three datasets.\n" |
| 596 | " - 7 (ImageView, Pro): displays an embedded JPEG/PNG stream.\n" |
| 597 | " - 8 (Painter, Pro): user-scripted JS canvas. Group can be " |
| 598 | "EMPTY (no datasets) and read peer datasets via " |
| 599 | "datasetGetFinal(uniqueId). See meta.howTo('add_painter').\n" |
| 600 | "Don't pick 0 / DataGrid as a default -- it makes a forgettable " |
| 601 | "table. Match the user's data."), |
| 602 | makeSchema({ |
| 603 | { QStringLiteral("title"), |
| 604 | QStringLiteral("string"), |
| 605 | QStringLiteral("Group title shown in dashboard headers and the Project Editor tree")}, |
| 606 | {QStringLiteral("widgetType"), |
| 607 | QStringLiteral("integer"), |
| 608 | QStringLiteral("GroupWidget enum -- see command description for decision " |
| 609 | "guidance. 0=DataGrid, 1=Accelerometer, 2=Gyroscope, 3=GPS, " |
| 610 | "4=MultiPlot, 5=NoGroupWidget, 6=Plot3D, 7=ImageView, 8=Painter") } |
| 611 | }), |
| 612 | &groupAdd); |
| 613 | |
| 614 | registry.registerCommand( |
| 615 | QStringLiteral("project.group.delete"), |
| 616 | QStringLiteral("Delete a group by id. Pass dryRun:true to preview what would change " |
| 617 | "without committing -- the response contains the same {deleted, " |
| 618 | "renumbered, warnings} fields as a real call, plus a top-level " |
| 619 | "dryRun:true flag. Always preview before committing when the user " |
| 620 | "doesn't have a backup workflow."), |
| 621 | makeSchema( |
| 622 | { |
| 623 | {QStringLiteral("groupId"), |
| 624 | QStringLiteral("integer"), |
| 625 | QStringLiteral("Group id to delete")} |
| 626 | }, |
| 627 | {{QStringLiteral("dryRun"), |
| 628 | QStringLiteral("boolean"), |
| 629 | QStringLiteral("If true, return the affected entities without committing. Auto-runs " |
| 630 | "without an approval card.")}}), |
| 631 | &groupDelete); |
| 632 | |
| 633 | registry.registerCommand(QStringLiteral("project.group.duplicate"), |
nothing calls this directly
no test coverage detected