From 1089915fca89477964766e342951740a0c6299f2 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 21 Mar 2019 14:34:47 +0800 Subject: [PATCH] NewBranch.bjs NewBranch.vala --- NewBranch.bjs | 2 +- NewBranch.vala | 36 +++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/NewBranch.bjs b/NewBranch.bjs index 99c13ebf..de659294 100644 --- a/NewBranch.bjs +++ b/NewBranch.bjs @@ -10,7 +10,7 @@ { "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\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\n\t \n\tif (response_id < 1) {\n\t _this.el.hide();\t\n\t this.running = false; \n\t \treturn;\n\t}\n\t\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\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\n\t \n\tif (response_id < 1) {\n\t _this.el.hide();\t\n\t this.running = false; \n\t \treturn;\n\t}\n\t\n\tswitch(response_id) {\n\t\tcase 1: \n\t\n\t\t\t\n\t\t\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\t\t\n\t\t\tif (this.repo != null) {\n\t\t\t\tvar bn = _this.name.el.get_text();\n\n\t\t\t\tvar res = this.repo.setActiveTicket(\t\t\t\n\t\t\t\t\t RooTicket.singleton().getById(ticket_id != \"\" ? ticket_id : \"-1\"), bn\n\t\t\t\t );\n\t\t\t\t if (res) {\n\t\t\t\t \t// start the monitoring..\n\t\t\t\t \t GitMonitor.gitmonitor.start();\n\t\t\t\t \t \n\t\t\t\t }\n\t\t\t}\n \t\tbreak;\n \t\tcase 2: // create ticket + branch\n\t \t\tbreak;\n \t\t\n \t\tcase 3: // just commit...\n \t\t\n \t\t\tbreak;\n\n this.running = false; \n\n\tthis.el.hide();\n\t \n\t \n\n\t \n}" }, "default_width" : 500, "$ deletable" : true, diff --git a/NewBranch.vala b/NewBranch.vala index 7bb3b9fb..8c392c48 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -106,21 +106,31 @@ public class NewBranch : Object return; } - var ticket_id = _this.ticketsel.selectedTicketId(); + switch(response_id) { + case 1: - if (this.repo != null) { - var bn = _this.name.el.get_text(); + + var ticket_id = _this.ticketsel.selectedTicketId(); + + if (this.repo != null) { + var bn = _this.name.el.get_text(); - var res = this.repo.setActiveTicket( - RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn - ); - if (res) { - // start the monitoring.. - GitMonitor.gitmonitor.start(); - - } - } - + var res = this.repo.setActiveTicket( + RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn + ); + if (res) { + // start the monitoring.. + GitMonitor.gitmonitor.start(); + + } + } + break; + case 2: // create ticket + branch + break; + + case 3: // just commit... + + break; this.running = false; -- 2.39.2