feat(webui): stable type sort in Inspect: by amount of attributes, address
ci/woodpecker/push/woodpecker Pipeline was successful Details

refactor/sveltekit
Tomáš Mládek 2023-11-29 22:08:11 +01:00
parent 06f7d1a4a6
commit b99f9bc15c
1 changed files with 4 additions and 1 deletions

View File

@ -53,6 +53,9 @@
attributes: string[];
};
}>;
$: sortedTypes = Object.entries($allTypes)
.sort(([a, _], [b, __]) => a.localeCompare(b))
.sort(([_, a], [__, b]) => a.attributes.length - b.attributes.length);
async function getAllTypes(entityInfo: EntityInfo) {
const allTypes = {};
@ -422,7 +425,7 @@
<div class="properties">
<NotesEditor {address} on:change={onChange} />
<InspectTypeEditor {entity} on:change={() => revalidate()} />
{#each Object.entries($allTypes) as [typeAddr, { labels, attributes }]}
{#each sortedTypes as [typeAddr, { labels, attributes }]}
<EntryView
entries={($entity?.attributes || []).filter((e) =>
attributes.includes(e.attribute),