Fix #5724 - force ticket selection for branches...
[gitlive] / NewBranch.bjs
index 07d7b0d..efee1cb 100644 (file)
   {
    "listeners" : {
     "delete_event" : "(self, event) => {\n    this.el.hide();\n    return true; \n    //test  \n}\n ",
-    "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// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n    if (this.repo != null) {\n    \tvar bn = _this.name.el.get_text();\n\n\t\tvar res = this.repo.setActiveTicket(\t\t\t\n\t\t\t RooTicket.singleton().getById(ticket_id != \"\" ? ticket_id : \"-1\"), bn\n\t\t );\n\t\t if (res) {\n\t\t \t// start the monitoring..\n\t\t \t GitMonitor.gitmonitor.start();\n\t\t \t \n\t\t }\n    }\n    \n\n    this.running = false; \n\n\tthis.el.hide();\n\t \n\t \n\n\t \n}"
+    "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\t\n\t\n\t \n\t// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n\tif (ticket_id == \"\") {\n\t\t_this.ticketsel.el.get_child().get_style_context().add_class(\"warning\");\n\t\treturn;\n\t}\n\t\n    if (this.repo != null) {\n    \tvar bn = _this.name.el.get_text();\n\n\t\tvar res = this.repo.setActiveTicket(\t\t\t\n\t\t\t RooTicket.singleton().getById(ticket_id != \"\" ? ticket_id : \"-1\"), bn\n\t\t );\n\t\t if (res) {\n\t\t \t// start the monitoring..\n\t\t \t GitMonitor.gitmonitor.start();\n\t\t \t \n\t\t }\n    }\n    \n\n    this.running = false; \n\n\tthis.el.hide();\n\t \n\t \n\n\t \n}"
    },
    "default_width" : 500,
    "$ deletable" : true,
    "title" : "Create a working branch ",
    "xtype" : "Dialog",
    "# GitRepo? repo" : "null",
-   "|   void show" : "( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = \"\" ) \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\tthis.queue = queue;\n\t\n\tthis.running  = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n    this.repo = repo;\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    var curproj = RooProject.getProjectByRepo(this.repo);\n     _this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n    \n \t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id, tid);\n\n \tif (tid != \"\") {\n\t \tvar name = RooTicket.singleton().usernameLocal();\n \t\tvar ticket = RooTicket.singleton().getById(tid);\n\t\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\n\n\t}\n    _this.view.loadTicket(tid);\n \tthis.el.run();\n\n}",
+   "|   void show" : "( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = \"\" ) \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\tthis.queue = queue;\n\t\n\tthis.running  = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n    this.repo = repo;\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    var curproj = RooProject.getProjectByRepo(this.repo);\n     _this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n    \n \t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id, tid);\n\t_this.ticketsel.el.get_child().get_style_context().remove_class(\"warning\");\n \tif (tid != \"\") { \n\t \tvar name = RooTicket.singleton().usernameLocal();\n \t\tvar ticket = RooTicket.singleton().getById(tid);\n\t\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t} else {\n\t\t_this.ticketsel.el.get_child().get_style_context().add_class(\"warning\");\n\t}\n    _this.view.loadTicket(tid);\n \tthis.el.run();\n\n}",
    "default_height" : 500,
    "$ xns" : "Gtk",
-   "# bool running" : false,
+   "# bool running" : true,
    "# Gee.ArrayList<GitMonitorQueue> queue" : "null",
    "bool modal" : true,
    "items" : [
@@ -93,7 +93,7 @@
         },
         {
          "listeners" : {
-          "changed" : "() => {\n\tif (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\t_this.view.loadTicket(\"\");\t\t\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_this.scrolled_window.el.show();\n\t \n\t_this.view.loadTicket(ticket.id);\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n}"
+          "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tthis.el.get_child().get_style_context().remove_class(\"warning\");\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\t_this.view.loadTicket(\"\");\t\t\n\t\t\n\t\tthis.el.get_child().get_style_context().add_class(\"warning\");\n\t\t\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_this.scrolled_window.el.show();\n\t \n\t_this.view.loadTicket(ticket.id);\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n}"
          },
          "* ctor" : "new Gtk.ComboBox.with_entry()",
          "id" : "ticketsel",