Merge PR #510: Rename Devices to Things in tags api
This commit is contained in:
commit
757db9dbdb
@ -68,11 +68,11 @@ Tags *TagsManager::tags() const
|
|||||||
return m_tags;
|
return m_tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TagsManager::tagDevice(const QString &deviceId, const QString &tagId, const QString &value)
|
int TagsManager::tagThing(const QString &thingId, const QString &tagId, const QString &value)
|
||||||
{
|
{
|
||||||
QVariantMap params;
|
QVariantMap params;
|
||||||
QVariantMap tag;
|
QVariantMap tag;
|
||||||
tag.insert("deviceId", deviceId);
|
tag.insert("deviceId", thingId);
|
||||||
tag.insert("appId", "nymea:app");
|
tag.insert("appId", "nymea:app");
|
||||||
tag.insert("tagId", tagId);
|
tag.insert("tagId", tagId);
|
||||||
tag.insert("value", value);
|
tag.insert("value", value);
|
||||||
@ -80,11 +80,11 @@ int TagsManager::tagDevice(const QString &deviceId, const QString &tagId, const
|
|||||||
return m_jsonClient->sendCommand("Tags.AddTag", params, this, "addTagReply");
|
return m_jsonClient->sendCommand("Tags.AddTag", params, this, "addTagReply");
|
||||||
}
|
}
|
||||||
|
|
||||||
int TagsManager::untagDevice(const QString &deviceId, const QString &tagId)
|
int TagsManager::untagThing(const QString &thingId, const QString &tagId)
|
||||||
{
|
{
|
||||||
QVariantMap params;
|
QVariantMap params;
|
||||||
QVariantMap tag;
|
QVariantMap tag;
|
||||||
tag.insert("deviceId", deviceId);
|
tag.insert("deviceId", thingId);
|
||||||
tag.insert("appId", "nymea:app");
|
tag.insert("appId", "nymea:app");
|
||||||
tag.insert("tagId", tagId);
|
tag.insert("tagId", tagId);
|
||||||
params.insert("tag", tag);
|
params.insert("tag", tag);
|
||||||
|
|||||||
@ -52,8 +52,8 @@ public:
|
|||||||
|
|
||||||
Tags* tags() const;
|
Tags* tags() const;
|
||||||
|
|
||||||
Q_INVOKABLE int tagDevice(const QString &deviceId, const QString &tagId, const QString &value);
|
Q_INVOKABLE int tagThing(const QString &thingId, const QString &tagId, const QString &value);
|
||||||
Q_INVOKABLE int untagDevice(const QString &deviceId, const QString &tagId);
|
Q_INVOKABLE int untagThing(const QString &thingId, const QString &tagId);
|
||||||
Q_INVOKABLE int tagRule(const QString &ruleId, const QString &tagId, const QString &value);
|
Q_INVOKABLE int tagRule(const QString &ruleId, const QString &tagId, const QString &value);
|
||||||
Q_INVOKABLE int untagRule(const QString &ruleId, const QString &tagId);
|
Q_INVOKABLE int untagRule(const QString &ruleId, const QString &tagId);
|
||||||
|
|
||||||
|
|||||||
@ -59,9 +59,9 @@ AutoSizeMenu {
|
|||||||
}
|
}
|
||||||
function toggleFavorite() {
|
function toggleFavorite() {
|
||||||
if (favoritesProxy.count === 0) {
|
if (favoritesProxy.count === 0) {
|
||||||
engine.tagsManager.tagDevice(root.thing.id, "favorites", 100000)
|
engine.tagsManager.tagThing(root.thing.id, "favorites", 100000)
|
||||||
} else {
|
} else {
|
||||||
engine.tagsManager.untagDevice(root.thing.id, "favorites")
|
engine.tagsManager.untagThing(root.thing.id, "favorites")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function addToGroup() {
|
function addToGroup() {
|
||||||
@ -119,7 +119,7 @@ AutoSizeMenu {
|
|||||||
text: qsTr("OK")
|
text: qsTr("OK")
|
||||||
enabled: newGroupdTextField.displayText.length > 0 && !groupTags.containsId("group-" + newGroupdTextField.displayText)
|
enabled: newGroupdTextField.displayText.length > 0 && !groupTags.containsId("group-" + newGroupdTextField.displayText)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
engine.tagsManager.tagDevice(root.thing.id, "group-" + newGroupdTextField.text, 1000)
|
engine.tagsManager.tagThing(root.thing.id, "group-" + newGroupdTextField.text, 1000)
|
||||||
newGroupdTextField.text = ""
|
newGroupdTextField.text = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,9 +146,9 @@ AutoSizeMenu {
|
|||||||
checked: innerProxy.count > 0
|
checked: innerProxy.count > 0
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (innerProxy.count == 0) {
|
if (innerProxy.count == 0) {
|
||||||
engine.tagsManager.tagDevice(root.thing.id, model.tagId, 1000)
|
engine.tagsManager.tagThing(root.thing.id, model.tagId, 1000)
|
||||||
} else {
|
} else {
|
||||||
engine.tagsManager.untagDevice(root.thing.id, model.tagId, model.value)
|
engine.tagsManager.untagThing(root.thing.id, model.tagId, model.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThingsProxy {
|
ThingsProxy {
|
||||||
|
|||||||
@ -155,7 +155,7 @@ MainViewBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tag = tagsProxy.get(i);
|
var tag = tagsProxy.get(i);
|
||||||
engine.tagsManager.tagDevice(tag.deviceId, tag.tagId, newIdx);
|
engine.tagsManager.tagThing(tag.thingId, tag.tagId, newIdx);
|
||||||
}
|
}
|
||||||
from = index;
|
from = index;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user