* Finished the jquery (for now) to pre-fill the step 2 form.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 7 years ago
parent 2ea506b4d9
commit c208d676cb
  1. 24
      cgi-bin/home
  2. 30
      html/skins/alteeve/config.js
  3. 2
      html/skins/alteeve/main.css
  4. 2
      html/skins/alteeve/main.html

@ -448,8 +448,8 @@ ORDER BY
push @{$links}, "bcn_link".$bcn;
my $this_ip_key = "bcn".$bcn."_ip";
my $this_subnet_key = "bcn".$bcn."_subnet";
my $this_iface1_key = "bcn".$bcn."_iface1_mac";
my $this_iface2_key = "bcn".$bcn."_iface2_mac";
my $this_iface1_key = "bcn".$bcn."_link1_mac_to_set";
my $this_iface2_key = "bcn".$bcn."_link2_mac_to_set";
$cgi .= $this_ip_key.",".$this_subnet_key.",".$this_iface1_key.",".$this_iface2_key.",";
my $this_ip = generate_ip($anvil, "bcn", $bcn, $anvil->data->{cgi}{sequence}{value});
my $this_ip_class = $anvil->data->{cgi}{$this_ip_key}{alert} ? "input_alert" : "input_clear";
@ -482,7 +482,8 @@ ORDER BY
ip_value_default => $this_ip,
ip_class => $this_ip_class,
subnet_key => $this_subnet_key,
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : $anvil->data->{'default'}{network}{bcn}{netmask},
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : "",
subnet_value_default => $anvil->data->{defaults}{network}{bcn}{netmask},
subnet_class => $this_subnet_class,
iface1_select => $this_iface1_form,
iface2_select => $this_iface2_form,
@ -496,8 +497,8 @@ ORDER BY
push @{$links}, "ifn_link".$ifn;
my $this_ip_key = "ifn".$ifn."_ip";
my $this_subnet_key = "ifn".$ifn."_subnet";
my $this_iface1_key = "ifn".$ifn."_iface1_mac";
my $this_iface2_key = "ifn".$ifn."_iface2_mac";
my $this_iface1_key = "ifn".$ifn."_link1_mac_to_set";
my $this_iface2_key = "ifn".$ifn."_link2_mac_to_set";
$cgi .= $this_ip_key.",".$this_subnet_key.",".$this_iface1_key.",".$this_iface2_key.",";
my $this_ip = generate_ip($anvil, "ifn", $ifn, $anvil->data->{cgi}{sequence}{value});
my $this_ip_class = $anvil->data->{cgi}{$this_ip_key}{alert} ? "input_alert" : "input_clear";
@ -530,7 +531,8 @@ ORDER BY
ip_value_default => $this_ip,
ip_class => $this_ip_class,
subnet_key => $this_subnet_key,
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : $anvil->data->{'default'}{network}{ifn}{netmask},
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : "",
subnet_value_default => $anvil->data->{defaults}{network}{ifn}{netmask},
subnet_class => $this_subnet_class,
iface1_select => $this_iface1_form,
iface2_select => $this_iface2_form,
@ -547,7 +549,7 @@ ORDER BY
push @{$links}, "bcn_link".$bcn;
my $this_ip_key = "bcn".$bcn."_ip";
my $this_subnet_key = "bcn".$bcn."_subnet";
my $this_iface1_key = "bcn".$bcn."_iface1_mac";
my $this_iface1_key = "bcn".$bcn."_link1_mac_to_set";
$cgi .= $this_ip_key.",".$this_subnet_key.",".$this_iface1_key.",";
my $this_ip = generate_ip($anvil, "bcn", $bcn, $anvil->data->{cgi}{sequence}{value});
my $this_ip_class = $anvil->data->{cgi}{$this_ip_key}{alert} ? "input_alert" : "input_clear";
@ -572,7 +574,8 @@ ORDER BY
ip_value_default => $this_ip,
ip_class => $this_ip_class,
subnet_key => $this_subnet_key,
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : $anvil->data->{'default'}{network}{bcn}{netmask},
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : $anvil->data->{defaults}{network}{bcn}{netmask},
subnet_value_default => $anvil->data->{defaults}{network}{bcn}{netmask},
subnet_class => $this_subnet_class,
iface1_select => $this_iface1_form,
}});
@ -585,7 +588,7 @@ ORDER BY
push @{$links}, "ifn_link".$ifn;
my $this_ip_key = "ifn".$ifn."_ip";
my $this_subnet_key = "ifn".$ifn."_subnet";
my $this_iface1_key = "ifn".$ifn."_iface1_mac";
my $this_iface1_key = "ifn".$ifn."_link1_mac_to_set";
$cgi .= $this_ip_key.",".$this_subnet_key.",".$this_iface1_key.",";
my $this_ip = generate_ip($anvil, "ifn", $ifn, $anvil->data->{cgi}{sequence}{value});
my $this_ip_class = $anvil->data->{cgi}{$this_ip_key}{alert} ? "input_alert" : "input_clear";
@ -610,7 +613,8 @@ ORDER BY
ip_value_default => $this_ip,
ip_class => $this_ip_class,
subnet_key => $this_subnet_key,
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : $anvil->data->{'default'}{network}{ifn}{netmask},
subnet_value => defined $anvil->data->{cgi}{$this_subnet_key}{value} ? $anvil->data->{cgi}{$this_subnet_key}{value} : $anvil->data->{defaults}{network}{ifn}{netmask},
subnet_value_default => $anvil->data->{defaults}{network}{ifn}{netmask},
subnet_class => $this_subnet_class,
iface1_select => $this_iface1_form,
}});

