picture display ready
This commit is contained in:
@@ -130,21 +130,6 @@ Api.addRoute('picture/:id', {
|
||||
'time': new Date()
|
||||
}
|
||||
});
|
||||
},
|
||||
get: function() {
|
||||
var id = this.urlParams.id;
|
||||
var res = this.response;
|
||||
var picture_src = "/images/noImage.png";
|
||||
var pictureEntry = Picture.findOne({
|
||||
controller_id: id
|
||||
});
|
||||
if (pictureEntry) {
|
||||
var imageData = pictureEntry.picture_base64;
|
||||
picture_src = "data:image/jpeg;charset=utf-8;base64," + imageData;
|
||||
}
|
||||
return {
|
||||
picture: picture_src
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -52,6 +52,17 @@ function setInValveTo(controller_id, nextState) {
|
||||
|
||||
}
|
||||
|
||||
function requestNewPicture(controller_id) {
|
||||
var state = controller_state(controller_id);
|
||||
ControllerState.update(state._id, {
|
||||
'$set': {
|
||||
'state.picture_requested': 'true',
|
||||
'time': new Date(),
|
||||
'set_by': 'server'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function openInValve(controller_id) {
|
||||
var state = controller_state(controller_id);
|
||||
var config = state.config;
|
||||
@@ -174,5 +185,6 @@ Meteor.methods({
|
||||
openInValve: openInValve,
|
||||
closeInValve: closeInValve,
|
||||
clearLog: clearLog,
|
||||
saveControllerConfig: saveControllerConfig
|
||||
saveControllerConfig: saveControllerConfig,
|
||||
requestNewPicture: requestNewPicture
|
||||
});
|
||||
|
||||
@@ -16,3 +16,11 @@ Meteor.publish("controller_state", function(controllerId) {
|
||||
controller_id: controllerId
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// This code only runs on the server
|
||||
Meteor.publish("pictures", function(controllerId) {
|
||||
return Picture.find({
|
||||
controller_id: controllerId
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user