Uncommited changes synced
[gitlive] / NewBranch.bjs
index 0c1fe9c..2d55a7a 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\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\t\tdefault:\n\t\t\tbreak;\n\t}\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; \t    \n\t    GitMonitor.gitmonitor.start();\n\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\t var bn = _this.name.el.get_text();\n\n\t\t\t\t var 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\n\t \t\tvar tid = RooTicket.singleton().createTicket(\n\t\t\n\t\t\t\t_this.project_id.selectedProjectId(),\n\t\t\t\n\t\t\t\t_this.milestone_id.selectedMilestoneId(),\n\t\t\t\t_this.priority_id.selectedPriorityId() ,\n\t\t\t\t_this.severity_id.selectedSeverityId() ,\t\t\n\t\t\t\t_this.classification_id.selectedClassificationId() ,\n\t\t\t\t_this.developer_id.selectedDeveloperId(),\n\t\t\t\t_this.summary.el.get_text() ,\n\t\t\t\t_this.description.el.buffer.text \n\t\t\t);\n\t\t\tvar ticket = RooTicket.singleton().getById(tid);\n\t\t\tvar name = RooTicket.singleton().usernameLocal();\n\t\t\t var bn = \"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName());\n\n\n\t\t\t var res = this.repo.setActiveTicket( ticket, bn );\n\t\t\tif (res) {\n\t\t\t \t// start the monitoring..\n\t\t\t \t GitMonitor.gitmonitor.start(); \n\t\t\t }\n\t\t\t \n\t \t\t\n \t\t\n \t\t\n\t \t\tbreak;\n \t\t\n \t\tcase 3: // just commit...\n\t\t   _this.repo.git({ \"commit\" , \"-a\" ,\"-m\", _this.commit_message.el.get_text() });\n\t\t   _this.repo.push();\n\t\t   _this.repo.loadBranches();\n\t\t   _this.repo.loadStatus();\n\t\t \t GitMonitor.gitmonitor.start(); \n \t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\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\t\n\t\n\tthis.queue = queue;\n\tthis.running  = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n\t\n    this.repo = repo;\n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n\t\n\t\n\t\n\t\n     \n\n    this.el.show_all();\n    this.el.set_keep_above(true);\n\t\n\t_this.notebook.el.set_current_page(0);\n\t\n\t_this.select_ticket_tab.load_data(tid);\n\t//_this.create_ticket_tab.load_data();\n\t//_this.quick_commit_tab.load_data();\n     _this.commit_message.el.set_text(\"\");\n   \n    \n    \n    \n    \n    \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\t\n\t\n\tthis.queue = queue;\n\tthis.running  = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n\t\n    this.repo = repo;\n\n\t\n\t\n\t\n     \n\n    this.el.show_all();\n    _this.table.el.hide(); // hide ticket layout\n\t_this.diff_sv.el.hide();\n\t_this.el.resize( 500,100); \n     \n    this.el.set_keep_above(true);\n\t\n\t_this.notebook.el.set_current_page(0);\n\t\n\t_this.select_ticket_tab.load_data(tid);\n\t_this.create_ticket_tab.load_data();\n\t//_this.quick_commit_tab.load_data();\n     _this.commit_message.el.set_text(\"\");\n    _this.diff_view.el.get_buffer().set_text( this.repo.diffWorking() );\t\n   \n   \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.resize( 500,100); // not sure why it grows..\n\t    \n     \n    \n \tthis.el.run();\n\n}",
    "default_height" : 500,
    "$ xns" : "Gtk",
    "# bool running" : false,
