Skip to content

Commit 1e5571d

Browse files
committed
Nicer searchUI for Web API
1 parent bc74b57 commit 1e5571d

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

Motely.API/Program.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ public static WebApplication CreateApi(string[]? args = null)
354354
foreach (var file in filterFiles)
355355
{
356356
var name = Path.GetFileNameWithoutExtension(file);
357+
358+
// Skip unsaved/temp files
359+
if (name.StartsWith("_UNSAVED_", StringComparison.OrdinalIgnoreCase) ||
360+
name.StartsWith("__TEMP_", StringComparison.OrdinalIgnoreCase) ||
361+
name.Contains("{unsaved}", StringComparison.OrdinalIgnoreCase))
362+
continue;
363+
357364
string filterJaml;
358365
try
359366
{

SearchResults/NegativeLegendary_Ghost_White_temp.jaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

wwwroot/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ <h1 class="jaml-logo">JAML</h1>
251251
stake: White</textarea>
252252
<div class="action-buttons">
253253
<button id="searchBtn" onclick="toggleSearch()" class="button-primary" style="width: 120px;">Start Search</button>
254+
<button id="saveBtn" onclick="saveCurrentFilter()" class="button-small" style="width: 70px;">Save</button>
254255
<button id="shareBtn" onclick="shareSearch()" class="button-small" style="width: 70px;">Share</button>
255256
</div>
256257
</div>

wwwroot/script.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,8 +1095,13 @@ async function stopAllSearches() {
10951095
showStatus('All searches stopped');
10961096
await loadFilters();
10971097
} else {
1098-
const err = await response.json();
1099-
showStatus(`Error: ${err.error || 'Failed to stop'}`);
1098+
// Handle empty or invalid JSON response
1099+
try {
1100+
const err = await response.json();
1101+
showStatus(`Error: ${err.error || 'Failed to stop'}`);
1102+
} catch {
1103+
showStatus(`Error: HTTP ${response.status}`);
1104+
}
11001105
}
11011106
} catch (e) {
11021107
showStatus(`Error: ${e.message}`);

0 commit comments

Comments
 (0)