You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

isDebug = true;
useSingalR = false; dataUrl = iotCenter + '/App/GetProducts';
data = function data() {
return {
f7params: f7params,
server: localStorage.getItem('server'),
token: localStorage.getItem('token'),
model: {
Products: [],
Scenes: []
}
};
}
methods = {
GetProducts() {
return Enumerable.from(this.model.Products).orderBy('o=>o.DisplayOrder').toArray();
},
GetScenes() {
return Enumerable.from(this.model.Scenes).orderBy('o=>o.DisplayOrder').toArray();
},
CallScene(id) {
ajax('/App/ExecGlobalScene', { token: token, connectionId: connectionId, id: id }, 'post');
}
};
function onMessage(method, json, to, from) {
debug(method + ':' + json);
var item = JSON.parse(json);
console.log(method + ':' + json);
var item = JSON.parse(json);
if (method == 'ProductEntityInserted' ||
method == 'ProductEntityUpdated' ||
method == 'ProductEntityDeleted' ||
method == 'DeviceEntityInserted' ||
method == 'DeviceEntityDeleted' ||
method == 'DeviceEntityDeleted') {
loadData();
}
else if (method == 'SceneEntityInserted' ||
method == 'SceneEntityUpdated' ||
method == 'SceneEntityDeleted') {
if (item.NodeId == null) {
loadData();
}
}
}
start();