fix: show names in admin tag panel
This commit is contained in:
@@ -59,11 +59,8 @@ public class TagController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public List<String> searchTags(@RequestParam(defaultValue = "") String query) {
|
public List<Tag> searchTags(@RequestParam(defaultValue = "") String query) {
|
||||||
return tagRepository.findByNameContainingIgnoreCase(query)
|
return tagRepository.findByNameContainingIgnoreCase(query);
|
||||||
.stream()
|
|
||||||
.map(Tag::getName)
|
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -14,12 +14,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
console.log('fetch tags')
|
|
||||||
const res = await fetch(`/api/tags?query=${encodeURIComponent(query)}`);
|
const res = await fetch(`/api/tags?query=${encodeURIComponent(query)}`);
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
// Filter out tags already selected
|
// API returns Tag objects with { id, name }
|
||||||
suggestions = data.filter((t: string) => !tags.includes(t));
|
const names: string[] = data.map((t: { name: string }) => t.name);
|
||||||
|
suggestions = names.filter((t) => !tags.includes(t));
|
||||||
showSuggestions = true;
|
showSuggestions = true;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -43,7 +43,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleKeydown(e: KeyboardEvent) {
|
function handleKeydown(e: KeyboardEvent) {
|
||||||
console.log("keydown",e)
|
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (activeIndex >= 0 && suggestions[activeIndex]) {
|
if (activeIndex >= 0 && suggestions[activeIndex]) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
export let form;
|
export let form;
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
let activeTab = 'users';
|
let activeTab = 'users';
|
||||||
let editingTagId: string | null = null;
|
let editingTagId: string | null = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user