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)
28 if (this.inQuery && this.inQuery > (new Date())) {
29 // ignore the notification.. we are currently checking what the current
32 // we need to handle a WTF situation where something below failed... so
36 this.inQuery = (new Date()).add(Date.MINUTE, 5);
37 this.lastCommit = commit;
38 this.commitRepo = false;
46 // have we got the status in the last 15 mins..
47 // we should not need to get it again... - it's probably not changed.
48 if (this.curTask && !this.curTask.hasExpired()) {
52 // do the request to get the task..
53 var r = new XMLHttpRequest({
54 onreadystatechange : function() {
56 if (this.status != 4) {
61 var res = JSON.parse(this.responseText);
63 //print(JSON.stringify(res,null,4))
64 //print([ res.success , res.data.length ]);
65 _this.curTask = (res.success && res.data.length) ? (new Task(res.data[0])) : false;
66 print(JSON.stringify(_this.curTask,null,4));
71 var netrc = Netrc.forHost('git.roojs.com');
74 "http://roojs.com/admin.php/Roo/cash_invoice_entry?_current_task=1"
75 ,true, netrc.login, netrc.password );
76 //print("SEding request");
81 verifyCommit : function()
83 // using curTask + lastCommit decide what to do.
96 var repo = commit.reop;
98 var r = new XMLHttpRequest({
99 onreadystatechange : function() {
100 print("Got result.");
101 if (this.status != 4) {
106 var res = JSON.parse(this.responseText);
108 //print(JSON.stringify(res,null,4))
109 //print([ res.success , res.data.length ]);
110 _this.commitRepo = (res.success && res.data.length) ? currRepores.data[0] : false;
111 print(JSON.stringify(_this.commit))
112 _this.verifyCommit();
116 var netrc = Netrc.forHost('git.roojs.com');
119 "http://roojs.com/admin.php/Roo/mtrack_repo?name=" + repo.name
120 ,true, netrc.login, netrc.password );
121 //print("SEding request");
138 Task = XObject.define(
141 if (typeof(cfg) != 'object') {
142 print("CFG not oboject?");
145 XObject.extend(this,cfg);
147 // fix up the values.
148 this.action_datetime = Date.parseDate(this.action_dt,'Y-m-d H:i:s');
149 // print("ACT DT: " + this.action_dt);
155 * This is similar to the cash_invoice_entry data..
158 action_dt: '', //"2012-11-23 11:00:00"
159 description: '', //"QA on new site"
160 qtyvalue: 0, //"2.25"
162 hasExpired : function()
165 var exp = this.action_datetime.add(Date.HOUR, this.qtyvalue);
166 return (new Date()) > exp;
181 //-------------- testing
182 Gtk = imports.gi.Gtk;