[Midnightbsd-cvs] mports [22511] trunk/Tools/magus/www/data/magus/index.cgi: add runs api

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Sep 20 21:03:30 EDT 2017


Revision: 22511
          http://svnweb.midnightbsd.org/mports/?rev=22511
Author:   laffer1
Date:     2017-09-20 21:03:30 -0400 (Wed, 20 Sep 2017)
Log Message:
-----------
add runs api

Modified Paths:
--------------
    trunk/Tools/magus/www/data/magus/index.cgi

Modified: trunk/Tools/magus/www/data/magus/index.cgi
===================================================================
--- trunk/Tools/magus/www/data/magus/index.cgi	2017-09-21 00:45:35 UTC (rev 22510)
+++ trunk/Tools/magus/www/data/magus/index.cgi	2017-09-21 01:03:30 UTC (rev 22511)
@@ -59,6 +59,8 @@
     }
   } elsif ($path =~ m:^/ports/(.*):) {
     port_page($p, $1);
+  } elsif ($path =~ m:^/api/runs:) {
+    api_runs($p);
   } elsif ($path =~ m:^/async/run-ports-list:) {
     async_run_port_stats($p);
   } elsif ($path =~ m:^/async/machine-events:) {
@@ -80,6 +82,15 @@
   }
 }
 
+sub api_runs {
+  my ($p) = @_;
+
+  my @runs = Magus::Run->retrieve_all({ order_by => 'id DESC' });
+ 
+  print $p->header(-type => 'application/json'), encode_json(\%runs);
+}
+
+
 sub run_index {
   my ($p) = @_;
   my $tmpl = template($p, 'runlist.tmpl');



More information about the Midnightbsd-cvs mailing list