Browse Source

feat(nc-gui): revise attachment limits

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
7a8f79097a
  1. 36
      packages/nc-gui/components/smartsheet/column/AttachmentOptions.vue

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

@ -25,10 +25,34 @@ setAdditionalValidations({
...validators, ...validators,
}) })
// TBC
const maxNumberOfAttachmentsLowerLimit = 1
const maxNumberOfAttachmentsUpperLimit = 10000
const maxNumberOfAttachmentsDefaultLimit = 10
const maxNumberOfAttachmentsLimit = appInfo.value.ee
? Math.min(
maxNumberOfAttachmentsUpperLimit,
Math.max(maxNumberOfAttachmentsLowerLimit, appInfo.value.ncMaxAttachmentsAllowed ?? maxNumberOfAttachmentsDefaultLimit),
)
: maxNumberOfAttachmentsDefaultLimit
// TBC
const maxAttachmentSizeDefaultLimit = 20
const maxAttachmentSizeLowerLimit = 1
const maxAttachmentSizeUpperLimit = 10000
const maxAttachmentSizeLimit = appInfo.value.ee
? Math.min(
maxAttachmentSizeUpperLimit,
Math.max(maxAttachmentSizeLowerLimit, appInfo.value.ncMaxAttachmentsAllowed ?? maxAttachmentSizeDefaultLimit),
)
: maxAttachmentSizeDefaultLimit
// set default value // set default value
vModel.value.meta = { vModel.value.meta = {
maxNumberOfAttachments: appInfo.value.ncMaxAttachmentsAllowed || 10, // Maximum Number of Attachments per cell
maxAttachmentSize: appInfo.value.ncAttachmentFieldSize / 1024 / 1024 || 20, // MB maxNumberOfAttachments: maxNumberOfAttachmentsDefaultLimit,
// Maximum File Size per file
maxAttachmentSize: maxAttachmentSizeDefaultLimit,
unsupportedAttachmentMimeTypes: [], unsupportedAttachmentMimeTypes: [],
...vModel.value.meta, ...vModel.value.meta,
} }
@ -47,8 +71,8 @@ const filterOption = (val: string, option: Option) => {
<a-form-item v-bind="validateInfos['meta.maxNumberOfAttachments']" label="Max Number of Attachments"> <a-form-item v-bind="validateInfos['meta.maxNumberOfAttachments']" label="Max Number of Attachments">
<a-input-number <a-input-number
v-model:value="vModel.meta.maxNumberOfAttachments" v-model:value="vModel.meta.maxNumberOfAttachments"
:min="0" :min="maxNumberOfAttachmentsLowerLimit"
:max="appInfo.ncMaxAttachmentsAllowed || 10" :max="maxNumberOfAttachmentsLimit"
class="!w-full nc-extdb-host-port" class="!w-full nc-extdb-host-port"
/> />
</a-form-item> </a-form-item>
@ -58,8 +82,8 @@ const filterOption = (val: string, option: Option) => {
<a-form-item v-bind="validateInfos['meta.maxAttachmentSize']" label="Max Attachment Size (MB)"> <a-form-item v-bind="validateInfos['meta.maxAttachmentSize']" label="Max Attachment Size (MB)">
<a-input-number <a-input-number
v-model:value="vModel.meta.maxAttachmentSize" v-model:value="vModel.meta.maxAttachmentSize"
:min="1" :min="maxAttachmentSizeLowerLimit"
:max="appInfo.ncAttachmentFieldSize / 1024 / 1024 || 20" :max="maxAttachmentSizeLimit"
class="!w-full nc-extdb-host-port" class="!w-full nc-extdb-host-port"
/> />
</a-form-item> </a-form-item>

Loading…
Cancel
Save