@@ -5,17 +5,21 @@ import type { Terminal } from '@xterm/xterm';
55import { tick } from ' svelte' ;
66import { router } from ' tinro' ;
77
8- import LegacyDialog from ' ../dialogs/LegacyDialog .svelte' ;
8+ import Dialog from ' ../dialogs/Dialog .svelte' ;
99import TerminalWindow from ' ../ui/TerminalWindow.svelte' ;
1010import type { ImageInfoUI } from ' ./ImageInfoUI' ;
1111
12- export let closeCallback: () => void ;
13- export let manifestInfoToPush: ImageInfoUI ;
12+ interface Props {
13+ closeCallback: () => void ;
14+ manifestInfoToPush: ImageInfoUI ;
15+ }
16+
17+ let { closeCallback, manifestInfoToPush }: Props = $props ();
1418
15- let pushInProgress = false ;
16- let pushFinished = false ;
17- let initTerminal = false ;
18- let logsPush: Terminal ;
19+ let pushInProgress = $state ( false ) ;
20+ let pushFinished = $state ( false ) ;
21+ let initTerminal = $state ( false ) ;
22+ let logsPush = $state < Terminal >() ;
1923
2024async function pushManifest(): Promise <void > {
2125 initTerminal = true ;
@@ -26,12 +30,12 @@ async function pushManifest(): Promise<void> {
2630 pushInProgress = true ;
2731
2832 try {
29- logsPush .write (` Pushing manifest ${manifestInfoToPush .name } ...\n\r ` );
33+ logsPush ? .write (` Pushing manifest ${manifestInfoToPush .name } ...\n\r ` );
3034 await window .pushManifest ({ name: manifestInfoToPush .name , destination: manifestInfoToPush .name });
31- logsPush .write (' Manifest pushed successfully\n\r ' );
35+ logsPush ? .write (' Manifest pushed successfully\n\r ' );
3236 pushFinished = true ;
3337 } catch (err ) {
34- logsPush .write (err + ' \n\r ' );
38+ logsPush ? .write (err + ' \n\r ' );
3539 pushFinished = true ;
3640 console .error (err );
3741 }
@@ -43,41 +47,45 @@ async function pushManifestFinished(): Promise<void> {
4347}
4448 </script >
4549
46- <LegacyDialog
50+ <Dialog
4751 title =" Push manifest"
4852 onclose ={(): void => {
4953 closeCallback ();
5054 logsPush ?.dispose ();
5155 }}>
52- <div slot =" content" class =" flex flex-col leading-5 space-y-5" >
53- {#if ! pushInProgress }
54- <p class =" text-sm" >
55- Push manifest {manifestInfoToPush .name }
56+ {#snippet content ()}
57+ <div class =" flex flex-col leading-5 space-y-5" >
58+ {#if ! pushInProgress }
59+ <p class =" text-sm" >
60+ Push manifest {manifestInfoToPush .name }
5661
57- {#if manifestInfoToPush .children && manifestInfoToPush .children .length > 0 }
58- with {manifestInfoToPush .children .length } associated images
59- {/if }
60- </p >
61- {/if }
62- <div class ="h-[185px]" hidden ={initTerminal === false }>
63- <TerminalWindow class ="h-full" bind:terminal ={logsPush } disableStdIn />
62+ {#if manifestInfoToPush .children && manifestInfoToPush .children .length > 0 }
63+ with {manifestInfoToPush .children .length } associated images
64+ {/if }
65+ </p >
66+ {/if }
67+ <div class ="h-[185px]" hidden ={initTerminal === false }>
68+ <TerminalWindow class ="h-full" bind:terminal ={logsPush } disableStdIn />
69+ </div >
6470 </div >
65- </ div >
71+ { / snippet }
6672
67- <svelte:fragment slot =" buttons" >
68- {#if ! pushInProgress && ! pushFinished }
69- <Button class ="w-auto" type ="secondary" on:click ={closeCallback }>Cancel</Button >
70- {/if }
71- {#if ! pushFinished }
72- <Button
73- class =" w-auto"
74- icon ={faCircleArrowUp }
75- on:click ={pushManifest }
76- inProgress ={pushInProgress }>
77- Push manifest
78- </Button >
79- {:else }
80- <Button on:click ={pushManifestFinished } class =" w-auto" >Done</Button >
81- {/if }
82- </svelte:fragment >
83- </LegacyDialog >
73+ {#snippet buttons ()}
74+
75+ {#if ! pushInProgress && ! pushFinished }
76+ <Button class ="w-auto" type ="secondary" on:click ={closeCallback }>Cancel</Button >
77+ {/if }
78+ {#if ! pushFinished }
79+ <Button
80+ class =" w-auto"
81+ icon ={faCircleArrowUp }
82+ on:click ={pushManifest }
83+ inProgress ={pushInProgress }>
84+ Push manifest
85+ </Button >
86+ {:else }
87+ <Button on:click ={pushManifestFinished } class =" w-auto" >Done</Button >
88+ {/if }
89+
90+ {/ snippet }
91+ </Dialog >
0 commit comments