[ui] also add pre-label to result of search getObjects
parent
ad21ed6857
commit
6b5b8f4bb9
|
@ -6,15 +6,20 @@ export function baseSearch(query: string) {
|
|||
return queryFn(() => `(matches ? ? (contains "${query}"))`);
|
||||
}
|
||||
|
||||
export async function getObjects(entries: UpEntry[]): Promise<string[]> {
|
||||
export async function getObjects(
|
||||
entries: UpEntry[]
|
||||
): Promise<[string, string][]> {
|
||||
const labelled = entries
|
||||
.filter((e) => e.attribute == "LBL")
|
||||
.map((e) => e.entity);
|
||||
.map((e) => [e.entity, String(e.value.c)] as [string, string]);
|
||||
const aliased = entries
|
||||
.filter((e) => e.attribute === "ALIAS")
|
||||
.map(async (e) => {
|
||||
const entry = await fetchEntry(e.entity);
|
||||
return String(entry.value.c);
|
||||
.map(async (aliasEntry) => {
|
||||
const entry = await fetchEntry(aliasEntry.entity);
|
||||
return [String(entry.value.c), String(aliasEntry.value.c)] as [
|
||||
string,
|
||||
string
|
||||
];
|
||||
});
|
||||
return labelled.concat(await Promise.all(aliased));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
{#if objects.length}
|
||||
<h2>Objects</h2>
|
||||
<ul>
|
||||
{#each objects as address}
|
||||
{#each objects as [address, _]}
|
||||
<li>
|
||||
<UpObjectDisplay
|
||||
{address}
|
||||
|
|
Loading…
Reference in New Issue