diff --git a/Web/lib/MJB/Web.pm b/Web/lib/MJB/Web.pm index 5a668f0..2dc32e9 100644 --- a/Web/lib/MJB/Web.pm +++ b/Web/lib/MJB/Web.pm @@ -231,6 +231,7 @@ sub startup ($self) { $admin->post( '/admin/alert/remove' )->to('Admin#do_alert_remove' )->name('do_admin_alert_remove' ); $admin->get ( '/admin/jobs' )->to('Admin#jobs' )->name('show_admin_jobs' ); $admin->post( '/admin/update_ssl' )->to('Admin#do_update_ssl' )->name('do_admin_update_ssl' ); + $admin->post( '/admin/sync_ssl' )->to('Admin#do_sync_ssl' )->name('do_admin_sync_ssl' ); } diff --git a/Web/lib/MJB/Web/Controller/Admin.pm b/Web/lib/MJB/Web/Controller/Admin.pm index 529a673..d5c3c24 100644 --- a/Web/lib/MJB/Web/Controller/Admin.pm +++ b/Web/lib/MJB/Web/Controller/Admin.pm @@ -3,7 +3,7 @@ use Mojo::Base 'Mojolicious::Controller', -signatures; use Try::Tiny; sub index ( $c ) { - + $c->redirect_to( 'show_admin_people' ); } # POST /admin @@ -198,6 +198,17 @@ sub do_update_ssl ( $c ) { $c->redirect_to( $c->url_for( 'show_admin_jobs' ) ); } +sub do_sync_ssl ( $c ) { + my $id = $c->minion->enqueue( 'sync_ssl_certs', [ ], { + queue => 'certbot', + notes => { '_bid_0' => 1 }, + }); + $c->db->admin_jobs->create({ minion_job_id => $id }); + + $c->flash( confirmation => "Scheduled job to sync SSL certs." ); + $c->redirect_to( $c->url_for( 'show_admin_jobs' ) ); +} + sub do_alert_read ( $c ) { my $note = $c->db->system_note( $c->param('nid') ); diff --git a/Web/templates/admin/index.html.ep b/Web/templates/admin/index.html.ep index b79121a..e3d89c1 100644 --- a/Web/templates/admin/index.html.ep +++ b/Web/templates/admin/index.html.ep @@ -4,10 +4,19 @@ %= include '_base/status_window'; -
-
+ +
+
+ Queue Job +
+
+
+
+ +
+
diff --git a/Web/templates/admin/jobs.html.ep b/Web/templates/admin/jobs.html.ep index a070987..392f7a7 100644 --- a/Web/templates/admin/jobs.html.ep +++ b/Web/templates/admin/jobs.html.ep @@ -8,5 +8,18 @@ %= include '_base/status_window'; +
+
+
+ +
+
+
+
+ +
+
+
+ %= include '_base/jobs', jobs => [ $c->db->admin_jobs( { }, { order_by => { -desc => 'created_at' } } )->all ]