Skip to content

Commit 95d6574

Browse files
committed
fix: Display file upload limits in UI
1 parent 188d36e commit 95d6574

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

client/components/editor/editor-modal-media.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@
142142
:label-idle='$t(`editor:assets.uploadAssetsDropZone`)'
143143
allow-multiple='true'
144144
:files='files'
145-
max-files='10'
145+
:max-files='uploadLimits.maxFiles'
146146
:server='filePondServerOpts'
147147
:instant-upload='false'
148148
:allow-revert='false'
149149
@processfile='onFileProcessed'
150150
)
151151
v-divider
152152
v-card-actions.pa-3
153-
.caption.grey--text.text-darken-2 Max 10 files, 5 MB each
153+
.caption.grey--text.text-darken-2 Max {{ uploadLimits.maxFiles }} files, {{ uploadLimits.maxFileSize | prettyBytes }} each
154154
v-spacer
155155
v-btn.px-4(color='teal', dark, @click='upload') {{$t('common:actions.upload')}}
156156

@@ -239,6 +239,7 @@ import listFolderAssetQuery from 'gql/editor/editor-media-query-folder-list.gql'
239239
import createAssetFolderMutation from 'gql/editor/editor-media-mutation-folder-create.gql'
240240
import renameAssetMutation from 'gql/editor/editor-media-mutation-asset-rename.gql'
241241
import deleteAssetMutation from 'gql/editor/editor-media-mutation-asset-delete.gql'
242+
import siteConfigQuery from 'gql/editor/editor-site-config.gql'
242243
243244
const FilePond = vueFilePond()
244245
const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i
@@ -278,7 +279,11 @@ export default {
278279
renameAssetName: '',
279280
renameAssetLoading: false,
280281
deleteDialog: false,
281-
deleteAssetLoading: false
282+
deleteAssetLoading: false,
283+
uploadLimits: {
284+
maxFiles: 10,
285+
maxFileSize: 5 * 1000 * 1000 // 5 MB in bytes
286+
}
282287
}
283288
},
284289
computed: {
@@ -546,6 +551,15 @@ export default {
546551
this.loading = isLoading
547552
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-list-refresh')
548553
}
554+
},
555+
uploadLimits: {
556+
query: siteConfigQuery,
557+
fetchPolicy: 'network-only',
558+
update: (data) => ({
559+
maxFileSize: data.site.config.uploadMaxFileSize,
560+
maxFiles: data.site.config.uploadMaxFiles
561+
}
562+
)
549563
}
550564
}
551565
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
site {
3+
config {
4+
uploadMaxFileSize
5+
uploadMaxFiles
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)