diff --git a/app/.meteor/packages b/app/.meteor/packages index f9a45b9..8738548 100644 --- a/app/.meteor/packages +++ b/app/.meteor/packages @@ -16,8 +16,6 @@ standard-minifiers # JS/CSS minifiers run for production mode es5-shim # ECMAScript 5 compatibility for older browsers. ecmascript # Enable ECMAScript2015+ syntax in app code -autopublish # Publish all data to the clients (for prototyping) -insecure # Allow all DB writes from clients (for prototyping) less huttonr:bootstrap3 nimble:restivus diff --git a/app/.meteor/versions b/app/.meteor/versions index fe6158d..c0b39db 100644 --- a/app/.meteor/versions +++ b/app/.meteor/versions @@ -1,7 +1,6 @@ accounts-base@1.2.2 accounts-password@1.1.4 amplify@1.0.0 -autopublish@1.0.4 autoupdate@1.2.4 babel-compiler@5.8.24_1 babel-runtime@0.1.4 @@ -38,7 +37,6 @@ http@1.1.1 huttonr:bootstrap3@3.3.6_6 huttonr:bootstrap3-assets@3.3.6_2 id-map@1.0.4 -insecure@1.0.4 jquery@1.11.4 json@1.0.3 launch-screen@1.0.4 diff --git a/app/client/app.less b/app/client/app.less index 86e3a66..c827e72 100644 --- a/app/client/app.less +++ b/app/client/app.less @@ -9,5 +9,5 @@ #bucket_image { - width: 30%; + width: 60%; } diff --git a/app/client/startup.js b/app/client/startup.js new file mode 100644 index 0000000..1a3518a --- /dev/null +++ b/app/client/startup.js @@ -0,0 +1,8 @@ +Tracker.autorun(function () { + var id = Session.get('controller_id'); + if (id) { + Meteor.subscribe("sensor_data", id); + var hamo = Meteor.subscribe("controller_state", id); + console.log(hamo); + } +}); diff --git a/app/client/state.js b/app/client/state.js index 412a09a..6264cd0 100644 --- a/app/client/state.js +++ b/app/client/state.js @@ -1,12 +1,7 @@ function controller_state() { - var controller = Session.get('controller_id'); - var result = {} - if (controller) { - result = ControllerState.findOne({ - controller_id: controller - }); - } - + var controllerId = Session.get('controller_id'); + result = ControllerState.findOne({}); + console.log("jupiii", result); if (!result) { result = {} }; diff --git a/app/server/publications.js b/app/server/publications.js new file mode 100644 index 0000000..cd14e21 --- /dev/null +++ b/app/server/publications.js @@ -0,0 +1,18 @@ +// This code only runs on the server +Meteor.publish("sensor_data", function(controllerId) { + return SensorData.find({ + controllerId: controllerId + }, { + sort: { + created_at: -1 + }, + limit: 100 + }); +}); + +// This code only runs on the server +Meteor.publish("controller_state", function(controllerId) { + return ControllerState.find({ + controller_id: controllerId + }); +});