[ui] sort roots
This commit is contained in:
parent
3f79f9ba63
commit
5cef2b8960
1 changed files with 8 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
import { UpListing } from "upend";
|
import { UpListing } from "upend";
|
||||||
import type { ListingResult } from "upend/types";
|
import type { ListingResult } from "upend/types";
|
||||||
import AttributeView from "../components/AttributeView.svelte";
|
import AttributeView from "../components/AttributeView.svelte";
|
||||||
|
@ -13,9 +15,10 @@
|
||||||
const response = await fetch("api/hier_roots");
|
const response = await fetch("api/hier_roots");
|
||||||
const data = (await response.json()) as ListingResult;
|
const data = (await response.json()) as ListingResult;
|
||||||
const listing = new UpListing(data);
|
const listing = new UpListing(data);
|
||||||
return Object.values(listing.objects).filter((obj) =>
|
return Object.values(listing.objects)
|
||||||
Boolean(obj.attr["LBL"])
|
.filter((obj) => Boolean(obj.attr["LBL"]))
|
||||||
);
|
.map((obj) => [obj.address, obj.identify().join(" | ")])
|
||||||
|
.sort(([_, i1], [__, i2]) => i1.localeCompare(i2));
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const { result: lastVisitedQuery } = query(`(matches ? "LAST_VISITED" ? )`);
|
const { result: lastVisitedQuery } = query(`(matches ? "LAST_VISITED" ? )`);
|
||||||
|
@ -47,9 +50,9 @@
|
||||||
<Spinner centered />
|
<Spinner centered />
|
||||||
{:then data}
|
{:then data}
|
||||||
<ul>
|
<ul>
|
||||||
{#each data as root}
|
{#each data as [address, _]}
|
||||||
<li class="root">
|
<li class="root">
|
||||||
<UpObjectCard address={root.address} />
|
<UpObjectCard {address} />
|
||||||
</li>
|
</li>
|
||||||
{:else}
|
{:else}
|
||||||
<li>No roots :(</li>
|
<li>No roots :(</li>
|
||||||
|
|
Loading…
Reference in a new issue