Fix Network Address/Size population from Import JSON

This commit is contained in:
Caesar Kabalan 2023-06-05 13:32:06 -07:00
parent 38160c2a46
commit 7e18e09a8c
No known key found for this signature in database
GPG key ID: DDFEF5FF6CFAB608

6
dist/js/main.js vendored
View file

@ -447,9 +447,6 @@ function processConfigUrl() {
renameKey(urlConfig, 'v', 'config_version') renameKey(urlConfig, 'v', 'config_version')
renameKey(urlConfig, 's', 'subnets') renameKey(urlConfig, 's', 'subnets')
expandKeys(urlConfig['subnets']) expandKeys(urlConfig['subnets'])
let subnet_split = Object.keys(urlConfig['subnets'])[0].split('/')
$('#network').val(subnet_split[0])
$('#netsize').val(subnet_split[1])
importConfig(urlConfig) importConfig(urlConfig)
return true return true
} }
@ -506,6 +503,9 @@ function renameKey(obj, oldKey, newKey) {
function importConfig(text) { function importConfig(text) {
// TODO: Probably need error checking here // TODO: Probably need error checking here
if (text['config_version'] === '1') { if (text['config_version'] === '1') {
let subnet_split = Object.keys(text['subnets'])[0].split('/')
$('#network').val(subnet_split[0])
$('#netsize').val(subnet_split[1])
subnetMap = text['subnets']; subnetMap = text['subnets'];
renderTable() renderTable()
} }