forked from webmin/webmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_pool.cgi
executable file
·83 lines (73 loc) · 2.38 KB
/
edit_pool.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/local/bin/perl
# Show the details of one file pool daemon
require './bacula-backup-lib.pl';
&ReadParse();
$conf = &get_director_config();
@pools = &find("Pool", $conf);
if ($in{'new'}) {
&ui_print_header(undef, $text{'pool_title1'}, "");
$mems = [ { 'name' => 'Pool Type',
'value' => 'Backup' },
{ 'name' => 'Recycle',
'value' => 'yes' },
{ 'name' => 'AutoPrune',
'value' => 'yes' },
{ 'name' => 'Volume Retention',
'value' => '365 days' },
];
if (&get_bacula_version_cached() < 2) {
push(@$mems,
{ 'name' => 'Accept Any Volume',
'value' => 'yes' });
}
$pool = { 'members' => $mems };
}
else {
&ui_print_header(undef, $text{'pool_title2'}, "");
$pool = &find_by("Name", $in{'name'}, \@pools);
$pool || &error($text{'pool_egone'});
$mems = $pool->{'members'};
}
# Show details
print &ui_form_start("save_pool.cgi", "post");
print &ui_hidden("new", $in{'new'}),"\n";
print &ui_hidden("old", $in{'name'}),"\n";
print &ui_table_start($text{'pool_header'}, "width=100%", 4);
# Pool name
print &ui_table_row($text{'pool_name'},
&ui_textbox("name", $name=&find_value("Name", $mems), 40), 3);
# Pool type
print &ui_table_row($text{'pool_type'},
&ui_select("type", $type=&find_value("Pool Type", $mems),
[ map { [ $_, $_ =~ /^\*(.*)$/ ? $1 : $_ ] }
@pool_types ], 1, 0, 1));
# Maximum Volume Jobs
$max = &find_value("Maximum Volume Jobs", $mems);
print &ui_table_row($text{'pool_max'},
&ui_radio("maxmode", $max == 0 ? 0 : 1,
[ [ 0, $text{'pool_unlimited'} ],
[ 1, &ui_textbox('max', $max == 0 ? "" : $max, 6) ] ]));
# Retention period
$reten = &find_value("Volume Retention", $mems);
print &ui_table_row($text{'pool_reten'},
&show_period_input("reten", $reten));
# Various yes/no options
print &ui_table_row($text{'pool_recycle'},
&bacula_yesno("recycle", "Recycle", $mems));
print &ui_table_row($text{'pool_auto'},
&bacula_yesno("auto", "AutoPrune", $mems));
if (&get_bacula_version_cached() < 2) {
print &ui_table_row($text{'pool_any'},
&bacula_yesno("any", "Accept Any Volume", $mems));
}
# All done
print &ui_table_end();
if ($in{'new'}) {
print &ui_form_end([ [ "create", $text{'create'} ] ]);
}
else {
print &ui_form_end([ [ "save", $text{'save'} ],
[ "status", $text{'pool_status'} ],
[ "delete", $text{'delete'} ] ]);
}
&ui_print_footer("list_pools.cgi", $text{'pools_return'});