- progress
This commit is contained in:
@@ -1,12 +1,51 @@
|
||||
Machines = new Mongo.Collection("machines");
|
||||
|
||||
Meteor.startup(function() {
|
||||
|
||||
Meteor.methods({
|
||||
updateConfiguration: function (machineId, configId, data) {
|
||||
console.log('saving !!!!', machineId, configId, data);
|
||||
Machines.update({
|
||||
machineId: machineId,
|
||||
"configurations._id": configId
|
||||
}, {
|
||||
$set: {
|
||||
"configurations.$.content": data.content,
|
||||
"configurations.$.filePath": data.filePath,
|
||||
"configurations.$.description": data.description
|
||||
}
|
||||
});
|
||||
return "ok";
|
||||
}
|
||||
});
|
||||
var bodyParser = Meteor.npmRequire('body-parser');
|
||||
Picker.middleware(bodyParser.urlencoded({ extended: false }));
|
||||
Picker.middleware(bodyParser.json());
|
||||
// code to run on server at startup
|
||||
Picker.route('/api/machines', function(params, req, res, next) {
|
||||
var allMachines = Machines.find({});
|
||||
res.end(JSON.stringify(allMachines.fetch()));
|
||||
});
|
||||
|
||||
Picker.route('/api/machine', function(params, req, res, next) {
|
||||
console.log(params, req.body);
|
||||
// Hostname string
|
||||
// Platform string
|
||||
// Architecture string
|
||||
// MachineGuid string
|
||||
var data = req.body;
|
||||
Machines.update({
|
||||
machineId: data.MachineGuid
|
||||
}, {
|
||||
hostname: data.Hostname,
|
||||
status: 'OK',
|
||||
platform: data.Platform,
|
||||
architecture: data.Architecture
|
||||
});
|
||||
// return res.end()"ok";
|
||||
res.end("ok");
|
||||
});
|
||||
|
||||
Picker.route('/api/templates/:type', function(params, req, res, next) {
|
||||
var type = params.type;
|
||||
var fs = Meteor.npmRequire('fs');
|
||||
|
||||
Reference in New Issue
Block a user