fix empty regulation input
This commit is contained in:
parent
1dbc4de5ed
commit
65ff1d1105
|
@ -378,22 +378,30 @@ div>label {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_inputs() {
|
function update_inputs() {
|
||||||
Promise.all([
|
let urls = [
|
||||||
fetch(document.getElementById("base_input").value, { mode: "cors" }),
|
fetch(document.getElementById("base_input").value, { mode: "cors" }),
|
||||||
fetch(document.getElementById("regulation_input").value, { mode: "cors" }),
|
];
|
||||||
]).then((res) => {
|
let reg = document.getElementById("regulation_input").value;
|
||||||
|
if (reg !== "") {
|
||||||
|
urls.push(fetch(reg, { mode: "cors" }));
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all(urls).then((res) => {
|
||||||
res.forEach((r) => {
|
res.forEach((r) => {
|
||||||
if (!r.ok) {
|
if (!r.ok) {
|
||||||
throw new Error(r.status);
|
throw new Error(r.status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Promise.all([res[0].text(), res[1].text()]).then((d) => {
|
let ymls = [res[0].text()];
|
||||||
try {
|
if (reg !== "") {
|
||||||
let reg = d[1];
|
ymls.push(res[1].text());
|
||||||
if (reg === "") {
|
} else {
|
||||||
reg = "- header: true\n columns: []\n titles: []\n frequency_unit: GHz\n- frequency: 0-" + 9007199254740991;
|
// make dummy yml file with one big frequency range
|
||||||
|
ymls.push("- header: true\n columns: []\n titles: []\n frequency_unit: GHz\n- frequency: 0-" + 9007199254740991);
|
||||||
}
|
}
|
||||||
update_table(yaml.load(d[0]), yaml.load(reg));
|
Promise.all(ymls).then((d) => {
|
||||||
|
try {
|
||||||
|
update_table(yaml.load(d[0]), yaml.load(d[1]));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
display_error(e);
|
display_error(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue