@@ -25,6 +25,7 @@ export default ({ backup }: Props) => {
2525 const setServerFromState = ServerContext . useStoreActions ( actions => actions . server . setServerFromState ) ;
2626 const [ modal , setModal ] = useState ( '' ) ;
2727 const [ loading , setLoading ] = useState ( false ) ;
28+ const [ truncate , setTruncate ] = useState ( false ) ;
2829 const { clearFlashes, clearAndAddHttpError } = useFlash ( ) ;
2930 const { mutate } = getServerBackups ( ) ;
3031
@@ -59,10 +60,10 @@ export default ({ backup }: Props) => {
5960 } ) ;
6061 } ;
6162
62- const doRestorationAction = ( ) => {
63+ const doRestorationAction = ( truncate : boolean ) => {
6364 setLoading ( true ) ;
6465 clearFlashes ( 'backups' ) ;
65- restoreServerBackup ( uuid , backup . uuid )
66+ restoreServerBackup ( uuid , backup . uuid , truncate )
6667 . then ( ( ) => setServerFromState ( s => ( {
6768 ...s ,
6869 status : 'restoring_backup' ,
@@ -87,7 +88,7 @@ export default ({ backup }: Props) => {
8788 visible = { modal === 'restore' }
8889 title = { 'Restore this backup?' }
8990 buttonText = { 'Restore backup' }
90- onConfirmed = { ( ) => doRestorationAction ( ) }
91+ onConfirmed = { ( ) => doRestorationAction ( truncate ) }
9192 onModalDismissed = { ( ) => setModal ( '' ) }
9293 >
9394 < p css = { tw `text-neutral-300` } >
@@ -108,6 +109,8 @@ export default ({ backup }: Props) => {
108109 css = { tw `text-red-500! w-5! h-5! mr-2` }
109110 id = { 'restore_truncate' }
110111 value = { 'true' }
112+ checked = { truncate }
113+ onChange = { ( ) => setTruncate ( ! truncate ) }
111114 />
112115 Remove all files and folders before restoring this backup.
113116 </ label >
0 commit comments