GitMonitor.js
[gitlive] / FixBug.js
index 4274c1b..813382c 100644 (file)
--- a/FixBug.js
+++ b/FixBug.js
@@ -22,6 +22,9 @@ FixBug=new XObject({
             this.el.fullscreen();
             this.el.grab_focus();
             this.el.set_keep_above(true);
+            
+            this.get('/today-vew').load();
+            
         }
     },
     border_width : 3,
@@ -167,7 +170,27 @@ FixBug=new XObject({
                                             xtype: Gtk.Entry,
                                             listeners : {
                                                 key_release_event : function (self, event) {
-                                                    print(JSON.stringify(event,null,4)); //.keyval);
+                                                    if (event.key.keyval == Gdk.KEY_Return) {;
+                                                        // same code as button press..
+                                                         var active_id = this.get('/project-select').el.get_active();
+                                                     
+                                                        var project_id = this.get('/project-select').raw_data[active_id].id;
+                                                        
+                                                        var str = this.get('/search-entry').el.get_text();
+                                                        
+                                                        print(str);
+                                                        
+                                                        var _t = this;
+                                                        
+                                                        imports.Tasks.Tasks.query({
+                                                            project_id : project_id,
+                                                            'query[filter]' : 'me',
+                                                            'query[search]' : str
+                                                        }, function(res) { 
+                                                           // print(JSON.stringify(res,null,4));
+                                                            _t.get('/ticket-store').loadData(res);
+                                                        });
+                                                    }
                                                     return true;
                                                 }
                                             },
@@ -211,10 +234,33 @@ FixBug=new XObject({
                                     items : [
                                         {
                                             xtype: Gtk.TreeView,
-                                            fixed_height_mode : true,
+                                            listeners : {
+                                                cursor_changed : function (self) {
+                                                    
+                                                    var ret = {};
+                                                    this.selection.get_selected(ret);
+                                                
+                                                    // var val = "";
+                                                    var value = ''+ret.model.get_value(ret.iter, 0).value.get_string();
+                                                    
+                                                    print(value);
+                                                    var rec = false;
+                                                    this.get('/ticket-store').data.forEach( function(e) {
+                                                        if (e.id == value) {
+                                                            rec = e;
+                                                            return  false;
+                                                        }
+                                                    });
+                                                    // update the text box with the ticket data..
+                                                    this.get('/view').show(rec);
+                                                    //print(rec);
+                                                
+                                                }
+                                            },
                                             id : "ticket-view",
                                             pack : "add",
                                             can_focus : true,
+                                            fixed_height_mode : false,
                                             headers_visible : false,
                                             init : function() {
                                                 XObject.prototype.init.call(this);
@@ -265,7 +311,10 @@ FixBug=new XObject({
                                                     },
                                                     loadData : function (data) {
                                                             print("loading data");
-                                                                                        
+                                                        
+                                                        
+                                                        this.data = data;
+                                                                              
                                                         var el = this.el;
                                                         this.el.clear();
                                                         data.forEach(function(p) {
@@ -273,13 +322,15 @@ FixBug=new XObject({
                                                             el.append(ret);
                                                            //print("ADD " + p.name);
                                                              
+                                                           var line =    '[' + p.status_name + '] <b>'   + 
+                                                                 GLib.markup_escape_text(p.summary, p.summary.length)  + "</b>\n"  +
+                                                                 '<span color="#666">' + 
+                                                                 GLib.markup_escape_text(p.description,p.description.length).split("\n").slice(0,3).join("\n") +
+                                                                 '</span>';
+                                                             print(line);
+                                                             
                                                             el.set_value(ret.iter, 0, p.id);
-                                                            el.set_value(ret.iter, 1,   '<b>#' + p.id + '</b>' + 
-                                                                '[' + p.status_name + '] <b>'   + p.summary  + "</b>\n"  +
-                                                                 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
-                                                                 '</span>'
-                                                                 
-                                                                  );
+                                                            el.set_value(ret.iter, 1,   '<b>#' + p.id + '</b>' +  line );
                                                             
                                                         });
                                                                   
@@ -307,7 +358,6 @@ FixBug=new XObject({
                                                 {
                                                     xtype: Gtk.TreeViewColumn,
                                                     pack : "append_column",
-                                                    sizing : Gtk.TreeViewColumnSizing.FIXED,
                                                     init : function() {
                                                         XObject.prototype.init.call(this);
                                                         this.el.add_attribute(this.items[0].el , 'markup', 1 );
@@ -326,130 +376,147 @@ FixBug=new XObject({
                             ]
                         },
                         {
-                            xtype: Gtk.VBox,
+                            xtype: Gtk.HPaned,
                             pack : "add",
                             items : [
                                 {
-                                    xtype: Gtk.HBox,
-                                    pack : "pack_start,false,true,3",
-                                    items : [
-                                        {
-                                            xtype: Gtk.Label,
-                                            label : "I am doing this:",
-                                            pack : "pack_start,false,true,3"
-                                        },
-                                        {
-                                            xtype: Gtk.Entry,
-                                            pack : "pack_start,true,true,3"
-                                        }
-                                    ]
-                                },
-                                {
-                                    xtype: Gtk.HBox,
-                                    pack : "pack_start,false,true,3",
+                                    xtype: Gtk.VBox,
+                                    pack : "pack1,true,true",
                                     items : [
                                         {
-                                            xtype: Gtk.Label,
-                                            label : "Since:",
-                                            pack : "pack_start,false,true,3"
-                                        },
-                                        {
-                                            xtype: Gtk.Entry,
-                                            pack : "pack_start,false,false,3",
-                                            width_request : 80
+                                            xtype: Gtk.HBox,
+                                            pack : "pack_start,false,true,3",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.Label,
+                                                    label : "I am doing this:",
+                                                    pack : "pack_start,false,true,3"
+                                                },
+                                                {
+                                                    xtype: Gtk.Entry,
+                                                    pack : "pack_start,true,true,3"
+                                                }
+                                            ]
                                         },
                                         {
-                                            xtype: Gtk.Label,
-                                            label : "Until",
-                                            pack : "pack_start,false,true,3"
+                                            xtype: Gtk.HBox,
+                                            pack : "pack_start,false,true,3",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.Label,
+                                                    label : "Since:",
+                                                    pack : "pack_start,false,true,3"
+                                                },
+                                                {
+                                                    xtype: Gtk.Entry,
+                                                    pack : "pack_start,false,false,3",
+                                                    width_request : 80
+                                                },
+                                                {
+                                                    xtype: Gtk.Label,
+                                                    label : "Until",
+                                                    pack : "pack_start,false,true,3"
+                                                },
+                                                {
+                                                    xtype: Gtk.Entry,
+                                                    pack : "pack_start,true,true,3"
+                                                }
+                                            ]
                                         },
                                         {
-                                            xtype: Gtk.Entry,
-                                            pack : "pack_start,true,true,3"
-                                        }
-                                    ]
-                                },
-                                {
-                                    xtype: Gtk.ScrolledWindow,
-                                    pack : "add",
-                                    id : "RightEditor",
-                                    items : [
-                                        {
-                                            xtype: Gtk.TextView,
-                                            editable : false,
-                                            id : "view",
-                                            indent_width : 4,
+                                            xtype: Gtk.ScrolledWindow,
                                             pack : "add",
-                                            auto_indent : true,
-                                            init : function() {
-                                                XObject.prototype.init.call(this);
-                                                var description = Pango.font_description_from_string("monospace");
-                                            
-                                                description.set_size(8000);
-                                                this.el.modify_font(description);
-                                            
-                                            },
-                                            load : function(str) {
-                                            
-                                            // show the help page for the active node..
-                                             
-                                            
-                                            
-                                             
-                                                this.el.get_buffer().set_text(str, str.length);
-                                             
-                                                
-                                                 var buf = this.el.get_buffer();
-                                                 
-                                                 
-                                                
-                                            },
-                                            show_line_numbers : true,
+                                            id : "RightEditor",
                                             items : [
                                                 {
-                                                    xtype: GtkSource.Buffer,
-                                                    listeners : {
-                                                        changed : function (self) {
-                                                            /*
-                                                            var s = new Gtk.TextIter();
-                                                            var e = new Gtk.TextIter();
-                                                            this.el.get_start_iter(s);
-                                                            this.el.get_end_iter(e);
-                                                            var str = this.el.get_text(s,e,true);
-                                                            try {
-                                                                Seed.check_syntax('var e = ' + str);
-                                                            } catch (e) {
-                                                                this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
-                                                                    red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
-                                                                   }));
-                                                                //print("SYNTAX ERROR IN EDITOR");   
-                                                                //print(e);
-                                                                //console.dump(e);
-                                                                return;
-                                                            }
-                                                            this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
-                                                                    red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
-                                                                   }));
-                                                            
-                                                             this.get('/LeftPanel.model').changed(  str , false);
-                                                             */
-                                                        }
+                                                    xtype: Gtk.TextView,
+                                                    id : "view",
+                                                    indent_width : 4,
+                                                    pack : "add",
+                                                    auto_indent : true,
+                                                    editable : false,
+                                                    init : function() {
+                                                        XObject.prototype.init.call(this);
+                                                        var description = Pango.font_description_from_string("monospace");
+                                                    
+                                                        description.set_size(8000);
+                                                        this.el.modify_font(description);
+                                                    
+                                                    },
+                                                    load : function(str) {
+                                                    
+                                                    // show the help page for the active node..
+                                                     
+                                                    
+                                                    
+                                                     
+                                                        this.el.get_buffer().set_text(str, str.length);
+                                                     
+                                                        
+                                                         var buf = this.el.get_buffer();
+                                                         
+                                                         
+                                                        
                                                     },
-                                                    pack : "set_buffer"
+                                                    show : function(p) {
+                                                         var line =  [
+                                                                'Status : ' +   p.status_name,
+                                                                'ID : ' +   p.id,
+                                                                '',
+                                                                'Summary :  ' +  p.summary,
+                                                                 '' + 
+                                                                 p.description,
+                                                             ].join("\n")   ;
+                                                             print(line);
+                                                             
+                                                             
+                                                             // can not do rich text due to so many missing features..
+                                                              this.el.get_buffer().set_text(line, line.length);
+                                                     
+                                                    },
+                                                    show_line_numbers : true,
+                                                    items : [
+                                                        {
+                                                            xtype: GtkSource.Buffer,
+                                                            listeners : {
+                                                                changed : function (self) {
+                                                                    /*
+                                                                    var s = new Gtk.TextIter();
+                                                                    var e = new Gtk.TextIter();
+                                                                    this.el.get_start_iter(s);
+                                                                    this.el.get_end_iter(e);
+                                                                    var str = this.el.get_text(s,e,true);
+                                                                    try {
+                                                                        Seed.check_syntax('var e = ' + str);
+                                                                    } catch (e) {
+                                                                        this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+                                                                            red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
+                                                                           }));
+                                                                        //print("SYNTAX ERROR IN EDITOR");   
+                                                                        //print(e);
+                                                                        //console.dump(e);
+                                                                        return;
+                                                                    }
+                                                                    this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+                                                                            red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
+                                                                           }));
+                                                                    
+                                                                     this.get('/LeftPanel.model').changed(  str , false);
+                                                                     */
+                                                                }
+                                                            },
+                                                            pack : "set_buffer"
+                                                        }
+                                                    ]
                                                 }
                                             ]
                                         }
                                     ]
-                                }
-                            ]
-                        },
-                        {
-                            xtype: Gtk.HPaned,
-                            items : [
+                                },
                                 {
                                     xtype: Gtk.VBox,
-                                    pack : "add",
-                                    width_request : 400,
+                                    pack : "pack2,false,false",
+                                    width_request : 200,
                                     items : [
                                         {
                                             xtype: Gtk.HBox,
@@ -475,10 +542,10 @@ FixBug=new XObject({
                                             items : [
                                                 {
                                                     xtype: Gtk.TreeView,
-                                                    fixed_height_mode : true,
-                                                    id : "ticket-view",
+                                                    id : "today-view",
                                                     pack : "add",
                                                     can_focus : true,
+                                                    fixed_height_mode : true,
                                                     headers_visible : false,
                                                     init : function() {
                                                         XObject.prototype.init.call(this);
@@ -501,7 +568,7 @@ FixBug=new XObject({
                                                     items : [
                                                         {
                                                             xtype: Gtk.ListStore,
-                                                            id : "ticket-store",
+                                                            id : "today-store",
                                                             pack : "set_model",
                                                             columns : [
                                                                     GObject.TYPE_STRING, // title 
@@ -556,15 +623,29 @@ FixBug=new XObject({
                                                                 var project_id = this.get('/project-select').raw_data[active_id].id;
                                                                 
                                                                 var _t = this;
+                                                                 
+                                                                var DT = imports.Date.Date;
                                                                 
-                                                                imports.Tasks.Tasks.query({
-                                                                    project_id : project_id,
-                                                                    'query[filter]' : 'me'
-                                                                }, function(res) { 
-                                                                    print(JSON.stringify(res,null,4));
-                                                                    _t.loadData(res);
+                                                                new imports.Request.Request( {
+                                                                   url : '/cash_invoice_entry',
+                                                                   params : {
+                                                                        'query[action_dt_from]' : (new DT()).format('Y-m-d'),
+                                                                         'query[action_dt_to]' : (new DT()).add(DT.DAY,1).format('Y-m-d'),
+                                                                        limit: 999,
+                                                                        'sort' : 'action_dt',
+                                                                        dir : 'ASC',
+                                                                        action : 'Hours'
+                                                                   },
+                                                                   
+                                                                   success : function(res) {
+                                                                       this.loadData();
+                                                                   },
+                                                                   scope : this
+                                                                    
+                                                                    
                                                                 });
                                                                  
+                                                                 
                                                                 
                                                             }
                                                         },