-
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.
feat: make canister stop start generic
Signed-off-by: David Dal Busco <[email protected]>
- Loading branch information
1 parent
8f8644a
commit 4a0b7c2
Showing
12 changed files
with
154 additions
and
99 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
28 changes: 28 additions & 0 deletions
28
src/frontend/src/lib/components/canister/CanisterStopStart.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,28 @@ | ||
<script lang="ts"> | ||
import type { Canister, CanisterStatus, CanisterSyncStatus } from '$lib/types/canister'; | ||
import CanisterStart from '$lib/components/canister/CanisterStart.svelte'; | ||
import CanisterStop from '$lib/components/canister/CanisterStop.svelte'; | ||
import { fade } from 'svelte/transition'; | ||
import { nonNullish } from '@dfinity/utils'; | ||
export let canister: Canister | undefined = undefined; | ||
export let segment: 'satellite' | 'orbiter'; | ||
let status: CanisterStatus | undefined = undefined; | ||
let sync: CanisterSyncStatus | undefined = undefined; | ||
$: status = canister?.data?.status; | ||
$: sync = canister?.sync; | ||
</script> | ||
|
||
{#if nonNullish(canister) && status === 'stopped' && sync === 'synced'} | ||
<div in:fade><CanisterStart {canister} {segment} /></div> | ||
{:else if nonNullish(canister) && status === 'running' && sync === 'synced'} | ||
<div in:fade><CanisterStop {canister} {segment} /></div> | ||
{/if} | ||
|
||
<style lang="scss"> | ||
div { | ||
display: inline-block; | ||
} | ||
</style> |
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
28 changes: 0 additions & 28 deletions
28
src/frontend/src/lib/components/satellites/SatelliteStopStart.svelte
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script lang="ts"> | ||
import { i18nFormat, i18nText } from '$lib/utils/i18n.utils'; | ||
import { i18n } from '$lib/stores/i18n.store'; | ||
export let key: string; | ||
export let value: string; | ||
export let placeholder = '{0}'; | ||
</script> | ||
|
||
{@html i18nFormat(i18nText({ i18n: $i18n, labelKey: key }), [ | ||
{ | ||
placeholder, | ||
value | ||
} | ||
])} |
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
Oops, something went wrong.