-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: David Dal Busco <[email protected]>
- Loading branch information
1 parent
eb75ea7
commit 5d60670
Showing
19 changed files
with
156 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/frontend/src/lib/components/observatory/ObservatoryDashboard.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script lang="ts"> | ||
import { i18n } from '$lib/stores/i18n.store'; | ||
import SpinnerParagraph from '$lib/components/ui/SpinnerParagraph.svelte'; | ||
import { getContext, onMount } from 'svelte'; | ||
import { fromNullable, isNullish } from '@dfinity/utils'; | ||
import { getStatuses } from '$lib/api/observatory.api'; | ||
import { toasts } from '$lib/stores/toasts.store'; | ||
import Value from '$lib/components/ui/Value.svelte'; | ||
import { fade } from 'svelte/transition'; | ||
import { formatToDate } from '$lib/utils/date.utils'; | ||
import { TABS_CONTEXT_KEY, type TabsContext } from '$lib/types/tabs.context'; | ||
let loading = true; | ||
let timestamp: bigint | undefined; | ||
const loadStatuses = async () => { | ||
try { | ||
const results = fromNullable(await getStatuses()); | ||
timestamp = results?.timestamp; | ||
loading = false; | ||
} catch (err: unknown) { | ||
toasts.error({ | ||
text: $i18n.errors.observatory_get_unexpected_error, | ||
detail: err | ||
}); | ||
} | ||
}; | ||
onMount(async () => await loadStatuses()); | ||
const { store } = getContext<TabsContext>(TABS_CONTEXT_KEY); | ||
</script> | ||
|
||
<div class="card-container"> | ||
{#if loading} | ||
<SpinnerParagraph>{$i18n.core.loading}</SpinnerParagraph> | ||
{:else if isNullish(timestamp)} | ||
<div in:fade> | ||
<p> | ||
{$i18n.observatory.disabled_go_settings} | ||
<button on:click={() => store.update((state) => ({ ...state, tabId: state.tabs[1].id }))} | ||
>{$i18n.core.settings}</button | ||
> | ||
</p> | ||
</div> | ||
{:else} | ||
<div in:fade> | ||
<Value> | ||
<svelte:fragment slot="label">{$i18n.observatory.last_data_collection}</svelte:fragment> | ||
<p>{formatToDate(timestamp)}</p> | ||
</Value> | ||
</div> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
import { layoutTitle } from '$lib/stores/layout.store'; | ||
import { i18n } from '$lib/stores/i18n.store'; | ||
onMount(() => layoutTitle.set($i18n.observatory.title)); | ||
</script> | ||
|
||
<slot /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { loadRouteSatellite, type RouteSatellite } from '$lib/utils/nav.utils'; | ||
import type { LoadEvent } from '@sveltejs/kit'; | ||
import type { PageLoad } from './$types'; | ||
|
||
export const load: PageLoad = ($event: LoadEvent): RouteSatellite => loadRouteSatellite($event); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.