31fc2594f30c893d5a73a13c5797d7ee698e4b06
[gitlive] / Ticket.bjs
1 {
2  "name" : "Ticket",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/gitlive/Ticket.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "build_module" : "gitlive",
9  "items" : [
10   {
11    "listeners" : {
12     "delete_event" : "(self, event) => {\n    this.el.hide();\n    return true; \n    //test  \n}\n ",
13     "response" : " (self, response_id) =>  { \n  \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id < 1) {\n\t    _this.el.hide();\t\n\t    this.running = false; \n\t \treturn;\n\t}\n\t \n\t \n\tvar tid = RooTicket.singleton().createTicket(\n\t\n\t\t_this.project_id.selectedProjectId(),\n\t\n\t\t_this.milestone_id.selectedMilestoneId(),\n\t\t_this.priority_id.selectedPriorityId() ,\n\t\t_this.classification_id.selectedClassificationId() ,\n\t\t_this.developer_id.selectedDeveloperId(),\n\t\t_this.summary.el.get_text() ,\n\t\t_this.description.el.buffer.text \n\t);\n\tthis.el.hide();\n    this.running = false; \n\tif (this.repo != null) {\n\t \tNewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);\n \t}\n\n\n\t \n}"
14    },
15    "default_width" : 500,
16    "$ deletable" : true,
17    "title" : "Create a Ticket",
18    "xtype" : "Dialog",
19    "# GitRepo? repo" : "null",
20    "|   void show" : "( GitRepo? repo   ) \n{\n     // this.el.set_gravity(Gdk.Gravity.NORTH);\n    if (this.running) { // should not happen!!\n    \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n \n\t\n\tthis.running  = true;\n\t//GitMonitor.gitmonitor.stop();\n\t\n    this.repo = repo;\n    \n    \n    \n    \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n    GLib.debug(\"Loading tickets\"); \n     \n\n    this.el.show_all();\n    this.el.set_keep_above(true);\n   \n\n\tRooProject? curproj = null;\n    if (this.repo != null) {\n\t    curproj = RooProject.getProjectByRepo(this.repo);\n    }\n\t_this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n    if (curproj != null) {\n \n\t\t\n\t\tvar rt = RooTicket.singleton();\n\t\trt.loadProjectOptions(curproj.id);\n\t\t\n\t\t_this.msmodel.loadMilestones();\n\t\t_this.primodel.loadPriorities();\n\t\t_this.sevmodel.loadSeverities();\n\t\t_this.clmodel.loadClassifications();\t\n\t\t_this.devmodel.loadDevelopers();\t\n\t\t\n    }\n    \t_this.summary.el.set_text(\"\");\n\t\t_this.description.el.buffer.text = \"\"; \n    \n \n \tthis.el.run();\n\n}",
21    "default_height" : 200,
22    "$ xns" : "Gtk",
23    "# bool running" : false,
24    "bool modal" : true,
25    "items" : [
26     {
27      "xtype" : "Box",
28      "$ pack" : "get_content_area().add",
29      "$ xns" : "Gtk",
30      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
31      "items" : [
32       {
33        "bool homogeneous" : true,
34        "bool expand" : false,
35        "xtype" : "Table",
36        "* pack" : "pack_start,false,false,0",
37        "uint column_spacing" : 4,
38        "n_columns" : 4,
39        "$ xns" : "Gtk",
40        "n_rows" : 14,
41        "bool vexpand" : false,
42        "int margin" : 2,
43        "items" : [
44         {
45          "label" : "Project",
46          "$ visible" : true,
47          "Gtk.Align halign" : "Gtk.Align.START",
48          "* pack" : "attach_defaults,0,1,0,1",
49          "xtype" : "Label",
50          "$ xns" : "Gtk"
51         },
52         {
53          "label" : "Summary",
54          "$ visible" : true,
55          "Gtk.Align halign" : "Gtk.Align.START",
56          "* pack" : "attach_defaults,1,2,0,1",
57          "xtype" : "Label",
58          "x_options" : 4,
59          "$ xns" : "Gtk"
60         },
61         {
62          "listeners" : {
63           "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar project_id = this.selectedProjectId();\n\t\n\tvar rt = RooTicket.singleton();\n\trt.loadProjectOptions(project_id);\n\t\n\t_this.msmodel.loadMilestones();\n\t_this.primodel.loadPriorities();\n\t_this.sevmodel.loadSeverities();\n\t_this.clmodel.loadClassifications();\t\n\t_this.devmodel.loadDevelopers();\t\n\t\n\t// affects projects and milestones..\n\t\n\t\n\t/*if (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new  DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n   \n\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n\t*/\n}"
64          },
65          "* ctor" : "new Gtk.ComboBox.with_entry()",
66          "id" : "project_id",
67          "| string selectedProjectId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.prmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
68          "* init" : "this.el.set_entry_text_column(1);",
69          "* pack" : "attach_defaults,0,1,1,2",
70          "xtype" : "ComboBox",
71          "# bool loading" : false,
72          "$ xns" : "Gtk",
73          "items" : [
74           {
75            "id" : "prcellrenderer",
76            "xtype" : "CellRendererText",
77            "* pack" : "pack_start,true",
78            "$ xns" : "Gtk"
79           },
80           {
81            "| void loadProjects" : "  (string id) {\n\n    \n    _this.project_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a project --\");\n    if (id == \"\") {\n\t    _this.project_id.el.set_active_iter(iter);\n    }\n\n    foreach(var project in RooProject.projects()) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.name );\n        if (id == project.id) {\n\t \t   _this.project_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n    \n    _this.project_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
82            "id" : "prmodel",
83            "* pack" : "set_model",
84            "xtype" : "ListStore",
85            "$ columns" : "typeof(string),typeof(string)",
86            "n_columns" : 2,
87            "$ xns" : "Gtk"
88           }
89          ]
90         },
91         {
92          "id" : "summary",
93          "$ visible" : true,
94          "xtype" : "Entry",
95          "* pack" : "attach_defaults,1,4,1,2",
96          "$ xns" : "Gtk"
97         },
98         {
99          "label" : "Milestone",
100          "Gtk.Align halign" : "Gtk.Align.START",
101          "xalign" : 0.90000000000000002,
102          "* pack" : "attach_defaults,0,1,2,3",
103          "xtype" : "Label",
104          "$ justify" : "Gtk.Justification.RIGHT",
105          "x_options" : 4,
106          "$ xns" : "Gtk"
107         },
108         {
109          "* ctor" : "new Gtk.ComboBox.with_entry()",
110          "id" : "milestone_id",
111          "* init" : "this.el.set_entry_text_column(1);",
112          "* pack" : "attach_defaults,0,1,3,4",
113          "xtype" : "ComboBox",
114          "# bool loading" : false,
115          "$ xns" : "Gtk",
116          "| string selectedMilestoneId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.msmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
117          "items" : [
118           {
119            "id" : "msmodel",
120            "* pack" : "set_model",
121            "xtype" : "ListStore",
122            "| void loadMilestones" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n   // rt.loadProjects();\n    \n    _this.milestone_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a milestone --\");\n    _this.milestone_id.el.set_active_iter(iter);    \n     \n    var projects = rt.milestones;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n      //  if (id == project.id) {\n\t //\t   _this.milestone.el.set_active_iter(iter);\n\t //   }   \n        \n    }\n    \n    \n    _this.milestone_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
123            "$ columns" : "typeof(string),typeof(string)",
124            "n_columns" : 2,
125            "$ xns" : "Gtk"
126           }
127          ]
128         },
129         {
130          "label" : "Description",
131          "Gtk.Align halign" : "Gtk.Align.START",
132          "* pack" : "attach_defaults,1,4,2,3",
133          "xtype" : "Label",
134          "x_options" : 4,
135          "$ xns" : "Gtk"
136         },
137         {
138          "id" : "description",
139          "* pack" : "attach_defaults,1,4,3,12",
140          "xtype" : "TextView",
141          "$ xns" : "Gtk",
142          "uint border_width" : 1
143         },
144         {
145          "label" : "Priority",
146          "Gtk.Align halign" : "Gtk.Align.START",
147          "xalign" : 0.90000000000000002,
148          "* pack" : "attach_defaults,0,1,4,5",
149          "xtype" : "Label",
150          "x_options" : 4,
151          "$ xns" : "Gtk"
152         },
153         {
154          "* ctor" : "new Gtk.ComboBox.with_entry()",
155          "id" : "priority_id",
156          "* init" : "this.el.set_entry_text_column(1);",
157          "* pack" : "attach_defaults,0,1,5,6",
158          "xtype" : "ComboBox",
159          "# bool loading" : false,
160          "$ xns" : "Gtk",
161          "| string selectedPriorityId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.primodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
162          "items" : [
163           {
164            "id" : "primodel",
165            "| void loadPriorities" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n   // rt.loadProjects();\n    \n    _this.priority_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    \n   var projects = rt.priorities;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n        if (\"normal\" == project.name) {\n\t \t   _this.priority_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n    \n    _this.priority_id.loading = false;\n           \n                                     \n}\n",
166            "* pack" : "set_model",
167            "xtype" : "ListStore",
168            "$ columns" : "typeof(string),typeof(string)",
169            "n_columns" : 2,
170            "$ xns" : "Gtk"
171           }
172          ]
173         },
174         {
175          "label" : "Severity",
176          "Gtk.Align halign" : "Gtk.Align.START",
177          "* pack" : "attach_defaults,0,1,6,7",
178          "xtype" : "Label",
179          "x_options" : 4,
180          "$ xns" : "Gtk"
181         },
182         {
183          "* ctor" : "new Gtk.ComboBox.with_entry()",
184          "id" : "severity_id",
185          "* init" : "this.el.set_entry_text_column(1);",
186          "* pack" : "attach_defaults,0,1,7,8",
187          "xtype" : "ComboBox",
188          "# bool loading" : false,
189          "$ xns" : "Gtk",
190          "| string selectedSeverityId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.sevmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
191          "items" : [
192           {
193            "| void loadSeverities" : "  () {\n\n    var rt = RooTicket.singleton();\n    //rt.loadProjects();\n    \n    _this.severity_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n     \n    var projects = rt.serverities;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n        if (\"normal\" == project.name) {\n\t \t   _this.severity_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n   \n    _this.severity_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
194            "id" : "sevmodel",
195            "* pack" : "set_model",
196            "xtype" : "ListStore",
197            "$ columns" : "typeof(string),typeof(string)",
198            "n_columns" : 2,
199            "$ xns" : "Gtk"
200           }
201          ]
202         },
203         {
204          "label" : "Classification",
205          "Gtk.Align halign" : "Gtk.Align.START",
206          "* pack" : "attach_defaults,0,1,8,9",
207          "xtype" : "Label",
208          "x_options" : 4,
209          "$ xns" : "Gtk"
210         },
211         {
212          "* ctor" : "new Gtk.ComboBox.with_entry()",
213          "id" : "classification_id",
214          "* init" : "this.el.set_entry_text_column(1);",
215          "* pack" : "attach_defaults,0,1,9,10",
216          "xtype" : "ComboBox",
217          "# bool loading" : false,
218          "$ xns" : "Gtk",
219          "| string selectedClassificationId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.clmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
220          "items" : [
221           {
222            "id" : "clmodel",
223            "| void loadClassifications" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n    // rt.loadProjects();\n    \n    _this.classification_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n     \n    var projects = rt.classifications;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n        if (\"bug\" == project.name) {\n\t \t   _this.classification_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n    \n    _this.classification_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
224            "* pack" : "set_model",
225            "xtype" : "ListStore",
226            "$ columns" : "typeof(string),typeof(string)",
227            "n_columns" : 2,
228            "$ xns" : "Gtk"
229           }
230          ]
231         },
232         {
233          "label" : "Assign to",
234          "Gtk.Align halign" : "Gtk.Align.START",
235          "* pack" : "attach_defaults,0,1,10,11",
236          "xtype" : "Label",
237          "x_options" : 4,
238          "$ xns" : "Gtk"
239         },
240         {
241          "* ctor" : "new Gtk.ComboBox.with_entry()",
242          "id" : "developer_id",
243          "* init" : "this.el.set_entry_text_column(1);",
244          "* pack" : "attach_defaults,0,1,11,12",
245          "xtype" : "ComboBox",
246          "# bool loading" : false,
247          "| string selectedDeveloperId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.devmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
248          "$ xns" : "Gtk",
249          "items" : [
250           {
251            "id" : "devmodel",
252            "* pack" : "set_model",
253            "xtype" : "ListStore",
254            "$ columns" : "typeof(string),typeof(string)",
255            "n_columns" : 2,
256            "$ xns" : "Gtk",
257            "| void loadDevelopers" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n    //rt.loadProjects();\n    \n    _this.developer_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a developer --\");\n  //  if (id == \"\") {\n\t    _this.developer_id.el.set_active_iter(iter);\n   // }\n    \n    var projects = rt.developers;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n//        if (id == project.id) {\n\t// \t   _this.projectsel.el.set_active_iter(iter);\n//\t    }   \n        \n    }\n \n    _this.developer_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n"
258           }
259          ]
260         },
261         {
262          "listeners" : {
263           "clicked" : "() => {\n\tGLib.debug(\"fire response = 1\");\n\t\n\t\n\tvar invalid = false;\n\t\n\t// validate first...\n\t_this.project_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.project_id.selectedProjectId() == \"\") {\n\t\t_this.project_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.milestone_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.milestone_id.selectedMilestoneId() == \"\") {\n\t\t_this.milestone_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\n\t_this.priority_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.priority_id.selectedPriorityId() == \"\") {\n\t\t_this.priority_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.classification_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.classification_id.selectedClassificationId() == \"\") {\n\t\t_this.classification_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.developer_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.developer_id.selectedDeveloperId() == \"\") {\n\t\t_this.developer_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.summary.el.get_style_context().remove_class(\"warning\");\t\n\tif (_this.summary.el.get_text() == \"\") {\n\t\t_this.summary.el.get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.description.el.get_style_context().remove_class(\"warning\");\t\n\tif (_this.description.el.buffer.text == \"\") {\n\t\t_this.description.el.get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t\n\tif (invalid) {\n\t\treturn;\n\t}\n\tGLib.debug(\"for is valid\");\n\t\n\t_this.el.response(1);\n}"
264          },
265          "label" : "Create Ticket",
266          "* init" : "{\n   this.el.get_style_context().add_class(\"suggested-action\");\n}\n",
267          "xtype" : "Button",
268          "* pack" : "attach_defaults,0,4,13,14",
269          "$ xns" : "Gtk"
270         }
271        ]
272       },
273       {
274        "id" : "spinner",
275        "bool hexpand" : true,
276        "* pack" : "add",
277        "xtype" : "Spinner",
278        "$ xns" : "Gtk",
279        "bool vexpand" : true
280       }
281      ]
282     }
283    ]
284   }
285  ]
286 }