Adjust UI spacing and auto-load default subnet

This commit is contained in:
Caesar Kabalan 2023-05-18 00:29:21 -04:00
parent 5ab635e471
commit d53774d89e
No known key found for this signature in database
GPG key ID: DDFEF5FF6CFAB608
3 changed files with 29 additions and 8 deletions

2
dist/index.html vendored
View file

@ -21,7 +21,7 @@
</svg> </svg>
</a> </a>
</div> </div>
<h1>Visual Subnet Calculator</h1> <h1>Visual Subnet Calculator <span style="font-size:1rem;">(UNDER CONSTRUCTION)</span></h1>
<div class="alert alert-primary alert-dismissible show mt-3" role="alert"> <div class="alert alert-primary alert-dismissible show mt-3" role="alert">
Enter the network you wish to subnet and use the Split/Join buttons on the right to start designing! Enter the network you wish to subnet and use the Split/Join buttons on the right to start designing!
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>

17
dist/main.css vendored
View file

@ -31,8 +31,8 @@
/* Equivalent to p-1 */ /* Equivalent to p-1 */
padding: 0.25rem; padding: 0.25rem;
/* Equivalent to p-2 */ /* Equivalent to p-2 */
padding-top: 0.5rem; padding-top: 0.25rem;
padding-bottom: 0.5rem; padding-bottom: 0.25rem;
} }
/* /*
@ -59,6 +59,7 @@
cursor: pointer; cursor: pointer;
min-width: 2.3rem; min-width: 2.3rem;
width: 1%; width: 1%;
font-size:1rem;
} }
#calc td.join { #calc td.join {
@ -67,6 +68,7 @@
cursor: pointer; cursor: pointer;
min-width: 2.3rem; min-width: 2.3rem;
width: 1%; width: 1%;
font-size:1rem;
} }
#calc td.split, #calc td.join { #calc td.split, #calc td.join {
@ -77,7 +79,8 @@
padding-right: 0.4rem; padding-right: 0.4rem;
} }
#calc .note { #calc .note {
padding-left:0.5rem;
padding-right:0.5rem;
} }
#calc .note label,input { #calc .note label,input {
@ -86,18 +89,24 @@
#calc .row_address { #calc .row_address {
white-space: nowrap; white-space: nowrap;
padding-left:0.5rem;
padding-right:0.5rem;
} }
#calc .row_range { #calc .row_range {
/* TODO: Make this a checkbox? /* TODO: Make this a checkbox?
white-space: nowrap; white-space: nowrap;
*/ */
padding-left:0.5rem;
padding-right:0.5rem;
} }
#calc .row_usable { #calc .row_usable {
/* TODO: Make this a checkbox? /* TODO: Make this a checkbox?
white-space: nowrap; white-space: nowrap;
*/ */
padding-left:0.5rem;
padding-right:0.5rem;
} }
#calc .row_hosts { #calc .row_hosts {
@ -125,5 +134,5 @@
-webkit-writing-mode: vertical-rl; -webkit-writing-mode: vertical-rl;
writing-mode: vertical-rl; writing-mode: vertical-rl;
white-space: nowrap; white-space: nowrap;
padding-top: 0.5rem; padding-top: 0.25rem;
} }

14
dist/main.js vendored
View file

@ -2,6 +2,14 @@ let subnetMap = {};
let maxNetSize = 0; let maxNetSize = 0;
let infoColumnCount = 5 let infoColumnCount = 5
$('#btn_go').on('click', function() { $('#btn_go').on('click', function() {
reset();
})
$('#btn_reset').on('click', function() {
reset();
})
function reset() {
let rootCidr = get_network($('#network').val(), $('#netsize').val()) + '/' + $('#netsize').val() let rootCidr = get_network($('#network').val(), $('#netsize').val()) + '/' + $('#netsize').val()
subnetMap = {} subnetMap = {}
subnetMap[rootCidr] = {} subnetMap[rootCidr] = {}
@ -51,7 +59,7 @@ $('#btn_go').on('click', function() {
} }
*/ */
renderTable(); renderTable();
}) }
$('#calcbody').on('click', 'td.split,td.join', function(event) { $('#calcbody').on('click', 'td.split,td.join', function(event) {
// HTML DOM Data elements! Yay! See the `data-*` attributes of the HTML tags // HTML DOM Data elements! Yay! See the `data-*` attributes of the HTML tags
@ -216,3 +224,7 @@ function mutate_subnet_map(verb, network, subnetTree) {
} }
} }
} }
$( document ).ready(function() {
reset();
});