"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 = RooTicket.singleton().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\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}",
"default_height" : 500,
"$ xns" : "Gtk",
"# bool running" : false,
},
{
"listeners" : {
- "activate_link" : "(uri) => {\n\tif (uri == \"refresh\") {\n\t\tvar curproj = RooTicket.singleton().getProjectByRepo(_this.repo);\n\t\t _this.prmodel.loadProjects(curproj == null ? \"\": curproj.id);\n\n\t\t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id);\t\t\n\t}\n\treturn true;\n}"
+ "activate_link" : "(uri) => {\n\tif (uri == \"refresh\") {\n\t\tRooProject.reload();\n\t\tvar curproj = RooProject.getProjectByRepo(_this.repo);\n\t\t _this.prmodel.loadProjects(curproj == null ? \"\": curproj.id);\n\n\t\t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id);\t\t\n\t}\n\treturn true;\n}"
},
"bool use_markup" : true,
"Gtk.Align halign" : "Gtk.Align.END",
this.el.set_keep_above(true);
- var curproj = RooTicket.singleton().getProjectByRepo(this.repo);
+ var curproj = RooProject.getProjectByRepo(this.repo);
_this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
_this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
//listeners
this.el.activate_link.connect( (uri) => {
if (uri == "refresh") {
- var curproj = RooTicket.singleton().getProjectByRepo(_this.repo);
+ RooProject.reload();
+ var curproj = RooProject.getProjectByRepo(_this.repo);
_this.prmodel.loadProjects(curproj == null ? "": curproj.id);
_this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
const string roourl = "https://roojs.com/admin.php/Roo";
- public static RooProject singleton()
+ static RooProject singleton()
{
if (_RooProject == null) {
_RooProject = new RooProject();
return RooProject._projects;
}
+
+ public static RooProject? getProjectByRepo(GitRepo repo)
+ {
+ RooProject.singleton();
+
+ // fixme -- needs to get from rep list..
+ var rt = RooTicket.singleton();
+ if (rt.repos.size < 1) {
+ rt.loadRepos();
+ }
+
+
+ var pid = "";
+ foreach(var roo_repo in rt.repos) {
+ if (roo_repo.shortname == repo.name) {
+ pid = roo_repo.project_id;
+ break;
+ }
+ }
+ if (pid == "") {
+ GLib.debug("getProjectByRepo: repo has no project");
+ return null;
+ }
+ // get project by id...
+ foreach(var roo_project in RooProject.projects()) {
+ if (roo_project.id == pid) {
+ GLib.debug("getProjectByRepo: project_id = %s", pid);
+ return roo_project;
+ }
+ }
+ GLib.debug("getProjectByRepo: can not find project");
+ return null;
+
+ }
+
+
public static RooProject addProject(Json.Object t)
{
RooProject.singleton(); // init...
return add;
}
- static void reloadProjects() /// has to be called on singleton..
+ public static void reload() /// has to be called on singleton..
{
RooProject.loadcount = 0;
RooProject.singleton();
return add;
}
- public RooProject? getProjectByRepo(GitRepo repo)
- {
- var rt = RooTicket.singleton();
-
- if (rt.repos.size < 1) {
- rt.loadRepos();
- }
-
-
- var pid = "";
- foreach(var roo_repo in rt.repos) {
- if (roo_repo.shortname == repo.name) {
- pid = roo_repo.project_id;
- break;
- }
- }
- if (pid == "") {
- GLib.debug("getProjectByRepo: repo has no project");
- return null;
- }
- // get project by id...
- foreach(var roo_project in RooProject.projects()) {
- if (roo_project.id == pid) {
- GLib.debug("getProjectByRepo: project_id = %s", pid);
- return roo_project;
- }
- }
- GLib.debug("getProjectByRepo: can not find project");
- return null;
-
- }
+
public static RooTicket fakeTicket()
"title" : "Create a Ticket",
"xtype" : "Dialog",
"# GitRepo? repo" : "null",
- "| 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 = RooTicket.singleton().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}",
+ "| 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}",
"default_height" : 200,
"$ xns" : "Gtk",
"# bool running" : false,
RooProject? curproj = null;
if (this.repo != null) {
- curproj = RooTicket.singleton().getProjectByRepo(this.repo);
+ curproj = RooProject.getProjectByRepo(this.repo);
}
_this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
if (curproj != null) {