|
1 | 1 | declare var Collections : any;
|
2 | 2 | declare var TuxLog : any;
|
3 | 3 |
|
| 4 | +var Session = require('../api/lab.session.js'); |
4 | 5 | Meteor.methods({
|
5 | 6 |
|
6 |
| - /** prepareLab: prepares a labExec object for the current user |
7 |
| - * takes the id of the lab and a callback as parameter |
8 |
| - * callback: (err,parseTasks,labExec) |
| 7 | + /**prepareLab: prepares a labExec object for the current user |
| 8 | + * takes the id of the lab and a callback as parameter |
| 9 | + * callback: (err,pass) |
| 10 | + * implement loading wheel, md fetch, course record create in callback |
9 | 11 | */
|
10 |
| - 'prepareLab' : function(labId : number, callback : any){ |
11 |
| - var session = require('../api/lab.session.js'); |
12 |
| - var userid = Meteor.userId(); |
13 |
| - |
14 |
| - /** session.init(userId,labId,cb) |
15 |
| - * cb(err,parsedTasks) cache session in cb, get rid of parsedTasks if unnecessary |
16 |
| - * implement loading wheel here -in callback |
17 |
| - * session.env.getPass(cb) callback(pass) is called, call this here and then call the prepareLab callback |
18 |
| - * what to put in res of callback(err,res)? session obj? true/false? session id?... |
19 |
| - * get task md -frontend |
20 |
| - * create course record |
21 |
| - */ |
22 |
| - session.init(userid,labId,function(err,res){ |
23 |
| - session.env.getPass(function(err,pass){ |
24 |
| - if(err){ |
25 |
| - TuxLog.log("debug","error getting pass from labVm container: "+err); |
26 |
| - callback("Internal Service Error",null); |
27 |
| - } |
28 |
| - else{ |
29 |
| - var resp = {'pass': pass} |
30 |
| - callback(null, resp); |
31 |
| - } |
32 |
| - }); |
33 |
| - }); |
| 12 | + 'prepareLab': function(labId : number, callback : any){ |
| 13 | + var session = Session(); |
| 14 | + var uId = Meteor.userId(); |
| 15 | + session.init(uId,labId,callback); |
34 | 16 | },
|
35 | 17 | 'startLab': function(callback : any){
|
36 | 18 | /** somehow get session,
|
|
0 commit comments