Opinionated Adjustments for PR #11
* Want to keep Meta Description short for SEO purposes. * Elected to use built-in Bootstrap mode highlighting versus changing the text style * Removed the Usable IPs popovers in favor of tooltips + hyperlink
This commit is contained in:
parent
6f55ba52ec
commit
0c61b56c3c
2 changed files with 36 additions and 66 deletions
24
dist/index.html
vendored
24
dist/index.html
vendored
|
@ -6,7 +6,7 @@
|
|||
<title>Visual Subnet Calculator - Split/Join</title>
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link href="css/main.css" rel="stylesheet">
|
||||
<meta name="description" content="Quickly and easily design network layouts. Split and join subnets, add notes and color, then collaborate with others by sharing a custom link to your design. Switch to AWS or Azure Mode to calculate compliant subnets for those Cloud Platforms">
|
||||
<meta name="description" content="Quickly and easily design network layouts. Split and join subnets, add notes and color, then collaborate with others by sharing a custom link to your design.">
|
||||
<meta name="robots" content="index, follow" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="icon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="icon/favicon-32x32.png">
|
||||
|
@ -58,16 +58,15 @@
|
|||
Tools
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#importExportModal" id="btn_import_export">Import / Export</a></li>
|
||||
<li><a class="dropdown-item active" href="#" data-bs-toggle="operatingMode" data-bs-target="#operatingMode" id="dropdown_standard" aria-current="true">Mode - Standard</a></li>
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="operatingMode" data-bs-target="#operatingMode" id="dropdown_aws">Mode - AWS</a></li>
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="operatingMode" data-bs-target="#operatingMode" id="dropdown_azure">Mode - Azure</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><h6 class="dropdown-header">Mode</h6></li>
|
||||
<li><a class="dropdown-item active-mode" href="#" data-bs-toggle="operatingMode" data-bs-target="#operatingMode" id="dropdown_standard">Standard</a></li>
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="operatingMode" data-bs-target="#operatingMode" id="dropdown_azure">Azure</a></li>
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="operatingMode" data-bs-target="#operatingMode" id="dropdown_aws">AWS</a></li>
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#importExportModal" id="btn_import_export">Import / Export</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
@ -78,15 +77,12 @@
|
|||
<th id="subnetHeader" style="display: table-cell;">Subnet address</th>
|
||||
<th id="netmaskHeader" style="display: none;">Netmask</th>
|
||||
<th id="rangeHeader" style="display: table-cell;">Range of addresses</th>
|
||||
<th id="useableHeader" style="display: table-cell;" data-bs-toggle="popover" title="Usable IPs" data-bs-content="This column shows the number of usable IP addresses in each subnet." data-bs-trigger="hover focus" data-bs-placement="top">Usable IPs</th>
|
||||
<th id="useableHeader" style="display: table-cell;">Usable IPs</th>
|
||||
<th id="hostsHeader" style="display: table-cell;">Hosts</th>
|
||||
<th id="noteHeader" colspan="100%" style="display: table-cell;">
|
||||
Note
|
||||
<div style="float:right;"><span class="split">Split</span>/<span class="join">Join</span></div>
|
||||
</th>
|
||||
<!--
|
||||
<th id="joinHeader" colspan="100%" style="display: table-cell;"><span class="split">Split</span>/<span class="join">Join</span></th>
|
||||
-->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="calcbody">
|
||||
|
@ -210,12 +206,6 @@
|
|||
crossorigin="anonymous"></script>
|
||||
<script src="js/lz-string.min.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
<script>
|
||||
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
|
||||
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||
return new bootstrap.Popover(popoverTriggerEl)
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
78
dist/js/main.js
vendored
78
dist/js/main.js
vendored
|
@ -5,24 +5,24 @@ let infoColumnCount = 5
|
|||
// NORMAL mode:
|
||||
// - Smallest subnet: /32
|
||||
// - Two reserved addresses per subnet of size <= 30:
|
||||
// - Network Address (network + 0)
|
||||
// - Broadcast Address (last network address)
|
||||
// AWS mode :
|
||||
// - Net+0 = Network Address
|
||||
// - Last = Broadcast Address
|
||||
// AWS mode:
|
||||
// - Smallest subnet: /28
|
||||
// - Two reserved addresses per subnet:
|
||||
// - Network Address (network + 0)
|
||||
// - AWS Reserved - VPC Router
|
||||
// - AWS Reserved - VPC DNS
|
||||
// - AWS Reserved - Future Use
|
||||
// - Broadcast Address (last network address)
|
||||
// Azure mode :
|
||||
// - Net+0 = Network Address
|
||||
// - Net+1 = AWS Reserved - VPC Router
|
||||
// - Net+2 = AWS Reserved - VPC DNS
|
||||
// - Net+3 = AWS Reserved - Future Use
|
||||
// - Last = Broadcast Address
|
||||
// Azure mode:
|
||||
// - Smallest subnet: /29
|
||||
// - Two reserved addresses per subnet:
|
||||
// - Network Address (network + 0)
|
||||
// - Azure Reserved - Default Gateway
|
||||
// - Azure Reserved - DNS Mapping
|
||||
// - Azure Reserved - DNS Mapping
|
||||
// - Broadcast Address (last network address)
|
||||
// - Net+0 = Network Address
|
||||
// - Net+1 = Reserved - Default Gateway
|
||||
// - Net+2 = Reserved - DNS Mapping
|
||||
// - Net+3 = Reserved - DNS Mapping
|
||||
// - Last = Broadcast Address
|
||||
let noteTimeout;
|
||||
let operatingMode = 'Standard'
|
||||
let previousOperatingMode = 'Standard'
|
||||
|
@ -82,7 +82,7 @@ $('#dropdown_standard').click(function() {
|
|||
|
||||
if(!switchMode(operatingMode)) {
|
||||
operatingMode = previousOperatingMode;
|
||||
$('#dropdown_'+ operatingMode.toLowerCase()).addClass('active-mode');
|
||||
$('#dropdown_'+ operatingMode.toLowerCase()).addClass('active');
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ $('#dropdown_azure').click(function() {
|
|||
|
||||
if(!switchMode(operatingMode)) {
|
||||
operatingMode = previousOperatingMode;
|
||||
$('#dropdown_'+ operatingMode.toLowerCase()).addClass('active-mode');
|
||||
$('#dropdown_'+ operatingMode.toLowerCase()).addClass('active');
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -104,7 +104,7 @@ $('#dropdown_aws').click(function() {
|
|||
|
||||
if(!switchMode(operatingMode)) {
|
||||
operatingMode = previousOperatingMode;
|
||||
$('#dropdown_'+ operatingMode.toLowerCase()).addClass('active-mode');
|
||||
$('#dropdown_'+ operatingMode.toLowerCase()).addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -142,9 +142,9 @@ $('#btn_import_export').on('click', function() {
|
|||
})
|
||||
|
||||
function reset() {
|
||||
|
||||
set_popover_content(operatingMode);
|
||||
|
||||
|
||||
set_usable_ips_title(operatingMode);
|
||||
|
||||
let cidrInput = $('#network').val() + '/' + $('#netsize').val()
|
||||
let rootNetwork = get_network($('#network').val(), $('#netsize').val())
|
||||
let rootCidr = rootNetwork + '/' + $('#netsize').val()
|
||||
|
@ -483,7 +483,7 @@ function switchMode(operatingMode) {
|
|||
if (validateSubnetSizes(subnetMap, minSubnetSizes[operatingMode])) {
|
||||
|
||||
renderTable(operatingMode);
|
||||
set_popover_content(operatingMode);
|
||||
set_usable_ips_title(operatingMode);
|
||||
|
||||
$('#netsize').attr("pattern",netsizePatterns[operatingMode]);
|
||||
$('#input_form').removeClass('was-validated');
|
||||
|
@ -510,8 +510,8 @@ function switchMode(operatingMode) {
|
|||
}
|
||||
});
|
||||
// Remove active class from all buttons if needed
|
||||
$('#dropdown_standard, #dropdown_azure, #dropdown_aws').removeClass('active-mode');
|
||||
$('#dropdown_' + operatingMode.toLowerCase()).addClass('active-mode');
|
||||
$('#dropdown_standard, #dropdown_azure, #dropdown_aws').removeClass('active');
|
||||
$('#dropdown_' + operatingMode.toLowerCase()).addClass('active');
|
||||
isSwitched = true;
|
||||
} else {
|
||||
show_warning_modal('<div>Some subnets have a netmask size smaller than the minimum allowed for ' + operatingMode +'.</div><div>The smallest size allowed is ' + minSubnetSizes[operatingMode] + '</div>');
|
||||
|
@ -547,39 +547,19 @@ function validateSubnetSizes(subnetMap, minSubnetSize) {
|
|||
}
|
||||
|
||||
|
||||
function set_popover_content(operatingMode) {
|
||||
var popoverContent = "This column shows the number of usable IP addresses in each subnet.";
|
||||
var popoverTitle = "Usable IPs"
|
||||
|
||||
function set_usable_ips_title(operatingMode) {
|
||||
switch (operatingMode) {
|
||||
case 'AWS':
|
||||
$('#useableHeader').html('Usable IPs (<a href="https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html#subnet-sizing-ipv4" target="_blank" style="color:#000; border-bottom: 1px dotted #000; text-decoration: dotted" data-toggle="tooltip" data-placement="top" data-bs-html="true" title="AWS reserves 5 addresses in each subnet for platform use.<br/>Click to navigate to the AWS documentation.">AWS</a>)')
|
||||
break;
|
||||
case 'AZURE':
|
||||
var popoverTitle = "Usable IPs (" + operatingMode + ")";
|
||||
var popoverContent = "This column shows the number of usable IP addresses in each subnet. " + operatingMode + " reserves 5 IP Addresses"
|
||||
$('#useableHeader').html('Usable IPs (<a href="https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-faq#are-there-any-restrictions-on-using-ip-addresses-within-these-subnets" target="_blank" style="color:#000; border-bottom: 1px dotted #000; text-decoration: dotted" data-toggle="tooltip" data-placement="top" data-bs-html="true" title="Azure reserves 5 addresses in each subnet for platform use.<br/>Click to navigate to the Azure documentation.">Azure</a>)')
|
||||
break;
|
||||
default:
|
||||
var popoverContent = "This column shows the number of usable IP addresses in each subnet.";
|
||||
var popoverTitle = "Usable IPs"
|
||||
$('#useableHeader').html('Usable IPs')
|
||||
break;
|
||||
}
|
||||
|
||||
// Ensure the popover is properly disposed
|
||||
$('#useableHeader').popover('dispose');
|
||||
|
||||
// Reinitialize the popover with direct options for title and content
|
||||
$('#useableHeader').popover({
|
||||
trigger: 'hover',
|
||||
html: true,
|
||||
title: function() {
|
||||
// You can compute or fetch the title dynamically here
|
||||
return popoverTitle;
|
||||
},
|
||||
content: function() {
|
||||
// You can compute or fetch the content dynamically here
|
||||
return popoverContent;
|
||||
}
|
||||
});
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
}
|
||||
|
||||
function show_warning_modal(message) {
|
||||
|
|
Loading…
Reference in a new issue