mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2026-11-03 12:47:03 -06:00
feat: add promote_to_root nodes configuration
This commit is contained in:
1 parent
4fc279d26e
commit
a96f4567d3
2 files changed
+27
-1
No files matched your search
@@ -7,6 +7,15 @@ function validateConfig() {
|
||||
alert("Queue Refresh Interval must be a number greater than 0");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate promote_to_root entries
|
||||
const rawPromote = document.getElementById("promoteToRoot").value;
|
||||
const hasInvalidEntries = rawPromote.split('\n')
|
||||
.some(line => line.trim().length === 0 && rawPromote.trim().length > 0);
|
||||
if (hasInvalidEntries) {
|
||||
alert("Please remove empty lines from Promote to Root Nodes");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,7 +24,14 @@ function updateConfig() {
|
||||
window.config.integration_common = {
|
||||
circuit_name_as_address: document.getElementById("circuitNameAsAddress").checked,
|
||||
always_overwrite_network_json: document.getElementById("alwaysOverwriteNetworkJson").checked,
|
||||
queue_refresh_interval_mins: parseInt(document.getElementById("queueRefreshInterval").value)
|
||||
queue_refresh_interval_mins: parseInt(document.getElementById("queueRefreshInterval").value),
|
||||
promote_to_root: (() => {
|
||||
const raw = document.getElementById("promoteToRoot").value;
|
||||
const list = raw.split('\n')
|
||||
.map(line => line.trim())
|
||||
.filter(line => line.length > 0);
|
||||
return list.length > 0 ? list : null;
|
||||
})()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,6 +51,10 @@ loadConfig(() => {
|
||||
document.getElementById("queueRefreshInterval").value =
|
||||
integration.queue_refresh_interval_mins ?? 30;
|
||||
|
||||
// Promote to root field
|
||||
const promoteRoot = integration.promote_to_root ? integration.promote_to_root.join('\n') : '';
|
||||
document.getElementById("promoteToRoot").value = promoteRoot;
|
||||
|
||||
// Add save button click handler
|
||||
document.getElementById('saveButton').addEventListener('click', () => {
|
||||
if (validateConfig()) {
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
<div class="form-text">How frequently to refresh queue data from the integration</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="promoteToRoot" class="form-label">Promote to Root Nodes</label>
|
||||
<textarea class="form-control" id="promoteToRoot" rows="3"></textarea>
|
||||
<div class="form-text">Enter one circuit ID per line to promote to root nodes</div>
|
||||
</div>
|
||||
|
||||
<button type="button" id="saveButton" class="btn btn-outline-primary">Save Changes</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user