Merge PR #413: Fix more views that broke on the LogsModel transition
This commit is contained in:
commit
7f1976fb0f
@ -53,35 +53,19 @@ DevicePageBase {
|
|||||||
id: logView
|
id: logView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
logsModel: engine.jsonRpcClient.ensureServerVersion("1.10") ? logsModelNg : logsModel
|
logsModel: LogsModel {
|
||||||
LogsModelNg {
|
|
||||||
id: logsModelNg
|
|
||||||
engine: _engine
|
|
||||||
deviceId: root.device.id
|
|
||||||
live: true
|
|
||||||
typeIds: {
|
|
||||||
var ret = [];
|
|
||||||
ret.push(root.deviceClass.eventTypes.findByName("pressed").id)
|
|
||||||
if (root.deviceClass.eventTypes.findByName("longPressed")) {
|
|
||||||
ret.push(root.deviceClass.eventTypes.findByName("longPressed").id)
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LogsModel {
|
|
||||||
id: logsModel
|
id: logsModel
|
||||||
engine: _engine
|
engine: _engine
|
||||||
deviceId: root.device.id
|
thingId: root.thing.id
|
||||||
live: true
|
live: true
|
||||||
typeIds: {
|
typeIds: {
|
||||||
var ret = [];
|
var ret = [];
|
||||||
ret.push(root.deviceClass.eventTypes.findByName("pressed").id)
|
ret.push(root.thing.thingClass.eventTypes.findByName("pressed").id)
|
||||||
if (root.deviceClass.eventTypes.findByName("longPressed")) {
|
if (root.thing.thingClass.eventTypes.findByName("longPressed")) {
|
||||||
ret.push(root.deviceClass.eventTypes.findByName("longPressed").id)
|
ret.push(root.thing.thingClass.eventTypes.findByName("longPressed").id)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
Component.onCompleted: update()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAddRuleClicked: {
|
onAddRuleClicked: {
|
||||||
@ -89,17 +73,17 @@ DevicePageBase {
|
|||||||
var typeId = logView.logsModel.get(index).typeId
|
var typeId = logView.logsModel.get(index).typeId
|
||||||
var rule = engine.ruleManager.createNewRule();
|
var rule = engine.ruleManager.createNewRule();
|
||||||
var eventDescriptor = rule.eventDescriptors.createNewEventDescriptor();
|
var eventDescriptor = rule.eventDescriptors.createNewEventDescriptor();
|
||||||
eventDescriptor.deviceId = device.id;
|
eventDescriptor.deviceId = root.thing.id;
|
||||||
var eventType = root.deviceClass.eventTypes.getEventType(typeId);
|
var eventType = root.thing.thingClass.eventTypes.getEventType(typeId);
|
||||||
eventDescriptor.eventTypeId = eventType.id;
|
eventDescriptor.eventTypeId = eventType.id;
|
||||||
rule.name = root.device.name + " - " + eventType.displayName;
|
rule.name = root.thing.name + " - " + eventType.displayName;
|
||||||
if (eventType.paramTypes.count === 1) {
|
if (eventType.paramTypes.count === 1) {
|
||||||
var paramType = eventType.paramTypes.get(0);
|
var paramType = eventType.paramTypes.get(0);
|
||||||
eventDescriptor.paramDescriptors.setParamDescriptor(paramType.id, value, ParamDescriptor.ValueOperatorEquals);
|
eventDescriptor.paramDescriptors.setParamDescriptor(paramType.id, value, ParamDescriptor.ValueOperatorEquals);
|
||||||
rule.eventDescriptors.addEventDescriptor(eventDescriptor);
|
rule.eventDescriptors.addEventDescriptor(eventDescriptor);
|
||||||
rule.name = rule.name + " - " + value
|
rule.name = rule.name + " - " + value
|
||||||
}
|
}
|
||||||
var rulePage = pageStack.push(Qt.resolvedUrl("../magic/DeviceRulesPage.qml"), {device: root.device});
|
var rulePage = pageStack.push(Qt.resolvedUrl("../magic/DeviceRulesPage.qml"), {device: root.thing});
|
||||||
rulePage.addRule(rule);
|
rulePage.addRule(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,20 +68,11 @@ DevicePageBase {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
logsModel: engine.jsonRpcClient.ensureServerVersion("1.10") ? logsModelNg : logsModel
|
logsModel: LogsModel {
|
||||||
LogsModelNg {
|
|
||||||
id: logsModelNg
|
|
||||||
deviceId: root.device.id
|
|
||||||
engine: _engine
|
|
||||||
live: true
|
|
||||||
typeIds: [root.accessGrantedEventType.id, root.accessDeniedEventType.id];
|
|
||||||
}
|
|
||||||
LogsModel {
|
|
||||||
id: logsModel
|
id: logsModel
|
||||||
deviceId: root.device.id
|
thingId: root.device.id
|
||||||
engine: _engine
|
engine: _engine
|
||||||
live: true
|
live: true
|
||||||
Component.onCompleted: update()
|
|
||||||
typeIds: [root.accessGrantedEventType.id, root.accessDeniedEventType.id];
|
typeIds: [root.accessGrantedEventType.id, root.accessDeniedEventType.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -113,21 +113,11 @@ DevicePageBase {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
logsModel: engine.jsonRpcClient.ensureServerVersion("1.10") ? logsModelNg : logsModel
|
logsModel: LogsModel {
|
||||||
LogsModelNg {
|
|
||||||
id: logsModelNg
|
|
||||||
deviceId: root.device.id
|
|
||||||
engine: _engine
|
|
||||||
live: true
|
|
||||||
typeIds: [root.deviceClass.actionTypes.findByName("notify").id];
|
|
||||||
}
|
|
||||||
|
|
||||||
LogsModel {
|
|
||||||
id: logsModel
|
id: logsModel
|
||||||
deviceId: root.device.id
|
thingId: root.device.id
|
||||||
live: true
|
|
||||||
engine: _engine
|
engine: _engine
|
||||||
Component.onCompleted: update()
|
live: true
|
||||||
typeIds: [root.deviceClass.actionTypes.findByName("notify").id];
|
typeIds: [root.deviceClass.actionTypes.findByName("notify").id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,17 +59,6 @@ Page {
|
|||||||
onBackPressed: pageStack.pop()
|
onBackPressed: pageStack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
LogsModel {
|
|
||||||
id: logsModel
|
|
||||||
engine: _engine
|
|
||||||
deviceId: root.device.id
|
|
||||||
live: true
|
|
||||||
Component.onCompleted: {
|
|
||||||
update()
|
|
||||||
}
|
|
||||||
typeIds: [root.stateType.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
LogsModelNg {
|
LogsModelNg {
|
||||||
id: logsModelNg
|
id: logsModelNg
|
||||||
engine: _engine
|
engine: _engine
|
||||||
|
|||||||
Reference in New Issue
Block a user