EC SDWAN Tunnel Budget Tool (Prod)

by edgeconnecttme

HTML

<!-- HTML -->
<div class="container">
    <div class="column inputs">
        <h2>Network Parameters</h2>
        <div class="form-group">
            <label for="hubGateways">Hub Gateways</label>
            <div>
                <input id="hubGateways" min="1" type="number" value="1" aria-describedby="hubError">
                <div class="tooltip">
                    <span class="help-icon">?</span>
                    <span class="tooltiptext">The number of hub gateways in your SD-WAN deployment. Must be at least 1.</span>
                </div>
            </div>
        </div>
        <div class="error-message" id="hubError">Hub Gateways must be at least 1</div>
        
        <div class="form-group">
            <label for="spokeGateways">Spoke Gateways</label>
            <div>
                <input id="spokeGateways" max="5000" min="1" type="number" value="1" aria-describedby="spokeError">
                <div class="tooltip">
                    <span class="help-icon">?</span>
                    <span class="tooltiptext">The number of spoke gateways connecting to your hubs. Maximum 5000 total gateways.</span>
                </div>
            </div>
        </div>
        <div class="error-message" id="spokeError">Spoke Gateways must be at least 1</div>
        
        <div class="form-group">
            <label for="hubWanInterfaces">WAN Labels per Hub</label>
            <div>
                <input id="hubWanInterfaces" min="1" type="number" value="1" aria-describedby="hubWanError">
                <div class="tooltip">
                    <span class="help-icon">?</span>
                    <span class="tooltiptext">The number of WAN labels on each hub gateway.</span>
                </div>
            </div>
        </div>
        <div class="error-message" id="hubWanError">WAN Labels must be at least 1</div>
        
        <div class="form-group">
            <label for="spokeWanInterfaces">WAN...

CSS

/* CSS */

h2 {
    font-size: 16px;
    margin-bottom: 10px;
}

label {
    font-size: 12px;
}

input {
    padding: 6px 8px;
    font-size: 12px;
    width: 60px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.form-group {
    margin-bottom: 10px;
}

.column {
    padding: 16px;
}

.error-message {
    font-size: 11px;
    margin-top: 4px;
}

.tooltiptext {
    font-size: 11px;
}

:root {
    --primary-color: #01A982;
    --secondary-color: #0D5265;
    --light-bg: #f0f0f0;
    --card-bg: #ffffff;
    --text-color: #333333;
    --error-color: #d32f2f;
    --border-color: #cccccc;
    --highlight-bg: #ffecec;
    --success-color: #4caf50;
    --warning-color: #ff9800;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--light-bg);
    margin: 0;
    padding: 16px;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    display: flex;
    flex-wrap: nowrap;  /* Force all on one line */
    justify-content: space-between;
    gap: 20px;
    width: 100%;         /* Full width of parent */
    max-width: none;     /* Remove limiting constraint */
}

.column {
    background-color: var(--card-bg);
    padding: 16px;
    font-size: 14px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    /*flex: 1;*/
    width: 32%;
    transition: transform 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.column:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.inputs div,
.output-row {
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.output-row {
    padding: 8px 0;
    border-bottom: 1px dotted #eee;
}

.output-row:last-of-type {
    border-bottom: none;
}

.output-row span:first-child {
    font-weight: normal;
}

.output-value {
    font-size: 14px;
}

label {
   ...

JavaScript

/**
 *
 * EdgeConnect SD-WAN Tunnel Calculator
 * 
 */
'use strict'; // Enable strict mode for better error catching and prevent use of undeclared variables

/**
 * DOM Element Cache
 */
const DOM = {
  // Input elements
  hubGateways: () => document.getElementById('hubGateways'),
  spokeGateways: () => document.getElementById('spokeGateways'),
  hubWanInterfaces: () => document.getElementById('hubWanInterfaces'),
  spokeWanInterfaces: () => document.getElementById('spokeWanInterfaces'),
  hubSpokeOverlays: () => document.getElementById('hubSpokeOverlays'),
  meshOverlays: () => document.getElementById('meshOverlays'),
  enableCrossConnect: () => document.getElementById('enableCrossConnect'),
  sseServices: () => document.getElementById('sseServices'),
  
  // Output elements - Hub
  hubOutput1: () => document.getElementById('hubOutput1'),
  hubOutput3: () => document.getElementById('hubOutput3'),
  hubOutput4: () => document.getElementById('hubOutput4'),
  hubOutput5: () => document.getElementById('hubOutput5'),
  hubOutput6: () => document.getElementById('hubOutput6'),
  hubSum: () => document.getElementById('hubSum'),
  hubTunnelFill: () => document.getElementById('hubTunnelFill'),
  hubPercentage: () => document.getElementById('hubPercentage'),
  hubStatus: () => document.getElementById('hubStatus'),
  
  // Output elements - Spoke
  spokeOutputF15: () => document.getElementById('spokeOutputF15'),
  spokeOutputF17: () => document.getElementById('spokeOutputF17'),
  spokeOutputF18: () => document.getElementById('spokeOutputF18'),
  spokeOutputF20: () => document.getElementById('spokeOutputF20'),
  spokeOutputF21: () => document.getElementById('spokeOutputF21'),
  spokeSum: () => document.getElementById('spokeSum'),
  spokeTunnelFill: () => document.getElementById('spokeTunnelFill'),
  spokePercentage: () => document.getElementById('spokePercentage'),
  spokeStatus: () => document.getElementById('spokeStatus'),
  
  //...