|
142 | 142 | :label-idle='$t(`editor:assets.uploadAssetsDropZone`)' |
143 | 143 | allow-multiple='true' |
144 | 144 | :files='files' |
145 | | - max-files='10' |
| 145 | + :max-files='uploadLimits.maxFiles' |
146 | 146 | :server='filePondServerOpts' |
147 | 147 | :instant-upload='false' |
148 | 148 | :allow-revert='false' |
149 | 149 | @processfile='onFileProcessed' |
150 | 150 | ) |
151 | 151 | v-divider |
152 | 152 | 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 |
154 | 154 | v-spacer |
155 | 155 | v-btn.px-4(color='teal', dark, @click='upload') {{$t('common:actions.upload')}} |
156 | 156 |
|
@@ -239,6 +239,7 @@ import listFolderAssetQuery from 'gql/editor/editor-media-query-folder-list.gql' |
239 | 239 | import createAssetFolderMutation from 'gql/editor/editor-media-mutation-folder-create.gql' |
240 | 240 | import renameAssetMutation from 'gql/editor/editor-media-mutation-asset-rename.gql' |
241 | 241 | import deleteAssetMutation from 'gql/editor/editor-media-mutation-asset-delete.gql' |
| 242 | +import siteConfigQuery from 'gql/editor/editor-site-config.gql' |
242 | 243 |
|
243 | 244 | const FilePond = vueFilePond() |
244 | 245 | const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i |
@@ -278,7 +279,11 @@ export default { |
278 | 279 | renameAssetName: '', |
279 | 280 | renameAssetLoading: false, |
280 | 281 | deleteDialog: false, |
281 | | - deleteAssetLoading: false |
| 282 | + deleteAssetLoading: false, |
| 283 | + uploadLimits: { |
| 284 | + maxFiles: 10, |
| 285 | + maxFileSize: 5 * 1000 * 1000 // 5 MB in bytes |
| 286 | + } |
282 | 287 | } |
283 | 288 | }, |
284 | 289 | computed: { |
@@ -546,6 +551,15 @@ export default { |
546 | 551 | this.loading = isLoading |
547 | 552 | this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-list-refresh') |
548 | 553 | } |
| 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 | + ) |
549 | 563 | } |
550 | 564 | } |
551 | 565 | } |
|
0 commit comments