Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmatifa committed Jan 22, 2018
1 parent fa60dbd commit b8c6584
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 39 deletions.
67 changes: 33 additions & 34 deletions cmd.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ui_print_header(undef, $text{'cmd_title'}, "", undef, 1, 1);

if ($text{$in{'cmd'}."_desc"}) {
print ui_table_start($text{$in{'cmd'}."_cmd"}, "width=100%", "10", ['align=left'] );
print ui_table_row("Command Description:", $text{$in{'cmd'}."_desc"});
print ui_table_row($text{'cmd_dscpt'}, $text{$in{'cmd'}."_desc"});
print ui_table_end();
};

Expand All @@ -33,23 +33,22 @@ elsif ($in{'cmd'} =~ "snapshot") {
}
elsif ($in{'cmd'} =~ "send") {
if (!$in{'dest'}) {
print "Send snapshot: $in{'snap'} to gzip file <br />";
print $text{'cmd_send'}." ".$in{'snap'}." ".$text{'cmd_gzip'}." <br />";
print "<br />";
print ui_form_start('cmd.cgi', 'post');
print ui_hidden('cmd', $in{'cmd'});
print ui_hidden('snap', $in{'snap'});
my $newfile = $in{'snap'} =~ s![/@]!_!gr;
print "<b>Destination: </b>".ui_filebox('dest', $config{'last_send'}, 35, undef, undef, undef, 1)."<br />";
print "<b>Filename: </b>".ui_textbox('file', $newfile.'.gz', 50)."<br />";
print ui_submit("Continue", undef, undef);
print "<b>$text{'destination'} </b>".ui_filebox('dest', $config{'last_send'}, 35, undef, undef, undef, 1)."<br />";
print "<b>$text{'filename'} </b>".ui_textbox('file', $newfile.'.gz', 50)."<br />";
print ui_submit($text{'continue'}, undef, undef);
print ui_form_end();
} else {
$in{'confirm'} = "yes";
my $cmd = ($config{'snap_properties'} =~ /1/) ? "zfs send ".$in{'snap'}." | gzip > ".$in{'dest'}."/".$in{'file'} : undef;
ui_cmd($in{'snap'}, $cmd);
$config{'last_send'} = $in{'dest'};
save_module_config();
#print "<br />";
print `ls -al $in{'dest'}'."/".$in{'file'}`;
}
}
Expand Down Expand Up @@ -156,21 +155,21 @@ elsif ($in{'cmd'} =~ "zfsdestroy") {
my $cmd = ($config{'zfs_destroy'} =~ /1/) ? "zfs destroy $in{'force'} $in{'zfs'}" : undef;
if (!$in{'confirm'})
{
print "Attempting to destroy $in{'zfs'}... <br />";
print $text{'cmd_destroy'}." $in{'zfs'}... <br />";
print "<br />";
print ui_form_start('cmd.cgi', 'post');
print ui_hidden('cmd', $in{'cmd'});
print ui_hidden('zfs', $in{'zfs'});
print "<b>This action will affect the following: </b><br />";
print "<b>$text{'cmd_affect'} </b><br />";
ui_zfs_list('-r '.$in{'zfs'});
ui_list_snapshots('-r '.$in{'zfs'});
if (($config{'zfs_destroy'} =~ /1/) && ($config{'snap_destroy'} =~ /1/)) { print ui_checkbox('force', '-r', 'Click to destroy all child dependencies (recursive)', undef ), "<br />"; }
print "<h3>Warning, this action will result in data loss, do you really want to continue?</h3>";
print ui_checkbox('confirm', 'yes', 'I understand', undef );
print "<h3>$text{'cmd_warning'}</h3>";
print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef );
print ui_hidden('checked', 'no');
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- checkbox must be selected</font>"; }
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- $text{'cmd_checkbox'}</font>"; }
print "<br /><br />";
print ui_submit("Continue", undef, undef);
print ui_submit($text{'continue'}, undef, undef);
print ui_form_end();
} else {
ui_cmd($in{'zfs'}, $cmd);
Expand All @@ -181,19 +180,19 @@ elsif ($in{'cmd'} =~ "snpdestroy") {
my $cmd = ($config{'snap_destroy'} =~ /1/) ? "zfs destroy $in{'force'} $in{'snapshot'}" : undef;
if (!$in{'confirm'})
{
print "Attempting to destroy $in{'snapshot'}...<br />";
print $text{'cmd_destroy'}." $in{'snapshot'}...<br />";
print ui_form_start('cmd.cgi', 'post');
print ui_hidden('cmd', 'snpdestroy');
print ui_hidden('snapshot', $in{'snapshot'});
print "<b>This action will affect the following: </b><br />";
print "<b>$text{'cmd_affect'} </b><br />";
ui_list_snapshots('-r '.$in{'snapshot'});
if (($config{'zfs_destroy'} =~ /1/) && ($config{'snap_destroy'} =~ /1/)) { print ui_checkbox('force', '-r', 'Click to destroy all child dependencies (recursive)', undef ), "<br />"; }
print "<h3>Warning, this action will result in data loss, do you really want to continue?</h3>";
print ui_checkbox('confirm', 'yes', 'I understand', undef );
print "<h3>$text{'cmd_warning'}</h3>";
print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef );
print ui_hidden('checked', 'no');
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- checkbox must be selected</font>"; }
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- $text{'cmd_checkbox'}</font>"; }
print "<br /><br />";
print ui_submit("Continue", undef, undef),;
print ui_submit($text{'continue'}, undef, undef),;
print ui_form_end();

} else {
Expand All @@ -207,19 +206,19 @@ elsif ($in{'cmd'} =~ "pooldestroy") {
my $cmd = ($config{'pool_destroy'} =~ /1/) ? "zpool destroy $in{'pool'}" : undef;
if (!$in{'confirm'})
{
print "Attempting to destroy $in{'pool'}... <br />";
print $text{'cmd_destroy'}." $in{'pool'}... <br />";
print ui_form_start('cmd.cgi', 'post');
print ui_hidden('cmd', 'pooldestroy');
print ui_hidden('pool', $in{'pool'});
print "<b>This action will affect the following: </b><br />";
print "<b>$text{'cmd_affect'} </b><br />";
ui_zfs_list('-r '.$in{'pool'});
ui_list_snapshots('-r '.$in{'pool'});
print "<h3>Warning, this action will result in data loss, do you really want to continue?</h3>";
print ui_checkbox('confirm', 'yes', 'I understand', undef );
print "<h3>$text{'cmd_warning'}</h3>";
print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef );
print ui_hidden('checked', 'no');
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- checkbox must be selected</font>"; }
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- $text{'cmd_checkbox'}</font>"; }
print "<br /><br />";
print ui_submit("Continue", undef, undef);
print ui_submit($text{'continue'}, undef, undef);
} else {
ui_cmd($in{'pool'}, $cmd);
}
Expand All @@ -228,8 +227,8 @@ my $cmd = ($config{'pool_destroy'} =~ /1/) ? "zpool destroy $in{'pool'}" : undef
elsif ($in{'cmd'} =~ "multisnap") {
%snapshot = ();
@select = split(/;/, $in{'select'});
print "<h2>Destroy</h2>";
print "Attempting to destroy multiple snapshots... <br />";
print "<h2>$text{'destroy'}</h2>";
print $text{'cmd_multisnap'}." <br />";
print ui_form_start('cmd.cgi', 'post');
print ui_hidden('cmd', 'multisnap');
print ui_hidden('select', $in{'select'});
Expand All @@ -246,30 +245,30 @@ elsif ($in{'cmd'} =~ "multisnap") {
print ui_columns_end();
if (!$in{'confirm'})
{
print "<h2>Commands to be issued:</h2>";
print "<h2>$text{'cmd_issue'}</h2>";
foreach $key (keys %results)
{
print $results{$key}, "<br />";
}
print "<h3>Warning, this action will result in data loss, do you really want to continue?</h3>";
print ui_checkbox('confirm', 'yes', 'I understand', undef );
print "<h3>$text{'cmd_warning'}</h3>";
print ui_checkbox('confirm', 'yes', $text{'cmd_understand'}, undef );
print ui_hidden('checked', 'no');
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- checkbox must be selected</font>"; }
if ($in{'checked'} =~ /no/) { print " <font color='red'> -- $text{'cmd_checkbox'}</font>"; }
print "<br /><br />";
print ui_submit("Continue", undef, undef), " | <a href='index.cgi?mode=snapshot'>Cancel</a>";
print ui_submit($text{'continue'}, undef, undef), " | <a href='index.cgi?mode=snapshot'>Cancel</a>";
} else {
print "<h2>Results from commands:</h2>";
print "<h2>$text{'cmd_results'}</h2>";
foreach $key (keys %results)
{
my @result = (`$results{$key} 2>&1`);
if (($result[1] eq undef))
{
print $results{$key}, "<br />";
print "Success! <br />";
print "$text{'cmd_success'} <br />";
} else
{
print $results{$key}, "<br />";
print "error: ", $result[0], "<br />";
print "$text{'cmd_error'} ", $result[0], "<br />";
}
}
}
Expand Down
42 changes: 38 additions & 4 deletions lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ index_return=pool list
snapshot_return=snapshot list
zfs_return=file system list

#general use
destination=Destination:
filename=Filename:
continue=Continue
create=Create
destroy=Destroy

#tasks
tasks=Tasks
differences=Differences:
differences_desc=Show differences in
rename=Rename:
rename_desc=Rename
clone=Clone:
clone_desc: Clone
destroy=Destroy:
destroy_pool=Destroy pool
destroy_filesystem=Destroy filesystem
destroy_snap=Destroy snapshot
snapshot=Snapshot:
snapshot_desc=Create new snapshot based on filesystem:
send=Send:
send_desc=Send
rollback=Rollback:
rollback_desc=Rollback

status_title=Zpool Status

vdev_title=Manage Virtual Device
Expand All @@ -15,11 +41,15 @@ diff_title=Snapshot Differences
about_title=About ZFS Manager

cmd_title=Issuing Command
cmd_dscpt=Command Description:
cmd_issue=Commands to be issued:
cmd_results=Results from commands:
cmd_with=with command...
cmd_setzfs=Attempting to set zfs property
cmd_setpool=Attempting to set pool property
cmd_snapshot=Attempting to create snapshot
cmd_send=Attempting to send snapshot
cmd_send=Send snapshot
cmd_gzip=to gzip file
cmd_createzfs=Attempting to create filesystem
cmd_clone=Attempting to clone
cmd_rename=Attempting to rename
Expand All @@ -31,10 +61,14 @@ cmd_upgrade=Attempting to upgrade pool
cmd_export=Attempting to export pool
cmd_import=Attempting to import pool
cmd_zfsact=Attempting to
cmd_zfsdestroy=Attempting to destroy filesystem
cmd_snpdestroy=Attempting to destroy snapshot
cmd_pooldestroy=Attempting to destroy pool
cmd_destroy=Attempting to destroy
cmd_affect=This action will affect the following:
cmd_warning=Warning, this action will result in data loss, do you really want to continue?
cmd_understand=I understand
cmd_checkbox=checkbox must be selected
cmd_multisnap=Attempting to destroy multiple snapshots...
cmd_success=Success!
cmd_error=error:

snapshot_title=Snapshot
snapshot_create=Create Snapshot
Expand Down
1 change: 0 additions & 1 deletion zfsmanager-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ sub list_zfs
sub list_snapshots
{
my ($snap) = @_;
#my %hash=null;
$list=`zfs list -t snapshot -H -o name,$config{'list_snap'} -s creation $snap`;
$idx = 0;
open my $fh, "<", \$list;
Expand Down

0 comments on commit b8c6584

Please sign in to comment.