* @brief Creates a new table with the given (optional) name. */
| 391 | * @brief Creates a new table with the given (optional) name. |
| 392 | */ |
| 393 | API::CommandResponse API::Handlers::DataTablesHandler::tableAdd(const QString& id, |
| 394 | const QJsonObject& params) |
| 395 | { |
| 396 | const QString desired = |
| 397 | params.value(QStringLiteral("name")).toString(QStringLiteral("Shared Table")); |
| 398 | |
| 399 | const QString actual = DataModel::ProjectModel::instance().addTable(desired); |
| 400 | |
| 401 | QJsonObject result; |
| 402 | result[QStringLiteral("name")] = actual; |
| 403 | result[QStringLiteral("added")] = true; |
| 404 | return CommandResponse::makeSuccess(id, result); |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * @brief Deletes a table by name. With dryRun:true, reports what would be deleted without |