22import { Listing , DropdownItem , Header , Button } from " @statamic/cms/ui" ;
33import { requireElevatedSession } from " @statamic/cms"
44import { useBackupStore } from " ../store" ;
5- import { ref , useTemplateRef } from " vue" ;
5+ import { ref } from " vue" ;
66import { useResumable } from " ../resumable" ;
77
88const props = defineProps ([' chunkSize' ]);
99
1010const backupStore = useBackupStore ();
1111
12- const dropZone = useTemplateRef (" dropZone" );
12+ const listing = ref (null );
13+
14+ const dropZone = ref (null );
1315const browseTarget = ref (null );
1416
15- const { files } = useResumable ({ chunkSize: props .chunkSize ?? 2 * 1024 * 1024 , dropZone, browseTarget });
17+ const { files } = useResumable ({ chunkSize: props .chunkSize ?? 2 * 1024 * 1024 , dropZone, browseTarget, onFileUploaded: (file ) => {
18+ listing .value .refresh ();
19+ }});
1620
1721backupStore .startPolling ();
1822
@@ -44,6 +48,7 @@ const queueBackup = async () => {
4448 const { data } = await window .Statamic .$app .config .globalProperties .$axios .post (cp_url (" api/backups" ));
4549
4650 Statamic .$toast .info (__ (data .message ));
51+ listing .value .refresh ();
4752 } catch (e) {
4853 console .error (e);
4954
@@ -62,6 +67,7 @@ const deleteBackup = async (id) => {
6267 const { data } = await window .Statamic .$app .config .globalProperties .$axios .delete (cp_url (` api/backups/${ id} ` ));
6368
6469 Statamic .$toast .info (__ (data .message ));
70+ listing .value .refresh ();
6571 } catch (e) {
6672 console .error (e);
6773
@@ -89,7 +95,7 @@ const deleteBackup = async (id) => {
8995 < span v- if = " file.status === 'error'" class = " text-red-600" > - {{ __ (' statamic-backup::backup.upload.error' ) }}< / span>
9096 < / p>
9197
92- < Listing : allowSearch= " false" : allowCustomizingColumns= " false" : url= " cp_url('api/backups')" >
98+ < Listing ref = " listing " : allowSearch= " false" : allowCustomizingColumns= " false" : url= " cp_url('api/backups')" >
9399 < template #prepended- row- actions= " { row }" >
94100 < DropdownItem v- if = " backupStore.abilities.download.isPermitted"
95101 : text= " __('statamic-backup::backup.download.label')"
0 commit comments