37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
Template.newConfigurationDialog.events({
|
|
"click .save-config-btn": function(event, template) {
|
|
// console.log(template.data.machineId);
|
|
// var text = template.find('.machine-name').value; //vent.target.machineName.value;
|
|
var machine = Machines.findOne({
|
|
machineId: template.data.machineId
|
|
});
|
|
|
|
var configDescription = template.find('.configuration-description').value;
|
|
var configType = template.find('.config-type').value;
|
|
|
|
if (machine) {
|
|
Machines.update({
|
|
_id: machine._id
|
|
}, {
|
|
$push: {
|
|
configurations: {
|
|
machineId: machine.machineId,
|
|
_id: (new Mongo.ObjectID()).toHexString(),
|
|
description: configDescription,
|
|
type: configType
|
|
}
|
|
}
|
|
});
|
|
|
|
// db.students.update(
|
|
// { _id: 1 },
|
|
// { $push: { scores: 89 } }
|
|
// )
|
|
}
|
|
Session.set('newConfigurationRequested', false);
|
|
},
|
|
"click .cancel-save-config-btn": function(event, template) {
|
|
Session.set('newConfigurationRequested', false);
|
|
}
|
|
});
|