* @brief Enables the dataset option a widget type requires, recording the API step. */
| 1602 | * @brief Enables the dataset option a widget type requires, recording the API step. |
| 1603 | */ |
| 1604 | static QJsonObject enableTileWidgetOption(const QString& optionSlug, |
| 1605 | const QJsonObject& dataset, |
| 1606 | int groupId, |
| 1607 | QJsonArray& steps) |
| 1608 | { |
| 1609 | QStringList slugs; |
| 1610 | for (const auto& value : dataset.value(QStringLiteral("enabledOptionsSlugs")).toArray()) |
| 1611 | slugs.append(value.toString()); |
| 1612 | |
| 1613 | if (!slugs.contains(optionSlug)) |
| 1614 | slugs.append(optionSlug); |
| 1615 | |
| 1616 | QJsonObject optArgs; |
| 1617 | optArgs[QStringLiteral("groupId")] = dataset.value(QStringLiteral("groupId")).toInt(groupId); |
| 1618 | optArgs[Keys::DatasetId] = dataset.value(Keys::DatasetId).toInt(); |
| 1619 | optArgs[QStringLiteral("options")] = QJsonArray::fromStringList(slugs); |
| 1620 | |
| 1621 | const auto optReply = runCommand(QStringLiteral("project.dataset.setOptions"), optArgs); |
| 1622 | steps.append(QJsonObject{ |
| 1623 | { QStringLiteral("command"), QStringLiteral("project.dataset.setOptions")}, |
| 1624 | { QStringLiteral("ok"), optReply.value(QStringLiteral("ok")).toBool()}, |
| 1625 | {QStringLiteral("arguments"), optArgs} |
| 1626 | }); |
| 1627 | return optReply; |
| 1628 | } |
| 1629 | |
| 1630 | /** |
| 1631 | * @brief Patches dataset min/max ranges from the optional `ranges` request payload. |
no test coverage detected