Added settings handling in the backend and settings string display in the front-end

This commit is contained in:
2025-12-18 20:19:13 +01:00
parent bb8543dab2
commit affdeb00b3
6 changed files with 70 additions and 4 deletions

View File

@@ -53,6 +53,7 @@
<label class="form-label">Settings</label>
<div class="col-md-6">
<input
id="searchdomainConfig"
type="text"
class="form-control"
placeholder="JSON-string"
@@ -380,6 +381,11 @@
return document.querySelector('.domain-item.active').id.split("_")[2] - 0;
}
function getSearchdomainConfig(domainKey) {
return fetch(`/Searchdomain/GetSettings?searchdomain=${encodeURIComponent(domains[domainKey])}`)
.then(r => r.json());
}
function selectDomain(domainKey) {
document.querySelectorAll('.domain-item').forEach(item => {
item.classList.remove('active');
@@ -479,6 +485,9 @@
function populateQueriesTable(filterText = '') {
if (!queries) return;
let searchdomainConfigPromise = getSearchdomainConfig(getSelectedDomainKey());
let configElement = document.getElementById('searchdomainConfig');
const tbody = document.querySelector('#queriesTable tbody');
tbody.innerHTML = '';
@@ -507,6 +516,20 @@
tbody.appendChild(row);
});
searchdomainConfigPromise.then(searchdomainConfig => {
if (searchdomainConfig != null && searchdomainConfig.Settings != null)
{
configElement.value = JSON.stringify(searchdomainConfig.Settings, null, 2);
} else {
configElement.value = 'Error fetching searchdomain config';
console.log(searchdomainConfig);
// TODO add toast
console.error('Failed to fetch searchdomain config');
}
});
}
function flagSearchdomainAsErroneous(domainKey) {