Skip to content

Commit 9afea7c

Browse files
committed
Fixed loading indicators
1 parent 1992540 commit 9afea7c

File tree

8 files changed

+37
-19
lines changed

8 files changed

+37
-19
lines changed

src/Exceptionless.Web/ClientApp/src/lib/features/events/components/table/EventsDataTable.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
import type { EventSummaryModel, SummaryTemplateKeys } from '../summary/index';
88
99
interface Props {
10+
isLoading: boolean;
1011
limit: number;
11-
loading: boolean;
1212
rowclick?: (row: EventSummaryModel<SummaryTemplateKeys>) => void;
1313
table: Table<EventSummaryModel<SummaryTemplateKeys>>;
1414
toolbarChildren?: Snippet;
1515
}
1616
17-
let { limit = $bindable(), loading, rowclick, table, toolbarChildren }: Props = $props();
17+
let { isLoading, limit = $bindable(), rowclick, table, toolbarChildren }: Props = $props();
1818
</script>
1919

2020
<DataTable.Root>
@@ -23,7 +23,7 @@
2323
{@render toolbarChildren()}
2424
{/if}
2525
</DataTable.Toolbar>
26-
<DataTable.Body {rowclick} {table} {loading}></DataTable.Body>
26+
<DataTable.Body {rowclick} {table} {isLoading}></DataTable.Body>
2727
<DataTable.Pagination {table}>
2828
<DataTable.PageSize bind:value={limit} {table}></DataTable.PageSize>
2929
</DataTable.Pagination>

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/data-table/data-table-body.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
import DataTableColumnHeader from './data-table-column-header.svelte';
1111
1212
interface Props {
13-
loading: boolean;
13+
isLoading: boolean;
1414
rowclick?: (row: TData) => void;
1515
table: SvelteTable<TData>;
1616
}
1717
18-
let { loading, rowclick, table }: Props = $props();
18+
let { isLoading, rowclick, table }: Props = $props();
1919
2020
function getHeaderColumnClass(header: Header<TData, unknown>) {
2121
const classes = [(header.column.columnDef.meta as { class?: string })?.class || ''];
@@ -40,7 +40,7 @@
4040
}
4141
}
4242
43-
const isLoading = $derived(loading && table.getRowModel().rows.length === 0);
43+
const showLoading = $derived(isLoading && table.getRowModel().rows.length === 0);
4444
</script>
4545

