2 XObject = imports.XObject.XObject;
3 XMLHttpRequest = imports.XMLHttpRequest.XMLHttpRequest;
4 Netrc = imports.Netrc.Netrc;
5 Date = imports.Date.Date;
13 * => Tasks.notify(commit)
23 commitRepo : false, // the DB version of repo info..
26 notify : function(commit)
29 // ignore the notification.. we are currently checking what the current
34 this.lastCommit = commit;
41 // have we got the status in the last 15 mins..
42 // we should not need to get it again... - it's probably not changed.
43 if (this.curTask && !this.curTask.hasExpired()) {
47 // do the request to get the task..
48 var r = new XMLHttpRequest({
49 onreadystatechange : function() {
51 if (this.status != 4) {
56 var res = JSON.parse(this.responseText);
58 //print(JSON.stringify(res,null,4))
59 //print([ res.success , res.data.length ]);
60 _this.curTask = (res.success && res.data.length) ? (new Task(res.data[0])) : false;
61 print(JSON.stringify(_this.curTask,null,4));
66 var netrc = Netrc.forHost('git.roojs.com');
69 "http://roojs.com/admin.php/Roo/cash_invoice_entry?_current_task=1"
70 ,true, netrc.login, netrc.password );
71 //print("SEding request");
76 verifyCommit : function()
78 // using curTask + lastCommit decide what to do.
88 repoProject: function(repo)
90 var r = new XMLHttpRequest({
91 onreadystatechange : function() {
93 if (this.status != 4) {
98 var res = JSON.parse(this.responseText);
100 //print(JSON.stringify(res,null,4))
101 //print([ res.success , res.data.length ]);
102 _this.currRepo = (res.success && res.data.length) ? currRepores.data[0] : false;
104 _this.verifyCommit();
108 var netrc = Netrc.forHost('git.roojs.com');
111 "http://roojs.com/admin.php/Roo/mtrack_repo?name=" + repo.name
112 ,true, netrc.login, netrc.password );
113 //print("SEding request");
130 Task = XObject.define(
133 if (typeof(cfg) != 'object') {
134 print("CFG not oboject?");
137 XObject.extend(this,cfg);
139 // fix up the values.
140 this.action_datetime = Date.parseDate(this.action_dt,'Y-m-d H:i:s');
141 // print("ACT DT: " + this.action_dt);
147 * This is similar to the cash_invoice_entry data..
150 action_dt: '', //"2012-11-23 11:00:00"
151 description: '', //"QA on new site"
152 qtyvalue: 0, //"2.25"
154 hasExpired : function()
157 var exp = this.action_datetime.add(Date.HOUR, this.qtyvalue);
158 return (new Date()) > exp;
173 //-------------- testing
174 Gtk = imports.gi.Gtk;