[ui] fix lint errors and some warnings
parent
cee678760d
commit
283665bf60
|
@ -1,5 +1,4 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import UpLink from "./display/UpLink.svelte";
|
||||
import { Component, UNTYPED, UpType, Widget } from "../lib/types";
|
||||
import Table from "./widgets/Table.svelte";
|
||||
|
@ -10,7 +9,7 @@
|
|||
|
||||
export let entries: UpEntry[];
|
||||
export let type: UpType | undefined = undefined;
|
||||
export let title: String | undefined = undefined;
|
||||
export let title: string | undefined = undefined;
|
||||
export let editable = false;
|
||||
export let reverse = false;
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
dragging = false;
|
||||
}
|
||||
|
||||
function onDragEnter(ev: DragEvent) {}
|
||||
function onDragEnter(ev: DragEvent) {
|
||||
// noop
|
||||
}
|
||||
|
||||
function onDragOver(ev: DragEvent) {
|
||||
dragging = true;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
| { index: Writable<number> }
|
||||
| undefined;
|
||||
|
||||
const index = Boolean(context) ? context.index : readable(0);
|
||||
const index = context ? context.index : readable(0);
|
||||
|
||||
function onClick() {
|
||||
if (to.entity) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
let resolving = true;
|
||||
|
||||
$: ({ entity } = useEntity(address));
|
||||
$: resolving = !Boolean($entity);
|
||||
$: resolving = !$entity;
|
||||
|
||||
// Identification
|
||||
let inferredIds: string[] = [];
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
$: ({ entity } = useEntity(address));
|
||||
|
||||
let noteEntry: UpEntry | undefined;
|
||||
let notes: String | undefined = undefined;
|
||||
let notes: string | undefined = undefined;
|
||||
$: {
|
||||
if ($entity?.attr["NOTE"]?.length && $entity?.attr["NOTE"][0]?.value?.c) {
|
||||
noteEntry = $entity?.attr["NOTE"][0];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { debounce } from "lodash";
|
||||
|
||||
import type { IValue } from "upend/types";
|
||||
import { baseSearch, baseSearchOnce, getObjects } from "../../util/search";
|
||||
import { baseSearchOnce, getObjects } from "../../util/search";
|
||||
import UpObject from "../display/UpObject.svelte";
|
||||
import IconButton from "./IconButton.svelte";
|
||||
import Input from "./Input.svelte";
|
||||
|
@ -24,7 +24,7 @@
|
|||
}
|
||||
|
||||
switch (type) {
|
||||
case "attribute":
|
||||
case "attribute": {
|
||||
const req = await fetch("/api/all/attributes");
|
||||
const allAttributes: string[] = await req.json();
|
||||
options = allAttributes
|
||||
|
@ -35,7 +35,8 @@
|
|||
};
|
||||
});
|
||||
break;
|
||||
case "value":
|
||||
}
|
||||
case "value": {
|
||||
const result = await baseSearchOnce(query);
|
||||
const objects = await getObjects(result.entries);
|
||||
|
||||
|
@ -56,6 +57,7 @@
|
|||
}),
|
||||
];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
$: updateOptions(inputValue);
|
||||
|
|
|
@ -78,16 +78,16 @@
|
|||
.concat()
|
||||
.sort((aEntry, bEntry) => {
|
||||
if (
|
||||
!Boolean(sortKeys[aEntry.value.c]?.length) ||
|
||||
!Boolean(sortKeys[bEntry.value.c]?.length)
|
||||
!sortKeys[aEntry.value.c]?.length ||
|
||||
!sortKeys[bEntry.value.c]?.length
|
||||
) {
|
||||
if (
|
||||
Boolean(sortKeys[aEntry.value.c]?.length) &&
|
||||
!Boolean(sortKeys[bEntry.value.c]?.length)
|
||||
!sortKeys[bEntry.value.c]?.length
|
||||
) {
|
||||
return -1;
|
||||
} else if (
|
||||
!Boolean(sortKeys[aEntry.value.c]?.length) &&
|
||||
!sortKeys[aEntry.value.c]?.length &&
|
||||
Boolean(sortKeys[bEntry.value.c]?.length)
|
||||
) {
|
||||
return 1;
|
||||
|
@ -110,16 +110,16 @@
|
|||
})
|
||||
.sort((aEntry, bEntry) => {
|
||||
if (
|
||||
!Boolean(sortKeys[aEntry.entity]?.length) ||
|
||||
!Boolean(sortKeys[bEntry.entity]?.length)
|
||||
!sortKeys[aEntry.entity]?.length ||
|
||||
!sortKeys[bEntry.entity]?.length
|
||||
) {
|
||||
if (
|
||||
Boolean(sortKeys[aEntry.entity]?.length) &&
|
||||
!Boolean(sortKeys[bEntry.entity]?.length)
|
||||
!sortKeys[bEntry.entity]?.length
|
||||
) {
|
||||
return -1;
|
||||
} else if (
|
||||
!Boolean(sortKeys[aEntry.entity]?.length) &&
|
||||
!sortKeys[aEntry.entity]?.length &&
|
||||
Boolean(sortKeys[bEntry.entity]?.length)
|
||||
) {
|
||||
return 1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// import { useSWR } from "sswr";
|
||||
import LRU from "lru-cache";
|
||||
import { derived, Readable } from "svelte/store";
|
||||
import { UpEntry, UpListing, UpObject } from "upend";
|
||||
import { UpListing, UpObject } from "upend";
|
||||
import type { ListingResult } from "upend/types";
|
||||
import { useSWR } from "../util/fetch";
|
||||
|
||||
|
@ -35,7 +35,7 @@ export async function fetchEntry(address: string) {
|
|||
}
|
||||
|
||||
export function query(query: () => string) {
|
||||
let queryString = typeof query === "string" ? query : query();
|
||||
const queryString = typeof query === "string" ? query : query();
|
||||
console.debug(`Querying: ${queryString}`);
|
||||
const { data, error, revalidate } = useSWR<ListingResult, unknown>(
|
||||
() => `/api/obj?query=${query()}`
|
||||
|
@ -58,9 +58,12 @@ export async function queryOnce(query: string): Promise<UpListing> {
|
|||
const url = `/api/obj?query=${query}`;
|
||||
if (!inFlightRequests[url]) {
|
||||
console.debug(`Querying: ${query}`);
|
||||
inFlightRequests[url] = new Promise(async (resolve, reject) => {
|
||||
const response = await fetch(url, { keepalive: true });
|
||||
resolve(new UpListing(await response.json()));
|
||||
inFlightRequests[url] = new Promise((resolve, reject) => {
|
||||
fetch(url, { keepalive: true })
|
||||
.then(async (response) => {
|
||||
resolve(new UpListing(await response.json()));
|
||||
})
|
||||
.catch((err) => reject(err));
|
||||
});
|
||||
} else {
|
||||
console.debug(`Chaining request for ${query}...`);
|
||||
|
|
|
@ -9,7 +9,7 @@ export function useSWR<D = unknown, E = Error>(
|
|||
const error = writable<E | undefined>();
|
||||
|
||||
async function doFetch() {
|
||||
let keyString = typeof key === "string" ? key : key();
|
||||
const keyString = typeof key === "string" ? key : key();
|
||||
try {
|
||||
const response = await fetch(keyString);
|
||||
if (response.ok) {
|
||||
|
|
Loading…
Reference in New Issue