Redirect to dashboard and show notice after ssh import/generate.

This commit is contained in:
Kaitlyn Parkhurst 2021-06-18 21:56:14 -07:00
parent 5adad02ae3
commit ceee7b798d
4 changed files with 22 additions and 5 deletions

View file

@ -69,7 +69,7 @@ sub startup ($self) {
# Normal route to controller
$r->get('/') ->to('Dashboard#index');
$r->get('/dashboard') ->to('Dashboard#index');
$r->get('/dashboard') ->to('Dashboard#index')->name( 'dashboard' );
}

View file

@ -5,8 +5,14 @@ sub index ($c) {
my @networks = $c->db->resultset('Network')->all();
my @nodes = $c->db->resultset('Node')->all();
my @sshkeys = $c->db->resultset('Sshkey')->all();
my $notice = $c->param('notice');
$c->stash( networks => \@networks, nodes => \@nodes, sshkeys => \@sshkeys );
$c->stash(
networks => \@networks,
nodes => \@nodes,
sshkeys => \@sshkeys,
notice => $notice,
);
}
1;

View file

@ -18,11 +18,11 @@ sub create ($c) {
if ( $c->param('key_method') eq 'generate' ) {
$c->minion->enqueue( 'generate_sshkey' => [ $c->param('key_desc') ]);
$c->redirect_to( $c->url_for( 'dashboard' )->query( notice => 'ssh-generate' ) );
} else {
$c->minion->enqueue( 'import_sshkey' => [ $c->param('key_desc'), $c->param('private_key'), $c->param('public_key') ])
$c->minion->enqueue( 'import_sshkey' => [ $c->param('key_desc'), $c->param('private_key'), $c->param('public_key') ]);
$c->redirect_to( $c->url_for( 'dashboard' )->query( notice => 'ssh-import' ) );
}
$c->redirect_to( '/sshkeys' );
}
1;

View file

@ -4,6 +4,17 @@
%% override panel -> {
%% if ( $notice ) {
<div style="margin-top: 2em" class="alert alert-success" role="alert">
%% if ( $notice == 'ssh-generate' ) {
Your ssh key is being generated, it should display below when complete.
%% }
%% if ( $notice == 'ssh-import' ) {
Your ssh key is being imported, it should display below when complete.
%% }
</div>
%% }
%% if ( $networks.size() ) {
<h2 style="margin-top: 2em" class="h2">Networks</h2>
<table class="table">