add header to base yml file for column selection
This commit is contained in:
parent
87ce5c1a8e
commit
401b52b768
|
@ -1,3 +1,5 @@
|
||||||
|
- band: header
|
||||||
|
columns: [band, frequency, mode, bandwidth, description]
|
||||||
- band: 2.2 km
|
- band: 2.2 km
|
||||||
mode: CW
|
mode: CW
|
||||||
bandwidth: 200
|
bandwidth: 200
|
||||||
|
|
108
band-plan.html
108
band-plan.html
|
@ -90,61 +90,73 @@ div#togglebuttons>button {
|
||||||
|
|
||||||
function update_table(bands, additions) {
|
function update_table(bands, additions) {
|
||||||
var tdata = [];
|
var tdata = [];
|
||||||
|
var header = {};
|
||||||
|
|
||||||
|
// first, fill header
|
||||||
bands.forEach((band) => {
|
bands.forEach((band) => {
|
||||||
band.parts.forEach((part) => {
|
if (band.band === "header") {
|
||||||
let p = {
|
header = structuredClone(band);
|
||||||
"band": band.band,
|
}
|
||||||
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end,
|
});
|
||||||
"mode": band.mode,
|
|
||||||
//"band_start": band.start,
|
// then fill tdata
|
||||||
//"band_end": band.end,
|
bands.forEach((band) => {
|
||||||
"bandwidth": band.bandwidth,
|
if (band.band !== "header") {
|
||||||
"description": part.description,
|
band.parts.forEach((part) => {
|
||||||
};
|
let p = {};
|
||||||
let parts_already_added = false;
|
header.columns.forEach((col) => {
|
||||||
additions.forEach((add) => {
|
p[col] = band[col];
|
||||||
if (typeof part.at !== "undefined") {
|
if (col == "description") {
|
||||||
if (isInRange(part.at, add.start, add.end)) {
|
p[col] = part[col];
|
||||||
// at single frequency
|
|
||||||
add_power(add, p);
|
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
// frequeny range
|
p["frequency"] = typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end;
|
||||||
if ((add.start == part.start) && (add.end == part.end)) {
|
|
||||||
// ranges are the same
|
let parts_already_added = false;
|
||||||
add_power(add, p);
|
additions.forEach((add) => {
|
||||||
} else if (isInRange(part.start, add.start, add.end) && isInRange(part.end, add.start, add.end)) {
|
if (typeof part.at !== "undefined") {
|
||||||
// range of part is inside of range of add
|
if (isInRange(part.at, add.start, add.end)) {
|
||||||
add_power(add, p);
|
// at single frequency
|
||||||
|
add_power(add, p);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// part range is split by add range
|
// frequeny range
|
||||||
if (isInRange(add.start, part.start, part.end)) {
|
if ((add.start == part.start) && (add.end == part.end)) {
|
||||||
// part range starts below add range
|
// ranges are the same
|
||||||
let p_clone = structuredClone(p);
|
add_power(add, p);
|
||||||
let start = add.start;
|
} else if (isInRange(part.start, add.start, add.end) && isInRange(part.end, add.start, add.end)) {
|
||||||
let end = part.end < add.end ? part.end : add.end;
|
// range of part is inside of range of add
|
||||||
p_clone["frequency"] = start + '\u2013' + end;
|
add_power(add, p);
|
||||||
add_power(add, p_clone);
|
} else {
|
||||||
tdata.push(p_clone);
|
// part range is split by add range
|
||||||
parts_already_added = true;
|
if (isInRange(add.start, part.start, part.end)) {
|
||||||
} else if (isInRange(add.end, part.start, part.end)) {
|
// part range starts below add range
|
||||||
// add range starts below part range
|
let p_clone = structuredClone(p);
|
||||||
let p_clone = structuredClone(p);
|
let start = add.start;
|
||||||
let start = part.start;
|
let end = part.end < add.end ? part.end : add.end;
|
||||||
let end = add.end;
|
p_clone["frequency"] = start + '\u2013' + end;
|
||||||
p_clone["frequency"] = start + '\u2013' + end;
|
add_power(add, p_clone);
|
||||||
add_power(add, p_clone);
|
tdata.push(p_clone);
|
||||||
tdata.push(p_clone);
|
parts_already_added = true;
|
||||||
parts_already_added = true;
|
} else if (isInRange(add.end, part.start, part.end)) {
|
||||||
|
// add range starts below part range
|
||||||
|
let p_clone = structuredClone(p);
|
||||||
|
let start = part.start;
|
||||||
|
let end = add.end;
|
||||||
|
p_clone["frequency"] = start + '\u2013' + end;
|
||||||
|
add_power(add, p_clone);
|
||||||
|
tdata.push(p_clone);
|
||||||
|
parts_already_added = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
if (!parts_already_added) {
|
||||||
|
tdata.push(p);
|
||||||
}
|
}
|
||||||
|
parts_already_added = false;
|
||||||
});
|
});
|
||||||
if (!parts_already_added) {
|
}
|
||||||
tdata.push(p);
|
|
||||||
}
|
|
||||||
parts_already_added = false;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// require in tabular-tables
|
// require in tabular-tables
|
||||||
|
|
Loading…
Reference in a new issue