Fix an issue when editing rule action params
This commit is contained in:
parent
aa411c7dc2
commit
ce6902013a
@ -196,7 +196,7 @@ void RuleManager::getRuleDetailsResponse(int commandId, const QVariantMap ¶m
|
|||||||
parseRuleExitActions(ruleMap.value("exitActions").toList(), rule);
|
parseRuleExitActions(ruleMap.value("exitActions").toList(), rule);
|
||||||
parseTimeDescriptor(ruleMap.value("timeDescriptor").toMap(), rule);
|
parseTimeDescriptor(ruleMap.value("timeDescriptor").toMap(), rule);
|
||||||
rule->setStateEvaluator(parseStateEvaluator(ruleMap.value("stateEvaluator").toMap()));
|
rule->setStateEvaluator(parseStateEvaluator(ruleMap.value("stateEvaluator").toMap()));
|
||||||
// qDebug() << "** Rule details received:" << rule;
|
qCDebug(dcRuleManager()) << "Rule details received:" << rule;
|
||||||
// qDebug() << "Rule JSON:" << qUtf8Printable(QJsonDocument::fromVariant(ruleMap).toJson());
|
// qDebug() << "Rule JSON:" << qUtf8Printable(QJsonDocument::fromVariant(ruleMap).toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -181,6 +181,16 @@ RuleActionParam *RuleActionParams::get(int index) const
|
|||||||
return m_list.at(index);
|
return m_list.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RuleActionParam *RuleActionParams::getParam(const QUuid ¶mTypeId)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_list.count(); i++) {
|
||||||
|
if (m_list.at(i)->paramTypeId() == paramTypeId) {
|
||||||
|
return m_list.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool RuleActionParams::hasRuleActionParam(const QString ¶mTypeId) const
|
bool RuleActionParams::hasRuleActionParam(const QString ¶mTypeId) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_list.count(); i++) {
|
for (int i = 0; i < m_list.count(); i++) {
|
||||||
|
|||||||
@ -64,6 +64,7 @@ public:
|
|||||||
Q_INVOKABLE void setRuleActionParamStateByName(const QString ¶mName, const QString &stateThingId, const QString &stateTypeId);
|
Q_INVOKABLE void setRuleActionParamStateByName(const QString ¶mName, const QString &stateThingId, const QString &stateTypeId);
|
||||||
|
|
||||||
Q_INVOKABLE RuleActionParam* get(int index) const;
|
Q_INVOKABLE RuleActionParam* get(int index) const;
|
||||||
|
Q_INVOKABLE RuleActionParam* getParam(const QUuid ¶mTypeId);
|
||||||
|
|
||||||
Q_INVOKABLE bool hasRuleActionParam(const QString ¶mTypeId) const;
|
Q_INVOKABLE bool hasRuleActionParam(const QString ¶mTypeId) const;
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ Page {
|
|||||||
paramType: root.actionType.paramTypes.get(index)
|
paramType: root.actionType.paramTypes.get(index)
|
||||||
enabled: staticParamRadioButton.checked
|
enabled: staticParamRadioButton.checked
|
||||||
nameVisible: false
|
nameVisible: false
|
||||||
value: root.ruleAction.ruleActionParams.get(index).value
|
value: root.ruleAction.ruleActionParams.getParam(root.actionType.paramTypes.get(index).id).value
|
||||||
visible: staticParamRadioButton.checked
|
visible: staticParamRadioButton.checked
|
||||||
placeholderText: qsTr("Insert value here")
|
placeholderText: qsTr("Insert value here")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user