[ui] fix initial sort in table

feat/vaults
Tomáš Mládek 2022-02-06 23:37:05 +01:00
parent 5e10c78490
commit 420efdfdb4
No known key found for this signature in database
GPG Key ID: ED21612889E75EC5
1 changed files with 23 additions and 5 deletions

View File

@ -5,13 +5,13 @@
import UpObject from "../display/UpObject.svelte";
import { createEventDispatcher } from "svelte";
import type { AttributeChange, AttributeUpdate } from "../../types/base";
import type { UpEntry } from "upend";
import type { UpEntry, UpListing } from "upend";
import IconButton from "../utils/IconButton.svelte";
import Selector from "../utils/Selector.svelte";
import type { IValue } from "upend/types";
import Editable from "../utils/Editable.svelte";
import { query } from "../../lib/entity";
import { readable } from "svelte/store";
import { Readable, readable } from "svelte/store";
const dispatch = createEventDispatcher();
export let columns: string;
@ -58,7 +58,7 @@
}
// Labelling
let labelListing = readable(undefined);
let labelListing: Readable<UpListing> = readable(undefined);
$: {
const addresses = [];
entries
@ -156,6 +156,26 @@
});
}
$: {
if ($labelListing) {
entries.forEach((entry) => {
addSortKeys(
entry.entity,
$labelListing.getObject(entry.entity).identify()
);
if (entry.value.t === "Address") {
addSortKeys(
entry.value.c,
$labelListing.getObject(String(entry.value.c)).identify(),
false
);
}
});
sortAttributes();
}
}
entries.forEach((entry) => {
addSortKeys(entry.entity, entry.listing.getObject(entry.entity).identify());
if (entry.value.t === "Address") {
@ -167,8 +187,6 @@
}
});
sortAttributes();
// Formatting & Display
const ATTRIBUTE_LABELS: { [key: string]: string } = {
FILE_MIME: "MIME type",