Compare commits
2 Commits
0d8178986f
...
ea395ad51a
| Author | SHA1 | Date |
|---|---|---|
|
|
ea395ad51a | |
|
|
66fdd5cc48 |
2
Tiltfile
2
Tiltfile
|
|
@ -59,7 +59,7 @@ def bh_client(service="", port_forwards=[], labels=['2-services'], deps=['ingres
|
||||||
dockerfile='./src/Dockerfile.frontend'.format(service),
|
dockerfile='./src/Dockerfile.frontend'.format(service),
|
||||||
target='development',
|
target='development',
|
||||||
build_args={
|
build_args={
|
||||||
"service": service
|
"service": '{}-client'.format(service)
|
||||||
},
|
},
|
||||||
entrypoint='vite dev --port=80 --host=0.0.0.0 --strictPort --logLevel info',
|
entrypoint='vite dev --port=80 --host=0.0.0.0 --strictPort --logLevel info',
|
||||||
live_update=[
|
live_update=[
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
|
export let page: number = 1;
|
||||||
|
export let itemCount: number = 0;
|
||||||
|
export let pageSize: number = 1;
|
||||||
|
|
||||||
|
interface PagerParams {
|
||||||
|
page: number;
|
||||||
|
pageCount: number;
|
||||||
|
pageSize: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export let createUrl: (
|
||||||
|
//<reference types="svelte" />
|
||||||
|
arg0: PagerParams
|
||||||
|
) => string = (): string => '';
|
||||||
|
|
||||||
|
$: pageCount = Math.max(1, Math.ceil(itemCount / pageSize));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ol class="flex justify-between w-full center text-lg" style="padding: 0 10%;">
|
||||||
|
{#if page > 1}
|
||||||
|
<li in:fade>
|
||||||
|
<a href={createUrl({ page: page - 1, pageCount, pageSize })}> <Previous </a>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li />
|
||||||
|
{/if}
|
||||||
|
<li>Page {page} of {pageCount}</li>
|
||||||
|
{#if page < pageCount}
|
||||||
|
<li in:fade>
|
||||||
|
<a href={createUrl({ page: page + 1, pageCount, pageSize })}> Next> </a>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li />
|
||||||
|
{/if}
|
||||||
|
</ol>
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import StartScrapeForm from '$lib/StartScrapeForm.svelte';
|
import StartScrapeForm from '$lib/StartScrapeForm.svelte';
|
||||||
import ScrapeJobResult from '$lib/ScrapeJobResult.svelte';
|
import ScrapeJobResult from '$lib/ScrapeJobResult.svelte';
|
||||||
|
import Pager from '$lib/Pager.svelte';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
|
|
@ -28,10 +29,30 @@
|
||||||
console.log(scrapeJob);
|
console.log(scrapeJob);
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildQueryString({ page, pageSize }: { page: number; pageSize: number }): string {
|
||||||
|
const qs = [
|
||||||
|
data.query === '' ? data.query : `query=${data.query}`,
|
||||||
|
page <= 1 ? '' : `page=${page}`,
|
||||||
|
`limit=${pageSize}`
|
||||||
|
]
|
||||||
|
.filter((x) => x !== '')
|
||||||
|
.join('&');
|
||||||
|
|
||||||
|
return qs !== '' ? `?${qs}` : qs;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="flex w-full flex-col justify-center" in:fade out:fade>
|
<section class="flex w-full flex-col justify-center" in:fade out:fade>
|
||||||
<h1 class="text-2xl mb-8">Sync Status</h1>
|
<section in:fade class="pb-10">
|
||||||
|
<h1 class="text-2xl pb-5 mb-8">Sync Status</h1>
|
||||||
|
<Pager
|
||||||
|
page={data.page}
|
||||||
|
itemCount={data.found}
|
||||||
|
pageSize={data.limit}
|
||||||
|
createUrl={buildQueryString}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
<div class="mb-8">
|
<div class="mb-8">
|
||||||
<StartScrapeForm on:scrape={onScrape} />
|
<StartScrapeForm on:scrape={onScrape} />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -57,4 +78,13 @@
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="pt-10">
|
||||||
|
<Pager
|
||||||
|
page={data.page}
|
||||||
|
itemCount={data.found}
|
||||||
|
pageSize={data.limit}
|
||||||
|
createUrl={buildQueryString}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
|
export let page: number = 1;
|
||||||
|
export let itemCount: number = 0;
|
||||||
|
export let pageSize: number = 1;
|
||||||
|
|
||||||
|
interface PagerParams {
|
||||||
|
page: number;
|
||||||
|
pageCount: number;
|
||||||
|
pageSize: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export let createUrl: (
|
||||||
|
//<reference types="svelte" />
|
||||||
|
arg0: PagerParams
|
||||||
|
) => string = (): string => '';
|
||||||
|
|
||||||
|
$: pageCount = Math.max(1, Math.ceil(itemCount / pageSize));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ol class="flex justify-between w-full center text-lg" style="padding: 0 10%;">
|
||||||
|
{#if page > 1}
|
||||||
|
<li in:fade>
|
||||||
|
<a href={createUrl({ page: page - 1, pageCount, pageSize })}> <Previous </a>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li />
|
||||||
|
{/if}
|
||||||
|
<li>Page {page} of {pageCount}</li>
|
||||||
|
{#if page < pageCount}
|
||||||
|
<li in:fade>
|
||||||
|
<a href={createUrl({ page: page + 1, pageCount, pageSize })}> Next> </a>
|
||||||
|
</li>
|
||||||
|
{:else}
|
||||||
|
<li />
|
||||||
|
{/if}
|
||||||
|
</ol>
|
||||||
|
|
@ -1,43 +1,35 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import AuctionResult from '$lib/AuctionResult.svelte';
|
import AuctionResult from '$lib/AuctionResult.svelte';
|
||||||
|
import Pager from '$lib/Pager.svelte';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
function buildQueryString({ query, page }: { query: string; page: number }): string {
|
function buildQueryString({ page, pageSize }: { page: number; pageSize: number }): string {
|
||||||
const qs = [query === '' ? query : `query=${query}`, page <= 1 ? '' : `page=${page}`]
|
const qs = [
|
||||||
|
data.query === '' ? data.query : `query=${data.query}`,
|
||||||
|
page <= 1 ? '' : `page=${page}`,
|
||||||
|
`limit=${pageSize}`
|
||||||
|
]
|
||||||
.filter((x) => x !== '')
|
.filter((x) => x !== '')
|
||||||
.join('&');
|
.join('&');
|
||||||
|
|
||||||
return qs !== '' ? `?${qs}` : qs;
|
return qs !== '' ? `/?${qs}` : qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
$: hasResults = (data.results || []).length > 0;
|
$: hasResults = data?.results?.length || 0;
|
||||||
$: currentPage = data.page + 1;
|
|
||||||
$: pageCount = Math.max(1, Math.ceil(data.found / data.limit));
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if hasResults}
|
{#if hasResults}
|
||||||
<section in:fade>
|
<section in:fade>
|
||||||
<h1 class="pb-5 text-lg">Found {data.found} Upcoming & Live Auctions</h1>
|
<h1 class="pb-5 text-lg">Found {data.found} Upcoming & Live Auctions</h1>
|
||||||
<ol class="flex justify-between w-full center" style="padding: 0 10%;">
|
<Pager
|
||||||
{#if currentPage > 1}
|
page={data.page + 1}
|
||||||
<li in:fade>
|
itemCount={data.found}
|
||||||
<a href="/{buildQueryString({ query: data.query, page: currentPage - 1 })}"
|
pageSize={data.limit}
|
||||||
><Previous</a
|
createUrl={buildQueryString}
|
||||||
>
|
/>
|
||||||
</li>
|
|
||||||
{:else}
|
|
||||||
<li />
|
|
||||||
{/if}
|
|
||||||
<li>Page {currentPage} of {pageCount}</li>
|
|
||||||
{#if currentPage < pageCount}
|
|
||||||
<li in:fade>
|
|
||||||
<a href="/{buildQueryString({ query: data.query, page: currentPage + 1 })}">Next></a>
|
|
||||||
</li>
|
|
||||||
{/if}
|
|
||||||
</ol>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{#key data.results}
|
{#key data.results}
|
||||||
|
|
@ -49,6 +41,13 @@
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
{/key}
|
{/key}
|
||||||
|
|
||||||
|
<Pager
|
||||||
|
page={data.page + 1}
|
||||||
|
itemCount={data.found}
|
||||||
|
pageSize={data.limit}
|
||||||
|
createUrl={buildQueryString}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<section class="flex w-full flex-col justify-center text-center" in:fade out:fade>
|
<section class="flex w-full flex-col justify-center text-center" in:fade out:fade>
|
||||||
<h1 class="text-2xl">No auctions found.</h1>
|
<h1 class="text-2xl">No auctions found.</h1>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue