diff --git a/sandbox_manager/lib/SandboxManager.pm b/sandbox_manager/lib/SandboxManager.pm index 67534db..6451137 100644 --- a/sandbox_manager/lib/SandboxManager.pm +++ b/sandbox_manager/lib/SandboxManager.pm @@ -4,7 +4,7 @@ use Mojo::Base 'Mojolicious'; # This method will run once at server start sub startup { - my $self = shift; + my $self = shift; # Load configuration from hash returned by "my_app.conf" my $config = $self->plugin('Config'); @@ -36,6 +36,8 @@ sub startup { $r->any('/delete/:name')->to('sandboxes#delete'); $r->any('/restart_all/:name')->to('sandboxes#restart_all'); $r->any('/reindex_full/:name')->to('sandboxes#reindex_full'); + $r->any('/rebuild_dbic/:name')->to('sandboxes#rebuild_dbic'); + $r->any('/build_css/:name')->to('sandboxes#build_css'); $r->any('/clear_database/:name')->to('sandboxes#clear_database'); } diff --git a/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm b/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm index a33dded..3c73313 100644 --- a/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm +++ b/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm @@ -207,6 +207,38 @@ sub apply_bug_submit { ); } +sub rebuild_dbic { + my $self = shift; + my $name = $self->stash('name'); + + $self->redirect_to('/') unless -f "$config_dir/$name.yml"; + + my $output = qx{ docker exec koha-$name /bin/bash -c "/kohadevbox/bin/dbic" } . "\n"; + + $self->render( + title => "Full DBIC Schema Rebuild", + text => $output, + format => 'txt' + ); +} + +sub build_css { + my $self = shift; + my $name = $self->stash('name'); + + $self->redirect_to('/') unless -f "$config_dir/$name.yml"; + + my $output = qx{ docker exec koha-$name /bin/bash -c "(cd koha; yarn install)" } . "\n"; + $output .= qx{ docker exec koha-$name /bin/bash -c "(cd koha; yarn build)" } . "\n"; + $output .= qx{ docker exec koha-$name /bin/bash -c "(cd koha; yarn build --view=opac)" } . "\n"; + + $self->render( + title => "Rebuild of css from scss", + text => $output, + format => 'txt' + ); +} + sub delete { my $self = shift; my $name = $self->stash('name'); diff --git a/sandbox_manager/templates/sandboxes/list.html.tt2 b/sandbox_manager/templates/sandboxes/list.html.tt2 index dcf9ae4..bcb1b53 100644 --- a/sandbox_manager/templates/sandboxes/list.html.tt2 +++ b/sandbox_manager/templates/sandboxes/list.html.tt2 @@ -84,7 +84,9 @@