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();