Browse Source

feat(nc-gui): retrieve ncAttachmentFieldSize and ncMaxAttachmentsAllowed from app info

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
d97ae2ec17
  1. 9
      packages/nc-gui/components/smartsheet/column/AttachmentOptions.vue
  2. 2
      packages/nc-gui/composables/useGlobal/types.ts

9
packages/nc-gui/components/smartsheet/column/AttachmentOptions.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { useVModel } from '#imports'
import { useGlobal, useVModel } from '#imports'
interface Option {
key: string
@ -18,15 +18,16 @@ const validators = {}
const { setAdditionalValidations, validateInfos } = useColumnCreateStoreOrThrow()
const { appInfo } = useGlobal()
setAdditionalValidations({
...validators,
})
// set default value
vModel.value.meta = {
maxNumberOfAttachments: 10,
// TODO: take care of NC_ATTACHMENT_FIELD_SIZE
maxAttachmentSize: 20, // 20 MB
maxNumberOfAttachments: appInfo.value.ncMaxAttachmentsAllowed || 10,
maxAttachmentSize: appInfo.value.ncAttachmentFieldSize / 1024 / 1024 || 20, // MB
unsupportedAttachmentMimeTypes: [],
...vModel.value.meta,
}

2
packages/nc-gui/composables/useGlobal/types.ts

@ -26,6 +26,8 @@ export interface AppInfo {
type: string
version: string
ee?: boolean
ncAttachmentFieldSize: number
ncMaxAttachmentsAllowed: number
}
export interface StoredState {

Loading…
Cancel
Save