-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
41 lines (32 loc) · 1.13 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Deployments = new Meteor.Collection("deployments");
//$('.nav-tabs').button()
if (Meteor.isServer) {
Meteor.startup(function () {
if (Deployments.find().count() === 0) {
Meteor.http.get("http://puppi-deployments.meteor.com/deployments.json", function(error,results){
var i = 1;
console.log(i);
var myServerHash= {};
JSON.parse(results.content).forEach(function(d) {
if (! myServerHash[d.fqdn]) {
myServerHash[d.fqdn] = i++;
}
d.fqdnid = myServerHash[d.fqdn];
// normalize the timestamp:
//myDate = new Date(d.ts.$date ).setMinutes(0);
//d.date = new Date(myDate).setHours(0);
d.date = new Date(d.ts.$date).getTime();
d.ts = new Date(d.ts.$date);
d.desc = d.environment + "\n" + d.fqdn + "\n" + d.ts + "\n" + d.project+":"+d.version + "\n" + d.result;
delete d._id;
Deployments.insert(d);
});
});
}
});
// We should turn off autopublish sooner or later
/* Meteor.publish("deployments", function () {
console.log("new client, let's publish+"+Deployments.find().count());
return Deployments.find(); // everything
} ); */
}