@@ -26,7 +26,7 @@
    "items" : [
     {
      "listeners" : {
-      "switch_page" : "(page, page_num) => {\n\tGLib.debug(\"Switch to page: %d\", (int)page_num);\n\tswitch(page_num) {\n\t\tcase 0: \n\t\t\tbreak; // do nothing.. it's already loaded at start.\n\t\tcase 1: \n\t\t\t_this.create_ticket_tab.load_data();\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\t_this.quick_commit_tab.load_data();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}\n"
+      "switch_page" : "(page, page_num) => {\n\tGLib.debug(\"Switch to page: %d\", (int)page_num);\n\tswitch(page_num) {\n\t\tcase 0: \n\t\t\t_this.table.el.hide(); // hide ticket layout\n\t\t\t_this.diff_sv.el.hide();\n\t\t\t_this.el.resize( 500,100); \n\t\t\tbreak; // do nothing.. it's already loaded at start.\n\t\tcase 1: \n\t\t\t_this.diff_sv.el.hide();\n\t\t\t_this.table.el.show(); \n\t\t\t_this.el.resize( 500,100); \n\t\t//\t_this.create_ticket_tab.load_data();\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\t_this.quick_commit_tab.load_data();\n\t\t\t_this.diff_sv.el.show();\n\t\t\t_this.el.resize( 500,100); \n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}\n"
      },
      "id" : "notebook",
      "* pack" : "get_content_area().add",
        "bool homogeneous" : false,
        "* pack" : "append_page,_this.label_select_ticket.el",
        "xtype" : "Box",
-       "| void load_data" : "(string tid = \"\") {\n\n    GLib.debug(\"Loading tickets\"); \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.branchbtn.updateState();\n \t\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    \n    \n}\n",
+       "| void load_data" : "(string tid = \"\") {\n\n    \n\t _this.branch_table.el.hide();\n\t  _this.scrolled_window.el.hide();\n\t_this.branch_spinner.el.show();\n\t_this.branch_spinner.el.start();\t\n\t_this.el.resize( 500,100); \t\n    Timeout.add(200, () => {\n\t\n\n\t\tGLib.debug(\"Loading tickets\"); \n\t\t\n\t\tvar curproj = RooProject.getProjectByRepo(_this.repo);\n\t\t _this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n\t\t\n\t \t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id, tid);\n\t \t_this.branchbtn.updateState();\n\t \t\n\t\t_this.ticketsel.el.get_child().get_style_context().remove_class(\"warning\");\n\t \tif (tid != \"\") { \n\t\t \tvar name = RooTicket.singleton().usernameLocal();\n\t \t\tvar ticket = RooTicket.singleton().getById(tid);\n\t\t\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t\t} else {\n\t\t\t_this.ticketsel.el.get_child().get_style_context().add_class(\"warning\");\n\t\t}\n\t\t_this.view.loadTicket(tid);\n\t  \t _this.branch_table.el.show();\n\t\t_this.branch_spinner.el.stop();\n\t\t_this.branch_spinner.el.hide();\t\n\t\t_this.el.resize( 500,100); \n\t\treturn false;\n\t});\n\t\n}\n",
        "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
        "items" : [
         {
+         "id" : "branch_table",
          "bool homogeneous" : true,
          "bool expand" : false,
          "xtype" : "Table",
          "xtype" : "ScrolledWindow",
          "$ xns" : "Gtk",
          "bool vexpand" : true,
+         "bool visible" : false,
          "items" : [
           {
            "id" : "view",
            "| void loadTicket" : "(string tid) {\n\tint h,w;\n\t_this.el.get_size(out w, out h);\n\t\n\tif (tid == \"\") {\n\t\t_this.scrolled_window.el.hide();\n\t\t_this.el.resize(w, 150);\n\t} else {\n\t\t_this.scrolled_window.el.show();\n\t\t_this.el.resize(w, 800);\n\t}\n\t\n\tvar rs =  RooTicket.singleton();\t\t\n\tvar uri = new WebKit.URIRequest(\"https://roojs.com/admin.php/MTrack/View/\" + tid);\n\tvar hd = uri.get_http_headers();\n\tvar authCode = Base64.encode (\"%s:%s\".printf(rs.username, rs.password).data);\n\thd.append(\"Authorization\", \"Basic %s\".printf(authCode));\n\t\n\t this.el.load_request(uri);\n}\n"
           }
          ]
+        },
+        {
+         "id" : "branch_spinner",
+         "bool hexpand" : true,
+         "* pack" : "add",
+         "xtype" : "Spinner",
+         "$ xns" : "Gtk",
+         "bool vexpand" : true
         }
        ]
       },
        "bool homogeneous" : false,
        "xtype" : "Box",
        "* pack" : "append_page,_this.label_create_ticket.el",
-       "| void load_data" : "() {\n \n \t _this.table.el.hide();\n\t_this.spinner.el.show();\n\t_this.spinner.el.start();\t\n\t\n    Timeout.add_seconds(1, () => {\n\t\t \n\t\tRooProject? curproj = null;\n\t\tif (_this.repo != null) {\n\t\t\tcurproj = RooProject.getProjectByRepo(_this.repo);\n\t\t}\n\t\t_this.tprmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n\t\tif (curproj != null) {\n\t \n\t\t\t\n\t\t\tvar rt = RooTicket.singleton();\n\t\t\trt.loadProjectOptions(curproj.id);\n\t\t\t\n\t\t\t_this.msmodel.loadMilestones();\n\t\t\t_this.primodel.loadPriorities();\n\t\t\t_this.sevmodel.loadSeverities();\n\t\t\t_this.clmodel.loadClassifications();\t\n\t\t\t_this.devmodel.loadDevelopers();\t\n\t\t\t\n\t\t}\n\t\t_this.summary.el.set_text(\"\");\n\t\t_this.description.el.buffer.text = \"\"; \n\t\t_this.spinner.el.stop();\n\t\t_this.spinner.el.hide();\t\n\n\t\t_this.table.el.show();\n\t    //_this.summary.el.grab_focus();\n \n\t \treturn false;\n \t});\n}\n",
+       "| void load_data" : "() {\n \n \t// _this.table.el.hide();\n\t//_this.spinner.el.show();\n\t//_this.spinner.el.start();\t\n\t\n    Timeout.add_seconds(1, () => {\n\t\t \n\t\tRooProject? curproj = null;\n\t\tif (_this.repo != null) {\n\t\t\tcurproj = RooProject.getProjectByRepo(_this.repo);\n\t\t}\n\t\t_this.tprmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n\t\tif (curproj != null) {\n\t \n\t\t\t\n\t\t\tvar rt = RooTicket.singleton();\n\t\t\trt.loadProjectOptions(curproj.id);\n\t\t\t\n\t\t\t_this.msmodel.loadMilestones();\n\t\t\t_this.primodel.loadPriorities();\n\t\t\t_this.sevmodel.loadSeverities();\n\t\t\t_this.clmodel.loadClassifications();\t\n\t\t\t_this.devmodel.loadDevelopers();\t\n\t\t\t\n\t\t}\n\t\t_this.summary.el.set_text(\"\");\n\t\t_this.description.el.buffer.text = \"\"; \n\t\t//_this.spinner.el.stop();\n//\t\t_this.spinner.el.hide();\t\n\n\t\t//_this.table.el.show();\n\t    //_this.summary.el.grab_focus();\n \n\t \treturn false;\n \t});\n}\n",
        "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
        "items" : [
           },
           {
            "listeners" : {
-            "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\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 \n\tif (invalid) {\n\t\treturn;\n\t}\n\tGLib.debug(\"for is valid\");\n\t\n\t_this.el.response(1);\n}"
+            "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\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 \n\tif (invalid) {\n\t\treturn;\n\t}\n\tGLib.debug(\"for is valid\");\n\t\n\t_this.el.response(2);\n}"
            },
            "label" : "Create Ticket & Branch",
            "* init" : "{\n   this.el.get_style_context().add_class(\"suggested-action\");\n}\n",
            "$ xns" : "Gtk"
           }
          ]
-        },
-        {
-         "id" : "spinner",
-         "bool hexpand" : true,
-         "* pack" : "add",
-         "xtype" : "Spinner",
-         "$ xns" : "Gtk",
-         "bool vexpand" : true
         }
        ]
       },
         },
         {
          "int height_request" : 400,
+         "id" : "diff_sv",
          "* pack" : "add",
          "xtype" : "ScrolledWindow",
          "$ xns" : "Gtk",
          "bool vexpand" : true,
+         "bool visible" : false,
          "items" : [
           {
            "id" : "diff_view",