Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed Jan 14, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents c7fb5fe + 2dbe27b commit 320970a
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions api-runtime/rest-runtime/admin-web/html/vpc-subnet.html
Original file line number Diff line number Diff line change
@@ -1018,19 +1018,11 @@ <h2>System ID (Managed by CSP)</h2>
}

function showOverlay() {
const region = '{{.RegionName}}';
const regionId = '{{.Region}}';
const defaultZone = '{{.Zone}}';
const vpcNameInput = document.getElementById('vpcName');
const subnetNameInput = document.getElementById('subnetName');
const zoneSelect = document.getElementById('subnetZone');
const connConfig = document.getElementById('connConfig').value;

vpcNameInput.value = `${region}-vpc-${Math.random().toString(36).substring(2, 5)}`;
document.getElementById('vpcCIDR').value = '10.0.0.0/16';
subnetNameInput.value = `${region}-${defaultZone}-subnet-${Math.random().toString(36).substring(2, 5)}`;
document.getElementById('subnetCIDR').value = '10.0.1.0/24';

fetch(`/spider/regionzone/${regionId}?ConnectionName=${connConfig}`)
.then(response => response.json())
.then(data => {
@@ -1075,12 +1067,16 @@ <h2>System ID (Managed by CSP)</h2>
const vpcNameInput = document.getElementById('vpcName');
const subnetNameInput = document.getElementById('subnetName');
const zoneInput = document.getElementById('subnetZone');
const connConfig = document.getElementById('connConfig').value;
const vpcCIDRInput = document.getElementById('vpcCIDR');
const subnetCIDRInput = document.getElementById('subnetCIDR');

vpcNameInput.value = `${region}-vpc-${Math.random().toString(36).substring(2, 5)}`;
document.getElementById('vpcCIDR').value = '10.0.0.0/16';
vpcCIDRInput.value = '10.0.0.0/16';
disableGCPCIDR(connConfig);
zoneInput.value = zone;
subnetNameInput.value = `${region}-${zone}-subnet-${Math.random().toString(36).substring(2, 5)}`;
document.getElementById('subnetCIDR').value = '10.0.1.0/24';
subnetCIDRInput.value = '10.0.1.0/24';

document.querySelectorAll('.vpc-tag-input, .subnet-tag-input').forEach(tagInput => tagInput.remove());
}
@@ -1761,5 +1757,16 @@ <h2>System ID (Managed by CSP)</h2>
selection.removeAllRanges();
}

// Disable VPC CIDR Input in GCP
function disableGCPCIDR(connConfig){
const vpcCIDRInput = document.getElementById('vpcCIDR');
if (currentProvider == 'GCP') {
vpcCIDRInput.disabled = true;
vpcCIDRInput.value = 'NA';
vpcCIDRInput.style.color = 'gray';
vpcCIDRInput.style.backgroundColor = '#f0f0f0';
}
}

</script>
</html>

0 comments on commit 320970a

Please sign in to comment.