-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
20 changed files
with
333 additions
and
233 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
171 changes: 0 additions & 171 deletions
171
src/frontend/src/lib/components/canister/Controllers.svelte
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
src/frontend/src/lib/components/controllers/ControllerDelete.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,89 @@ | ||
<script lang="ts"> | ||
import { Principal } from '@dfinity/principal'; | ||
import { isNullish } from '$lib/utils/utils'; | ||
import { toasts } from '$lib/stores/toasts.store'; | ||
import { i18n } from '$lib/stores/i18n.store'; | ||
import { missionControlStore } from '$lib/stores/mission-control.store'; | ||
import { busy, isBusy } from '$lib/stores/busy.store'; | ||
import Popover from '$lib/components/ui/Popover.svelte'; | ||
import type { Controller } from '$declarations/satellite/satellite.did'; | ||
import Value from '$lib/components/ui/Value.svelte'; | ||
export let visible = false; | ||
export let selectedController: [Principal, Controller] | undefined; | ||
export let remove: (params: { | ||
missionControlId: Principal; | ||
controller: Principal; | ||
}) => Promise<void>; | ||
export let load: () => Promise<void>; | ||
const deleteController = async () => { | ||
if (isNullish(selectedController)) { | ||
toasts.error({ | ||
text: $i18n.errors.controllers_no_selection | ||
}); | ||
return; | ||
} | ||
if (isNullish($missionControlStore)) { | ||
toasts.error({ | ||
text: $i18n.errors.no_mission_control | ||
}); | ||
return; | ||
} | ||
busy.start(); | ||
try { | ||
await remove({ | ||
missionControlId: $missionControlStore, | ||
controller: selectedController[0] | ||
}); | ||
} catch (err: unknown) { | ||
toasts.error({ | ||
text: $i18n.errors.controllers_delete, | ||
detail: err | ||
}); | ||
} | ||
close(); | ||
await load(); | ||
busy.stop(); | ||
}; | ||
const close = () => { | ||
selectedController = undefined; | ||
visible = false; | ||
}; | ||
</script> | ||
|
||
<Popover bind:visible center={true}> | ||
<div class="content"> | ||
<h3>{$i18n.controllers.delete_question}</h3> | ||
|
||
<Value> | ||
<svelte:fragment slot="label">{$i18n.controllers.controller_id}</svelte:fragment> | ||
<p>{selectedController?.[0].toText() ?? ''}</p> | ||
</Value> | ||
|
||
<button type="button" on:click|stopPropagation={close} disabled={$isBusy}> | ||
{$i18n.core.no} | ||
</button> | ||
|
||
<button type="button" on:click|stopPropagation={deleteController} disabled={$isBusy}> | ||
{$i18n.core.yes} | ||
</button> | ||
</div> | ||
</Popover> | ||
|
||
<style lang="scss"> | ||
.content { | ||
padding: var(--padding-2x); | ||
} | ||
h3 { | ||
margin-bottom: var(--padding-2x); | ||
} | ||
</style> |
26 changes: 26 additions & 0 deletions
26
src/frontend/src/lib/components/controllers/ControllerInfo.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,26 @@ | ||
<script lang="ts"> | ||
import { i18n } from '$lib/stores/i18n.store'; | ||
import Popover from '$lib/components/ui/Popover.svelte'; | ||
export let visible = false; | ||
const close = () => (visible = false); | ||
</script> | ||
|
||
<Popover bind:visible center={true}> | ||
<div class="content"> | ||
<p>{$i18n.controllers.no_delete}</p> | ||
|
||
<p>{$i18n.controllers.more_delete}</p> | ||
|
||
<button type="button" on:click|stopPropagation={close}> | ||
{$i18n.core.ok} | ||
</button> | ||
</div> | ||
</Popover> | ||
|
||
<style lang="scss"> | ||
.content { | ||
padding: var(--padding-2x); | ||
} | ||
</style> |
Oops, something went wrong.