4646
<div class="rounded-md border">
@@ -62,7 +62,7 @@
6262
<Table.Row class="hidden text-center only:table-row">
6363
<Table.Cell colspan={table.getVisibleLeafColumns().length}>No data was found with the current filter.</Table.Cell>
6464
</Table.Row>
65-
{#if isLoading}
65+
{#if showLoading}
6666
<Table.Row class="text-center">
6767
<Table.Cell colspan={table.getVisibleLeafColumns().length}>
6868
<div class="flex items-center justify-center">

src/Exceptionless.Web/ClientApp/src/routes/(app)/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@
5050
const table = createTable(context.options);
5151
5252
const client = useFetchClient();
53+
let isLoading = $state(false);
54+
client.loading.on((loading) => (isLoading = loading!));
55+
5356
let response = $state<FetchClientResponse<EventSummaryModel<SummaryTemplateKeys>[]>>();
5457
5558
async function loadData() {
56-
if (client.loading) {
59+
if (isLoading) {
5760
return;
5861
}
5962
@@ -110,7 +113,7 @@
110113
<Card.Root>
111114
<Card.Title class="p-6 pb-0 text-2xl" level={2}>Events</Card.Title>
112115
<Card.Content>
113-
<EventsDataTable bind:limit={limit.value} loading={!response} {rowclick} {table}>
116+
<EventsDataTable bind:limit={limit.value} {isLoading} {rowclick} {table}>
114117
{#snippet toolbarChildren()}
115118
<FacetedFilter.Root changed={onFilterChanged} {facets} remove={onFilterRemoved}></FacetedFilter.Root>
116119
{/snippet}

src/Exceptionless.Web/ClientApp/src/routes/(app)/account/notifications/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
data.email_notifications_enabled = true;
1313
1414
const client = useFetchClient();
15+
let isLoading = $state(false);
16+
client.loading.on((loading) => (isLoading = loading!));
17+
1518
let problem = $state(new ProblemDetails());
1619
1720
async function onSave() {
18-
if (client.loading) {
21+
if (isLoading) {
1922
return;
2023
}
2124
}
@@ -42,7 +45,7 @@
4245

4346
<div class="pt-2">
4447
<Button type="submit">
45-
{#if client.loading}
48+
{#if isLoading}
4649
<Loading class="mr-2" variant="secondary"></Loading> Saving...
4750
{:else}
4851
Save

src/Exceptionless.Web/ClientApp/src/routes/(app)/account/security/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@
2626
const data = $state(new User());
2727
2828
const client = useFetchClient();
29+
let isLoading = $state(false);
30+
client.loading.on((loading) => (isLoading = loading!));
31+
2932
let problem = $state(new ProblemDetails());
3033
3134
async function onSave() {
32-
if (client.loading) {
35+
if (isLoading) {
3336
return;
3437
}
3538
@@ -92,7 +95,7 @@
9295

9396
<div class="pt-2">
9497
<Button type="submit">
95-
{#if client.loading}
98+
{#if isLoading}
9699
<Loading class="mr-2" variant="secondary"></Loading> Updating password...
97100
{:else}
98101
Update password

src/Exceptionless.Web/ClientApp/src/routes/(app)/issues/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@
6565
const table = createTable(context.options);
6666
6767
const client = useFetchClient();
68+
let isLoading = $state(false);
69+
client.loading.on((loading) => (isLoading = loading!));
70+
6871
let response = $state<FetchClientResponse<EventSummaryModel<SummaryTemplateKeys>[]>>();
6972
7073
async function loadData() {
71-
if (client.loading) {
74+
if (isLoading) {
7275
return;
7376
}
7477
@@ -105,7 +108,7 @@
105108
<Card.Root>
106109
<Card.Title class="p-6 pb-0 text-2xl" level={2}>Issues</Card.Title>
107110
<Card.Content>
108-
<EventsDataTable bind:limit={limit.value} loading={!response} {rowclick} {table}>
111+
<EventsDataTable bind:limit={limit.value} {isLoading} {rowclick} {table}>
109112
{#snippet toolbarChildren()}
110113
<FacetedFilter.Root changed={onFilterChanged} {facets} remove={onFilterRemoved}></FacetedFilter.Root>
111114
{/snippet}

src/Exceptionless.Web/ClientApp/src/routes/(app)/stream/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,14 @@
6060
const table = createTable(context.options);
6161
6262
const client = useFetchClient();
63+
let isLoading = $state(false);
64+
client.loading.on((loading) => (isLoading = loading!));
65+
6366
let response = $state<FetchClientResponse<EventSummaryModel<SummaryTemplateKeys>[]>>();
6467
let before: string | undefined;
6568
6669
async function loadData(filterChanged: boolean = false) {
67-
if (client.loading && filterChanged && !before) {
70+
if (isLoading && filterChanged && !before) {
6871
return;
6972
}
7073
@@ -136,7 +139,7 @@
136139
<DataTable.Toolbar {table}>
137140
<FacetedFilter.Root changed={onFilterChanged} {facets} remove={onFilterRemoved}></FacetedFilter.Root>
138141
</DataTable.Toolbar>
139-
<DataTable.Body {rowclick} {table} loading={!response}></DataTable.Body>
142+
<DataTable.Body {rowclick} {table} {isLoading}></DataTable.Body>
140143
<Muted class="flex flex-1 items-center justify-between">
141144
<DataTable.PageSize bind:value={limit.value} {table}></DataTable.PageSize>
142145
<div class="py-2 text-center">

src/Exceptionless.Web/ClientApp/src/routes/(auth)/logout/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
});
1818
1919
const client = useFetchClient();
20+
let isLoading = $state(false);
21+
client.loading.on((loading) => (isLoading = loading!));
22+
2023
let message = $state<string>();
2124
async function onLogout() {
22-
if (client.loading) {
25+
if (isLoading) {
2326
return;
2427
}
2528
@@ -43,7 +46,7 @@
4346
<ErrorMessage {message}></ErrorMessage>
4447

4548
<Form.Button>
46-
{#if client.loading}
49+
{#if isLoading}
4750
<Loading class="mr-2" variant="secondary"></Loading> Logging out...
4851
{:else}
4952
Logout

0 commit comments

Comments
 (0)