Skip to content

Commit ced0c23

Browse files
feat: make upload chunksize configurable (#62)
* feat: make upload chunksize configurable * Update client/src/components/Upload.vue Co-authored-by: Copilot <[email protected]> * Update client/src/components/Backup.vue Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent d9a43a8 commit ced0c23

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

client/src/components/Backup.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,23 @@ export default {
1919
"backup-listing": Listing,
2020
"backup-actions": Actions,
2121
},
22+
props: {
23+
chunkSize: {
24+
type: Number,
25+
default: 2 * 1024 * 1024, // 2MB
26+
},
27+
},
2228
created() {
29+
console.log(this.chunkSize)
30+
window.backup = {
31+
chunkSize: this.chunkSize
32+
};
33+
2334
if (!this.$store.hasModule('backup-provider')) {
2435
this.$store.registerModule('backup-provider', store);
2536
this.$store.dispatch('backup-provider/pollEndpoint');
2637
}
2738
},
28-
data() {
29-
return {
30-
serverState: "initializing",
31-
uploads: [],
32-
url: cp_url("/backups"),
33-
};
34-
},
3539
destroy() {
3640
this.$store.dispatch('backup-provider/stopPolling');
3741
this.$store.unregisterModule('backup-provider');

client/src/components/Upload.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export default {
5151
"X-CSRF-TOKEN":
5252
document.querySelector("input[name=_token]").value,
5353
},
54+
chunkSize: window.backup.chunkSize || 2 * 1024 * 1024, // 2MB
55+
forceChunkSize: true,
5456
maxChunkRetries: 1,
5557
maxFiles: 1,
5658
testChunks: false,

config/backup.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
'path' => 'statamic-backups',
1111
],
1212

13+
/**
14+
* The upload chunk size
15+
*/
16+
'chunk_size' => 2 * 1024 * 1024,
17+
1318
/**
1419
* The directory where backup will put metadata files
1520
*/

resources/views/backups.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
@csrf
77

8-
<itiden-backup />
8+
<itiden-backup :chunk-size="{{ config('backup.chunk_size') }}" />
99

1010
@endsection

0 commit comments

Comments
 (0)