From 4f257a745b4fd9f279aa19d7c4abcffbb8fba535 Mon Sep 17 00:00:00 2001 From: LD-Reborn Date: Mon, 19 Jan 2026 13:14:04 +0100 Subject: [PATCH] Added renaming and adding query results , fixed missing localization --- src/Server/Resources/SharedResources.de.resx | 12 +++ src/Server/Resources/SharedResources.en.resx | 12 +++ src/Server/Views/Home/Searchdomains.cshtml | 90 ++++++++++++++------ 3 files changed, 89 insertions(+), 25 deletions(-) diff --git a/src/Server/Resources/SharedResources.de.resx b/src/Server/Resources/SharedResources.de.resx index d781f35..7c17e42 100644 --- a/src/Server/Resources/SharedResources.de.resx +++ b/src/Server/Resources/SharedResources.de.resx @@ -324,4 +324,16 @@ Wenn diese Einstellung aktiv ist, wird das Abrufen von Embeddings beim Indizieren von Entities parallelisiert. Deaktiviere diese Einstellung, falls Model-unloading ein Problem ist. + + Ergebnis hinzufügen + + + Suchanfrage wurde erfolgreich angepasst + + + RAM Verwendung insgesamt + + + Datenbankgröße insgesamt + \ No newline at end of file diff --git a/src/Server/Resources/SharedResources.en.resx b/src/Server/Resources/SharedResources.en.resx index 56ba0f1..94163fc 100644 --- a/src/Server/Resources/SharedResources.en.resx +++ b/src/Server/Resources/SharedResources.en.resx @@ -324,4 +324,16 @@ With this setting activated the embeddings retrieval will be parallelized when indexing entities. Disable this setting if model unloading is an issue. + + Add result + + + Search query was updated successfully + + + Total RAM usage + + + Total Database size + \ No newline at end of file diff --git a/src/Server/Views/Home/Searchdomains.cshtml b/src/Server/Views/Home/Searchdomains.cshtml index 2eccf90..4cb71de 100644 --- a/src/Server/Views/Home/Searchdomains.cshtml +++ b/src/Server/Views/Home/Searchdomains.cshtml @@ -265,12 +265,13 @@

@T["Results"]

+ - + @@ -970,7 +971,7 @@ }).then(async response => { result = await response.json(); if (response.ok && result.Success) { - showToast("@T["Searchdomain was created successfully"]", "success"); + showToast("@T["Search query was updated successfully"]", "success"); console.log('Search query was updated successfully'); selectDomain(getSelectedDomainKey()); } else { @@ -1494,28 +1495,7 @@ `; } else { query.Results.forEach(r => { - const row = document.createElement('tr'); - row.setAttribute("draggable", true); - const tdScore = document.createElement('td'); - const scoreInput = document.createElement('input'); - scoreInput.classList.add('form-control'); - scoreInput.value = r.Score.toFixed(4); - tdScore.append(scoreInput); - const tdName = document.createElement('td'); - tdName.classList.add("text-break"); - tdName.innerText = r.Name; - const tdAction = document.createElement('td'); - const deleteButton = document.createElement('button'); - deleteButton.classList.add('btn', 'btn-danger', 'btn-sm'); - deleteButton.innerText = '@Html.Raw(T["Delete"])'; - deleteButton.onclick = function() { - row.remove(); - }; - tdAction.append(deleteButton); - row.append(tdScore); - row.append(tdName); - row.append(tdAction); - resultsBody.appendChild(row); + queryUpdateAddResult(r.Score.toFixed(4), r.Name, resultsBody); }); } @@ -1526,6 +1506,66 @@ modal.show(); } + function queryUpdateAddResult(score, name, target=null, insertAtTop=false) { + target = target ?? document.getElementById('queryUpdateResultsBody'); + + const row = document.createElement('tr'); + row.setAttribute("draggable", true); + const tdScore = document.createElement('td'); + const scoreInput = document.createElement('input'); + scoreInput.classList.add('form-control'); + scoreInput.value = score; + scoreInput.ariaLabel = "@T["Score"]"; + tdScore.append(scoreInput); + const tdName = document.createElement('td'); + const tdNameInput = document.createElement('input'); + tdNameInput.classList.add("form-control"); + tdNameInput.value = name; + tdNameInput.ariaLabel = "@T["Name"]"; + tdName.append(tdNameInput); + const tdAction = document.createElement('td'); + tdAction.classList.add('text-center'); + + const upButton = document.createElement('button'); + upButton.classList.add('btn', 'btn-primary', 'btn-sm'); + upButton.innerText = '↑'; + upButton.onclick = function() { + const currentRow = this.closest('tr'); + const previousRow = currentRow.previousElementSibling; + if (previousRow) { + target.insertBefore(currentRow, previousRow); + } + }; + const downButton = document.createElement('button'); + downButton.classList.add('btn', 'btn-primary', 'btn-sm', 'mx-1'); + downButton.innerText = '↓'; + downButton.onclick = function() { + const currentRow = this.closest('tr'); + const nextRow = currentRow.nextElementSibling; + if (nextRow) { + target.insertBefore(nextRow, currentRow); + } + }; + + const deleteButton = document.createElement('button'); + deleteButton.classList.add('btn', 'btn-danger', 'btn-sm', 'mx-2'); + deleteButton.innerText = '@Html.Raw(T["Delete"])'; + deleteButton.onclick = function() { + row.remove(); + }; + tdAction.append(upButton); + tdAction.append(downButton); + tdAction.append(deleteButton); + row.append(tdScore); + row.append(tdName); + row.append(tdAction); + if (!insertAtTop) { + target.appendChild(row); + } else { + target.insertBefore(row, target.firstChild); + } + } + function NumberOfBytesAsHumanReadable(bytes, decimals = 2) { if (bytes === 0) return '0 B'; if (bytes > 1.20892581961*(10**27)) return "∞ B"; @@ -1732,7 +1772,7 @@ // Get the text content from the second cell (index 1) which contains the path const score = parseFloat(cells[0].firstChild.value); - const name = cells[1].textContent.trim(); + const name = cells[1].firstChild.value; result.push({ "Score": score,
@T["Score"] @T["Name"]@T["Action"]@T["Action"]