@ -44,16 +44,7 @@ $( window ).on( "load", function()
//window.history.pushState('object', document.title, newURL);
//console.log('onload fired.');
/*
if($("#interface_list").val()) {
var interface_list = $('#interface_list').val();
console.log('Interface list: ['+interface_list+'].');
jQuery.each(interface_list.split(","), function(index, item) {
console.log('Interface: ['+item+'].');
});
}
*/
// Walk through the network.json file and use it to pre-fill the form.
$.getJSON('/status/network.json', { get_param: 'value' }, function(data) {
$.each(data.ips, function(index, element) {
//console.log('- entry: ['+index+'], on: ['+element.on+'], address: ['+element.address+'], subnet: ['+element.subnet+'].');
@ -109,8 +100,8 @@ $( window ).on( "load", function()
//console.log(network+' count: ['+count+'].');
for (var i = 1; i <= count; i++) {
var network_name = network+i;
console.log('Network: ['+network_name+'], IP set: ['+$("#"+network_name+"_ip").val()+'/'+$("#"+network_name+"_subnet").val()+'].');
console.log('- default: ['+$("#"+network_name+"_ip_default").val()+'/'+$("#"+network_name+"_subnet_default").val()+'].');
//console.log('Network: ['+network_name+'], IP set: ['+$("#"+network_name+"_ip").val()+'/'+$("#"+network_name+"_subnet").val()+'].');
//console.log('- default: ['+$("#"+network_name+"_ip_default").val()+'/'+$("#"+network_name+"_subnet_default").val()+'].');
if ($("#"+network_name+"_ip").val() == '')
{
@ -126,5 +117,20 @@ $( window ).on( "load", function()
};
});
// Look for interfaces with names we recognize and use them to select interfaces from the
// select lists.
$.each(data.networks, function(index, element) {
//console.log('Entry: ['+index+'], name: ['+element.name+'], mac: ['+element.mac+'].');
var mac_key = element.name+'_mac_to_set';
if ($("#"+mac_key).length) {
var select_value = $('#'+mac_key).find(":selected").text();
//console.log('- Field exists, current value: ['+select_value+'].');
if (select_value == '') {
//console.log('- Setting to: ['+element.mac+'].');
$("#"+mac_key).val(element.mac);
}
}
});
});
})

@ -51,7 +51,7 @@ select {
background-color: #343434;
color: #f7f7f7;
font-family: 'Dejavu Sans Mono', 'Courier 10 pitch', monospace, Courier;
font-size: 1.1em;
font-size: 1.0em;
}
body {

@ -539,6 +539,7 @@
</td>
<td>
<input type="text" name="#!variable!subnet_key!#" id="#!variable!subnet_key!#" value="#!variable!subnet_value!#" placeholder="#!string!striker_0025!#" class="#!variable!subnet_class!#">
<input type="hidden" name="#!variable!subnet_key!#_default" id="#!variable!subnet_key!#_default" value="#!variable!subnet_value_default!#">
</td>
<td>
&nbsp;
@ -589,6 +590,7 @@
</td>
<td>
<input type="text" name="#!variable!subnet_key!#" id="#!variable!subnet_key!#" value="#!variable!subnet_value!#" placeholder="#!string!striker_0025!#" class="#!variable!subnet_class!#">
<input type="hidden" name="#!variable!subnet_key!#_default" id="#!variable!subnet_key!#_default" value="#!variable!subnet_value_default!#">
</td>
<td>
&nbsp;

Loading…
Cancel
Save