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

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

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

Loading…
Cancel
Save