Skip to content

Commit

Permalink
feat(admin-ui): update the AssetForm #1635
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Apr 5, 2024
1 parent 3d9bc26 commit 2ca8f7a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions admin-ui/plugins/admin/components/Assets/AssetForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ const AssetForm = () => {
validators: [
new FileAmountLimitValidator({ max: 1 }),
new FileTypeValidator(['js', 'css', 'html', 'jar']),
new FileSizeValidator({ maxFileSize: 10 * 1024 * 1024 /* 5 MB */ }),
new FileSizeValidator({ maxFileSize: 20 * 1024 * 1024 /* 20 MB */ }),
],
onFilesRejected: ({ errors }) => {
console.log('Failed to import flow file:', errors)
//toast.error('Failed to import flow file: Only JSON,css,html,jar, js files are allowed with max size 10MB.')
},
onFilesSuccessfullySelected: () => {
console.log('File imported successfully.')
Expand Down Expand Up @@ -97,10 +96,9 @@ const AssetForm = () => {
setModal(!modal)
}

function flowUpload() {
function assetUpload() {
formik.setFieldValue('displayName', filesContent[0].name)
formik.setFieldValue('document', filesContent[0])
clear()
}

const submitForm = useCallback(
Expand Down Expand Up @@ -143,7 +141,7 @@ const AssetForm = () => {

useEffect(() => {
if (filesContent.length >= 1) {
flowUpload()
assetUpload()
}
}, [filesContent])

Expand Down

0 comments on commit 2ca8f7a

Please sign in to comment.