* Finished the form for adding peers (but no logic to support it yet, it's just filled and formatted).
Signed-off-by: Digimer <digimer@alteeve.ca>
This commit is contained in:
parent
1ac1bc5ffb
commit
578c23b0a3
21
cgi-bin/home
21
cgi-bin/home
@ -283,12 +283,27 @@ sub process_sync_page
|
|||||||
next if not $anvil->Validate->is_subnet({subnet => $anvil->data->{sys}{network}{interface}{$interface}{subnet}});
|
next if not $anvil->Validate->is_subnet({subnet => $anvil->data->{sys}{network}{interface}{$interface}{subnet}});
|
||||||
my ($network_type, $network_number) = ($interface =~ /^(.*?)(\d+)_/);
|
my ($network_type, $network_number) = ($interface =~ /^(.*?)(\d+)_/);
|
||||||
|
|
||||||
my $database_user = $anvil->data->{database}{$host_uuid}{name};
|
my $database_user = $anvil->data->{database}{$host_uuid}{user} ? $anvil->data->{database}{$host_uuid}{user} : $anvil->data->{sys}{database}{user};
|
||||||
my $database_port = $anvil->data->{database}{$host_uuid}{port};
|
my $database_port = $anvil->data->{database}{$host_uuid}{port};
|
||||||
my $network_key = $network_type eq "bcn" ? "striker_0018" : "striker_0022";
|
my $network_key = $network_type eq "bcn" ? "striker_0018" : "striker_0022";
|
||||||
my $say_network = $anvil->Words->string({key => $network_key, variables => { number => $network_number }});
|
my $say_network = $anvil->Words->string({key => $network_key, variables => { number => $network_number }});
|
||||||
|
|
||||||
|
# The user 'admin' and the port 5432 are default, so only show them if they're non-standard.
|
||||||
|
my $access_string = $database_user."\@".$anvil->data->{sys}{network}{interface}{$interface}{ip}.":".$database_port;
|
||||||
|
if (($database_port eq "5432") && ($database_user eq "admin"))
|
||||||
|
{
|
||||||
|
$access_string = $anvil->data->{sys}{network}{interface}{$interface}{ip};
|
||||||
|
}
|
||||||
|
elsif ($database_port eq "5432")
|
||||||
|
{
|
||||||
|
$access_string = $database_user."\@".$anvil->data->{sys}{network}{interface}{$interface}{ip};
|
||||||
|
}
|
||||||
|
elsif ($database_user eq "admin")
|
||||||
|
{
|
||||||
|
$access_string = $anvil->data->{sys}{network}{interface}{$interface}{ip}.":".$database_port;
|
||||||
|
}
|
||||||
$inbound_table .= $anvil->Template->get({file => "striker.html", name => "striker-sync-inbound", variables => {
|
$inbound_table .= $anvil->Template->get({file => "striker.html", name => "striker-sync-inbound", variables => {
|
||||||
access => $database_user."\@".$anvil->data->{sys}{network}{interface}{$interface}{ip}.":".$database_port,
|
access => $access_string,
|
||||||
note => $say_network,
|
note => $say_network,
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
@ -347,8 +362,10 @@ sub process_sync_page
|
|||||||
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
|
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
$anvil->data->{cgi}{new_peer_password}{value} = "" if not defined $anvil->data->{cgi}{new_peer_password}{value};
|
||||||
$peer_table .= $anvil->Template->get({file => "striker.html", name => "striker-sync-entry", variables => {
|
$peer_table .= $anvil->Template->get({file => "striker.html", name => "striker-sync-entry", variables => {
|
||||||
access => $port eq 5432 ? $user."\@".$host : $user."\@".$host.":".$port,
|
access => $port eq 5432 ? $user."\@".$host : $user."\@".$host.":".$port,
|
||||||
|
password => $anvil->data->{cgi}{new_peer_password}{value},
|
||||||
ping_checked => $ping ? "checked" : "",
|
ping_checked => $ping ? "checked" : "",
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,12 @@ $(function() {
|
|||||||
|
|
||||||
$( window ).on( "load", function()
|
$( window ).on( "load", function()
|
||||||
{
|
{
|
||||||
|
// This resizes the peer access field to the placeholder width to better handle translations.
|
||||||
|
$("#new_peer_access").each(function () {
|
||||||
|
//var npa_width = $(this).attr('placeholder').length;
|
||||||
|
//console.log('resize new_peer_access to: ['+npa_width+'].');
|
||||||
|
$(this).attr('size', $(this).attr('placeholder').length);
|
||||||
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -125,7 +125,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<table class="data_table">
|
<table class="data_table" width="75%">
|
||||||
|
<form name="striker_peers" action="" method="post">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="column_header">
|
<td class="column_header">
|
||||||
#!string!header_0007!#
|
#!string!header_0007!#
|
||||||
@ -134,62 +135,109 @@
|
|||||||
#!string!header_0008!#
|
#!string!header_0008!#
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
#!variable!inbound_table!#
|
<tr>
|
||||||
|
#!variable!inbound_table!#
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="column_header">
|
<td class="column_header">
|
||||||
#!string!header_0009!#
|
#!string!header_0009!#
|
||||||
</td>
|
</td>
|
||||||
<td class="column_header">
|
<td class="column_header" colspan="3">
|
||||||
#!string!header_0010!#
|
|
||||||
</td>
|
|
||||||
<td colspan="2" class="column_header">
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
#!variable!peer_table!#
|
<tr>
|
||||||
|
#!variable!peer_table!#
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 0px 5px;">
|
||||||
|
<input type="text" id="new_peer_access" name="new_peer_access" placeholder="#!string!striker_0069!#" readonly onfocus="this.removeAttribute('readonly');" />
|
||||||
|
</td>
|
||||||
|
<td style="padding: 0px 5px;">
|
||||||
|
<input type="password" id="new_peer_password" name="new_peer_password" placeholder="#!string!striker_0051!#" readonly onfocus="this.removeAttribute('readonly');" />
|
||||||
|
</td>
|
||||||
|
<td style="padding: 0px 5px;">
|
||||||
|
#!string!striker_0071!#: <input type="checkbox" id="new_peer_ping" name="new_peer_ping" checked />
|
||||||
|
</td>
|
||||||
|
<td style="padding: 0px 5px;">
|
||||||
|
#!string!striker_0072!#: <input type="checkbox" id="new_peer_bidirection" name="new_peer_bidirection" checked />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 10px 5px;" colspan="4" align="center">
|
||||||
|
<input type="submit" id="#!variable!access!#_save" name="#!variable!access!#_save" value="#!string!striker_0067!#" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="new_peer_access" name="new_peer_access" placeholder="#!string!striker_0069!#" />
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
#!string!striker_0071!# <input type="checkbox" id="new_peer_ping" name="new_peer_ping" checked />
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
#!string!striker_0072!# <input type="checkbox" id="new_peer_bidirection" name="new_peer_bidirection" checked />
|
|
||||||
</td>
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<input type="button" id="new_peer_save" name="new_peer_save" value="#!string!striker_0070!#" />
|
<table width="75%">
|
||||||
|
<tr>
|
||||||
|
<td class="subtle_text" style="white-space: nowrap; vertical-align: top;">
|
||||||
|
<span class="code" style="white-space: nowrap;">#!string!striker_0075!#</span>:
|
||||||
|
</td>
|
||||||
|
<td class="subtle_text" style="padding-bottom: 10px;">
|
||||||
|
#!string!striker_0076!#
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="subtle_text" style="white-space: nowrap; vertical-align: top;">
|
||||||
|
<span class="code" style="white-space: nowrap;">#!string!striker_0071!#</span>:
|
||||||
|
</td>
|
||||||
|
<td class="subtle_text" style="padding-bottom: 10px;">
|
||||||
|
#!string!striker_0073!#
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="subtle_text" style="white-space: nowrap; vertical-align: top;">
|
||||||
|
<span class="code">#!string!striker_0072!#</span>:
|
||||||
|
</td>
|
||||||
|
<td class="subtle_text">
|
||||||
|
#!string!striker_0074!#
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<!-- end striker-sync -->
|
<!-- end striker-sync -->
|
||||||
|
|
||||||
<!-- start striker-sync-entry -->
|
<!-- start striker-sync-entry -->
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td width="25%" style="padding: 0px 5px;">
|
||||||
#!variable!access!#
|
#!variable!access!#
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td width="25%" style="padding: 0px 5px;">
|
||||||
|
#!variable!password!#
|
||||||
|
</td>
|
||||||
|
<td width="25%" style="padding: 0px 5px;">
|
||||||
#!string!striker_0071!# <input type="checkbox" id="#!variable!access!#_ping" name="#!variable!access!#_ping" #!variable!ping_checked!# />
|
#!string!striker_0071!# <input type="checkbox" id="#!variable!access!#_ping" name="#!variable!access!#_ping" #!variable!ping_checked!# />
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td width="25%" style="padding: 0px 5px;" align="center">
|
||||||
<input type="button" id="#!variable!access!#_save" name="#!variable!access!#_save" value="#!string!striker_0067!#" />
|
<a href="striker=true&task=sync&delete=#!variable!access!#" id="#!variable!access!#_delete" class="button">#!string!striker_0068!#"<a/>
|
||||||
</td>
|
|
||||||
<td align="center">
|
|
||||||
<input type="button" id="#!variable!access!#_delete" name="#!variable!access!#_delete" value="#!string!striker_0068!#" />
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- end striker-sync-entry -->
|
<!-- end striker-sync-entry -->
|
||||||
|
|
||||||
<!-- start striker-sync-inbound -->
|
<!-- start striker-sync-inbound -->
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td width="25%" style="padding: 0px 5px;" class="code">
|
||||||
#!variable!access!#
|
#!variable!access!#
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2">
|
<td width="75%" style="padding: 0px 5px;" colspan="3">
|
||||||
#!variable!note!#
|
#!variable!note!#
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -318,7 +318,7 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
|
|||||||
<key name="header_0005">Speed</key>
|
<key name="header_0005">Speed</key>
|
||||||
<key name="header_0006">Up Order</key>
|
<key name="header_0006">Up Order</key>
|
||||||
<key name="header_0007">Inbound Connections</key>
|
<key name="header_0007">Inbound Connections</key>
|
||||||
<key name="header_0008">Network</key>
|
<key name="header_0008">Via network:</key>
|
||||||
<key name="header_0009">Peer Connections</key>
|
<key name="header_0009">Peer Connections</key>
|
||||||
<key name="header_0010">Ping</key>
|
<key name="header_0010">Ping</key>
|
||||||
<key name="header_0011"></key>
|
<key name="header_0011"></key>
|
||||||
@ -390,12 +390,16 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
|
|||||||
<key name="striker_0064">Help and support</key>
|
<key name="striker_0064">Help and support</key>
|
||||||
<key name="striker_0065"><![CDATA[Forgot your password?<br />Use '<span class="code">anvil-change-password</span>' from the console to reset it.]]></key>
|
<key name="striker_0065"><![CDATA[Forgot your password?<br />Use '<span class="code">anvil-change-password</span>' from the console to reset it.]]></key>
|
||||||
<key name="striker_0066">Access to this machine via: [#!variable!network!#].</key>
|
<key name="striker_0066">Access to this machine via: [#!variable!network!#].</key>
|
||||||
<key name="striker_0067">Update</key>
|
<key name="striker_0067">Save</key>
|
||||||
<key name="striker_0068">Delete</key>
|
<key name="striker_0068">Delete</key>
|
||||||
<key name="striker_0069">db_user@hostname_or_ip[:tcp_port]</key>
|
<key name="striker_0069">[db_user@]hostname_or_ip[:tcp_port]</key>
|
||||||
<key name="striker_0070">Add</key>
|
<key name="striker_0070">Add</key>
|
||||||
<key name="striker_0071">Ping before connect:</key>
|
<key name="striker_0071">Ping</key>
|
||||||
<key name="striker_0072">Bi-directional:</key>
|
<key name="striker_0072">Bi-directional</key>
|
||||||
|
<key name="striker_0073">When checked, the Anvil! will ping the peer before trying to connect to the database. This speeds up skipping a database that is offline, but won't help if the databsae is behind a router. When unchecked, connections will be a touch faster when the database is available.</key>
|
||||||
|
<key name="striker_0074">When checked, the peer will be configure to add the local database as a peer at the same time that we add it to this system.</key>
|
||||||
|
<key name="striker_0075">Access</key>
|
||||||
|
<key name="striker_0076"><![CDATA[This tells Striker how to connect to the peer. The default username is '<span class="fixed_width">admin</span>', and the default port is '<span class="fixed_width">5432</span>'. If the peer uses these, then you only need to specify the IP address or hostname of the peer. If the user name is not '<span class="fixed_width">admin</span>', then you need to use the format '<span class="fixed_width">user@host</span>. If the TCP port is not '<span class="fixed_width">5432</span>', then you need to use '<span class="fixed_width">host:port</span>. If both user and port are different, use the format '<span class="fixed_width">user@host:port</span>'.]]></key>
|
||||||
|
|
||||||
<!-- Strings used by jobs -->
|
<!-- Strings used by jobs -->
|
||||||
<key name="job_0001">Configure Network</key>
|
<key name="job_0001">Configure Network</key>
|
||||||
|
Loading…
Reference in New Issue
Block a user