Skip to content

Commit

Permalink
Merge branch 'main' into feat/redo-invitation-code
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker authored Oct 20, 2024
2 parents 545f06a + 2ab92dd commit 42c1bbc
Show file tree
Hide file tree
Showing 28 changed files with 277 additions and 101 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ jobs:
name: satellite.did
path: .

- name: Download satellite_extension.did
uses: actions/download-artifact@v4
with:
name: satellite_extension.did
path: .

- name: Download orbiter.did
uses: actions/download-artifact@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@junobuild/juno",
"version": "0.0.34",
"version": "0.0.35",
"private": true,
"author": "David Dal Busco <[email protected]>",
"license": "SEE LICENSE IN LICENSE.md",
Expand Down
15 changes: 15 additions & 0 deletions src/frontend/src/lib/api/mission-control.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,21 @@ export const unsetOrbiter = async ({
return unset_orbiter(orbiterId);
};

export const setSatellite = async ({
missionControlId,
satelliteId,
satelliteName,
identity
}: {
missionControlId: Principal;
satelliteId: Principal;
satelliteName?: string;
identity: OptionIdentity;
}): Promise<Satellite> => {
const { set_satellite } = await getMissionControlActor({ missionControlId, identity });
return set_satellite(satelliteId, toNullable(satelliteName));
};

export const unsetSatellite = async ({
missionControlId,
satelliteId,
Expand Down
3 changes: 0 additions & 3 deletions src/frontend/src/lib/components/analytics/NoAnalytics.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<script lang="ts">
import { i18n } from '$lib/stores/i18n.store';
import NoAnalyticsActions from '$lib/components/analytics/NoAnalyticsActions.svelte';
</script>

<div class="card-container">
<p>{$i18n.analytics.empty}</p>

<NoAnalyticsActions />
</div>

<style lang="scss">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,38 @@
import { toasts } from '$lib/stores/toasts.store';
import { busy } from '$lib/stores/busy.store';
import { Principal } from '@dfinity/principal';
import IconLink from '$lib/components/icons/IconLink.svelte';
import Popover from '$lib/components/ui/Popover.svelte';
import { debounce, isNullish, nonNullish } from '@dfinity/utils';
import { missionControlStore } from '$lib/stores/mission-control.store';
import { attachOrbiter } from '$lib/services/mission-control.services';
import { createEventDispatcher } from 'svelte';
let visible: boolean | undefined;
export let setFn: (params: {
missionControlId: Principal;
canisterId: Principal;
}) => Promise<void>;
export let visible: boolean | undefined;
let validConfirm = false;
let saving = false;
let orbiterId = '';
let canisterId = '';
const assertForm = debounce(() => {
try {
validConfirm =
nonNullish(orbiterId) && orbiterId !== '' && nonNullish(Principal.fromText(orbiterId));
nonNullish(canisterId) && canisterId !== '' && nonNullish(Principal.fromText(canisterId));
} catch (_err: unknown) {
validConfirm = false;
}
});
$: orbiterId, (() => assertForm())();
$: canisterId, (() => assertForm())();
const handleSubmit = async () => {
if (!validConfirm) {
// Submit is disabled if not valid
toasts.error({
text: $i18n.errors.orbiter_id_missing
text: $i18n.errors.canister_id_missing
});
return;
}
Expand All @@ -47,17 +49,17 @@
busy.start();
try {
await attachOrbiter({
await setFn({
missionControlId: $missionControlStore,
orbiterId: Principal.fromText(orbiterId)
canisterId: Principal.fromText(canisterId)
});
visible = false;
dispatch('junoAttach');
} catch (err: unknown) {
toasts.error({
text: $i18n.errors.satellite_name_update,
text: $i18n.errors.canister_attach_error,
detail: err
});
}
Expand All @@ -68,17 +70,17 @@
const dispatch = createEventDispatcher();
</script>

<button on:click={() => (visible = true)} class="menu"><IconLink /> {$i18n.core.attach}</button>

<Popover bind:visible center backdrop="dark">
<form class="container" on:submit|preventDefault={handleSubmit}>
<label for="orbiter">{$i18n.analytics.attach}:</label>
<h3><slot name="title" /></h3>

<label for="canisterId"><slot name="input" />:</label>

<input
id="orbiter"
bind:value={orbiterId}
id="canisterId"
bind:value={canisterId}
type="text"
placeholder={$i18n.analytics.attach_id}
placeholder="_____-_____-_____-_____-cai"
maxlength={64}
disabled={saving}
/>
Expand All @@ -93,4 +95,8 @@
@use '../../styles/mixins/dialog';
@include dialog.edit;
label {
margin: var(--padding-1_5x) 0 0;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import { emit } from '$lib/utils/events.utils';
import type { CanisterIcStatus } from '$lib/types/canister';
import type { Principal } from '@dfinity/principal';
import MissionControlAttachSatellite from '$lib/components/mission-control/MissionControlAttachSatellite.svelte';
import MissionControlAttachOrbiter from '$lib/components/mission-control/MissionControlAttachOrbiter.svelte';
export let missionControlId: Principal;
Expand Down Expand Up @@ -42,4 +44,10 @@
<TopUp type="topup_mission_control" on:junoTopUp={close} />

<CanisterTransferCycles {canister} on:click={onTransferCycles} />

<hr />

<MissionControlAttachSatellite on:junoAttach={close} />

<MissionControlAttachOrbiter on:junoAttach={close} />
</Actions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script lang="ts">
import { i18n } from '$lib/stores/i18n.store';
import { Principal } from '@dfinity/principal';
import IconLink from '$lib/components/icons/IconLink.svelte';
import { attachOrbiter } from '$lib/services/mission-control.services';
import CanisterAttach from '$lib/components/canister/CanisterAttach.svelte';
import { createEventDispatcher } from 'svelte';
import { toasts } from '$lib/stores/toasts.store';
import { i18nCapitalize, i18nFormat } from '$lib/utils/i18n.utils';
let visible: boolean | undefined;
const setOrbiter = async ({
missionControlId,
canisterId
}: {
missionControlId: Principal;
canisterId: Principal;
}) => {
await attachOrbiter({
missionControlId,
orbiterId: canisterId
});
};
const dispatch = createEventDispatcher();
const onSuccess = () => {
toasts.success(
i18nCapitalize(
i18nFormat($i18n.canisters.attach_success, [
{
placeholder: '{0}',
value: 'orbiter'
}
])
)
);
dispatch('junoAttach');
};
</script>

<button on:click={() => (visible = true)} class="menu"><IconLink /> {$i18n.analytics.attach}</button
>

<CanisterAttach on:junoAttach={onSuccess} bind:visible setFn={setOrbiter}>
<svelte:fragment slot="title">{$i18n.analytics.attach}</svelte:fragment>
<svelte:fragment slot="input">{$i18n.analytics.attach_id}</svelte:fragment>
</CanisterAttach>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script lang="ts">
import CanisterAttach from '$lib/components/canister/CanisterAttach.svelte';
import IconLink from '$lib/components/icons/IconLink.svelte';
import { Principal } from '@dfinity/principal';
import { attachSatellite } from '$lib/services/mission-control.services';
import { i18n } from '$lib/stores/i18n.store';
import { createEventDispatcher } from 'svelte';
import { toasts } from '$lib/stores/toasts.store';
import { i18nCapitalize, i18nFormat } from '$lib/utils/i18n.utils';
let visible = false;
const setSatellite = async ({
missionControlId,
canisterId
}: {
missionControlId: Principal;
canisterId: Principal;
}) => {
await attachSatellite({
missionControlId,
satelliteId: canisterId
});
};
const dispatch = createEventDispatcher();
const onSuccess = () => {
toasts.success(
i18nCapitalize(
i18nFormat($i18n.canisters.attach_success, [
{
placeholder: '{0}',
value: 'satellite'
}
])
)
);
dispatch('junoAttach');
};
</script>

<button on:click={() => (visible = true)} class="menu"
><IconLink /> {$i18n.satellites.attach}</button
>

<CanisterAttach on:junoAttach={onSuccess} bind:visible setFn={setSatellite}>
<svelte:fragment slot="title">{$i18n.satellites.attach}</svelte:fragment>
<svelte:fragment slot="input">{$i18n.satellites.id}</svelte:fragment>
</CanisterAttach>
2 changes: 2 additions & 0 deletions src/frontend/src/lib/components/orbiter/OrbiterActions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

<CanisterTransferCycles {canister} on:click={() => onCanisterAction('transfer_cycles_orbiter')} />

<hr />

<CanisterStopStart {canister} segment="orbiter" on:junoStop={close} on:junoStart={close} />

<SegmentDetach segment="orbiter" segmentId={orbiter.orbiter_id} on:junoDetach={close} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@

<CanisterTransferCycles {canister} on:click={onTransferCycles} />

<hr />

<CanisterStopStart {canister} segment="satellite" on:junoStop={close} on:junoStart={close} />

<SegmentDetach segment="satellite" segmentId={satellite.satellite_id} on:junoStop={close} />
Expand Down
9 changes: 6 additions & 3 deletions src/frontend/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"detach_title": "Detach {0}",
"detach_explanation": "Detaching this {0} will remove it from your mission control list. It will continue to function if it's active, or be forgotten if it's inactive and won't appear in the console anymore.",
"detach_info": "Do you want to detach your {0}?",
"attach_success": "{0} attached.",
"detach_success": "{0} detached.",
"delete_success": "{0} deleted.",
"transfer_cycles": "Transfer cycles",
Expand Down Expand Up @@ -181,7 +182,8 @@
"extended_version": "Extended version",
"build": "Build",
"see_all_satellites": "See all satellites",
"go_launchpad": "Go to launchpad"
"go_launchpad": "Go to launchpad",
"attach": "Attach satellite"
},
"mission_control": {
"title": "Mission Control",
Expand Down Expand Up @@ -274,7 +276,7 @@
"desktop": "Desktop",
"others": "Others",
"browsers": "Browsers",
"attach": "Attach existing Analytics",
"attach": "Attach analytics",
"attach_id": "Enter Orbiter ID",
"score": "Score",
"rating": "Rating",
Expand Down Expand Up @@ -419,7 +421,8 @@
"orbiter_configuration_missing": "Satellites and configuration must be provided.",
"orbiter_configuration_unexpected": "Unexpected error(s) while trying to edit your configuration.",
"orbiter_configuration_listing": "Error while fetching the configuration.",
"orbiter_id_missing": "A valid Orbiter ID must be provided.",
"canister_id_missing": "A valid ID must be provided.",
"canister_attach_error": "Unexpected error(s) while trying to attach the module.",
"orbiter_attach": "Unexpected error(s) while trying to attach the orbiter to your mission control.",
"orbiter_unexpected_error": "Unexpected error(s) while creating the orbiter.",
"transactions_next": "Error while fetching the next transactions.",
Expand Down
Loading

0 comments on commit 42c1bbc

Please sign in to comment.