[ui] sort roots

feat/vaults
Tomáš Mládek 2022-02-19 17:37:22 +01:00
parent 3f79f9ba63
commit 5cef2b8960
No known key found for this signature in database
GPG Key ID: 65E225C8B3E2ED8A
1 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,6 @@
<script lang="ts">
import _ from "lodash";
import { UpListing } from "upend";
import type { ListingResult } from "upend/types";
import AttributeView from "../components/AttributeView.svelte";
@ -13,9 +15,10 @@
const response = await fetch("api/hier_roots");
const data = (await response.json()) as ListingResult;
const listing = new UpListing(data);
return Object.values(listing.objects).filter((obj) =>
Boolean(obj.attr["LBL"])
);
return Object.values(listing.objects)
.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" ? )`);
@ -47,9 +50,9 @@
<Spinner centered />
{:then data}
<ul>
{#each data as root}
{#each data as [address, _]}
<li class="root">
<UpObjectCard address={root.address} />
<UpObjectCard {address} />
</li>
{:else}
<li>No roots :(</li>