From f4628685a055a941bd07df02558706c4bf4189a4 Mon Sep 17 00:00:00 2001 From: AishDani Date: Thu, 27 Mar 2025 15:42:07 +0530 Subject: [PATCH 1/3] fix:refactored the flow for storing config values in redux --- .../LegacyCms/Actions/LoadFileFormat.tsx | 33 +------ .../LegacyCms/Actions/LoadUploadFile.tsx | 93 ++++++------------- ui/src/components/LegacyCms/index.tsx | 26 +----- ui/src/context/app/app.interface.ts | 4 +- ui/src/pages/Migration/index.tsx | 73 +++++++++++++-- 5 files changed, 105 insertions(+), 124 deletions(-) diff --git a/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx b/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx index afcc53e48..749df1199 100644 --- a/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx @@ -37,7 +37,7 @@ const LoadFileFormat = (props: LoadFileFormatProps) => { const [isCheckedBoxChecked] = useState( newMigrationData?.legacy_cms?.isFileFormatCheckboxChecked || true ); - const [fileIcon, setFileIcon] = useState(newMigrationData?.legacy_cms?.selectedFileFormat?.title); + const [fileIcon, setFileIcon] = useState(newMigrationDataRef?.current?.legacy_cms?.selectedFileFormat?.title); const [isError, setIsError] = useState(false); const [error, setError] = useState(''); @@ -60,26 +60,12 @@ const LoadFileFormat = (props: LoadFileFormatProps) => { } }; - const getFileExtension = (filePath: string): string => { - const normalizedPath = filePath?.replace(/\\/g, "/")?.replace(/\/$/, ""); - - // Use regex to extract the file extension - const match = normalizedPath?.match(/\.([a-zA-Z0-9]+)$/); - const ext = match ? match[1]?.toLowerCase() : ""; - - const fileName = filePath?.split('/')?.pop(); - //const ext = fileName?.split('.')?.pop(); - const validExtensionRegex = /\.(pdf|zip|xml|json)$/i; - return ext && validExtensionRegex?.test(`.${ext}`) ? `${ext}` : ''; - }; - const handleFileFormat = async() =>{ try { - const {data} = await getConfig(); - const cmsType = !isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.parent) ? newMigrationData?.legacy_cms?.selectedCms?.parent : data?.cmsType?.toLowerCase(); - const filePath = data?.localPath?.toLowerCase(); - const fileFormat = getFileExtension(filePath); + const cmsType = !isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.parent) ? newMigrationData?.legacy_cms?.selectedCms?.parent : newMigrationData?.legacy_cms?.uploadedFile?.cmsType; + const filePath = newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath?.toLowerCase(); + const fileFormat: string = newMigrationData?.legacy_cms?.selectedFileFormat?.title?.toLowerCase(); if(! isEmptyString(selectedCard?.fileformat_id) && selectedCard?.fileformat_id !== fileFormat && newMigrationData?.project_current_step > 1){ setFileIcon(selectedCard?.title); } @@ -108,17 +94,9 @@ const LoadFileFormat = (props: LoadFileFormatProps) => { title: fileFormat === 'zip' ? fileFormat?.charAt(0)?.toUpperCase() + fileFormat?.slice(1) : fileFormat?.toUpperCase() } - const newMigrationDataObj = { - ...newMigrationDataRef?.current, - legacy_cms: { - ...newMigrationDataRef?.current?.legacy_cms, - selectedFileFormat: selectedFileFormatObj, - } - }; setFileIcon(fileFormat === 'zip' ? fileFormat?.charAt(0).toUpperCase() + fileFormat.slice(1) : fileFormat?.toUpperCase()); - dispatch(updateNewMigrationData(newMigrationDataObj)); - + } } catch (error) { @@ -131,7 +109,6 @@ const LoadFileFormat = (props: LoadFileFormatProps) => { /**** ALL USEEffects HERE ****/ useEffect(()=>{ handleFileFormat(); - //handleBtnClick(); },[]); useEffect(() => { diff --git a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx index 5c08d8ad0..2aed16161 100644 --- a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { FileDetails, ICMSType, INewMigration } from '../../../context/app/app.interface'; -import { fileValidation, getConfig } from '../../../services/api/upload.service'; +import { fileValidation } from '../../../services/api/upload.service'; import { RootState } from '../../../store'; import { updateNewMigrationData } from '../../../store/slice/migrationDataSlice'; import { Button, CircularLoader, Paragraph } from '@contentstack/venus-components'; @@ -73,14 +73,14 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { const newMigrationDataRef = useRef(newMigrationData); const dispatch = useDispatch(); const [isLoading, setIsLoading] = useState(false); - const [isValidated, setIsValidated] = useState(newMigrationData?.legacy_cms?.uploadedFile?.isValidated); - const [showMessage, setShowMessage] = useState(newMigrationData?.legacy_cms?.uploadedFile?.isValidated); + const [isValidated, setIsValidated] = useState(newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.isValidated); + const [showMessage, setShowMessage] = useState(newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.isValidated); const [validationMessgae, setValidationMessage] = useState(''); const [isValidationAttempted, setIsValidationAttempted] = useState(false); const [isDisabled, setIsDisabled] = useState(newMigrationData?.legacy_cms?.uploadedFile?.isValidated || isEmptyString(newMigrationDataRef?.current?.legacy_cms?.affix)); const [isConfigLoading, setIsConfigLoading] = useState(false); const [cmsType, setCmsType]= useState(''); - const [fileDetails, setFileDetails] = useState(newMigrationData?.legacy_cms?.uploadedFile?.file_details); + const [fileDetails, setFileDetails] = useState(newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details); const [fileExtension, setFileExtension] = useState(''); const [progressPercentage, setProgressPercentage] = useState(0); const [showProgress, setShowProgress]= useState(false); @@ -135,7 +135,8 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { bucketName: data?.file_details?.awsData?.bucketName, buketKey: data?.file_details?.awsData?.buketKey } - } + }, + cmsType: data?.cmsType } } @@ -222,54 +223,25 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { //function to get config details const getConfigDetails = async () =>{ try { - setIsConfigLoading(true); - const {data, status} = await getConfig(); + //setIsConfigLoading(true); - if (!isEmptyString(fileDetails?.localPath) && data?.localPath !== fileDetails?.localPath && !isEmptyString(newMigrationDataRef?.current?.legacy_cms?.affix)) { + if (!isEmptyString(fileDetails?.localPath) && newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath !== fileDetails?.localPath && !isEmptyString(newMigrationDataRef?.current?.legacy_cms?.affix)) { setIsDisabled(false); setShowMessage(true); setValidationMessage(''); } - if(status === 200){ - const extension = getFileExtension(data?.localPath); - setCmsType(data?.cmsType); - setFileDetails(data); + const extension = getFileExtension(newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath || ''); + setCmsType(newMigrationData?.legacy_cms?.uploadedFile?.cmsType); + //setFileDetails(data); setFileExtension(extension); - const newMigrationDataObj: INewMigration = { - ...newMigrationDataRef?.current, - legacy_cms: { - ...newMigrationDataRef?.current?.legacy_cms, - uploadedFile: { - name: data?.localPath, - url: data?.localPath, - isValidated: newMigrationData?.legacy_cms?.uploadedFile?.isValidated, - reValidate: false, - file_details: { - isLocalPath: data?.isLocalPath, - cmsType: data?.cmsType, - localPath: data?.localPath, - awsData: { - awsRegion: data?.awsData?.awsRegion, - bucketName: data?.awsData?.bucketName, - buketKey: data?.awsData?.buketKey - } - } - } - } - }; - - if(isEmptyString(newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath) ){ - dispatch(updateNewMigrationData(newMigrationDataObj)); - - } const { all_cms = [] } = migrationData?.legacyCMSData || {}; let filteredCmsData:ICMSType[] = all_cms; - if (data?.cmsType) { - filteredCmsData = all_cms?.filter((cms: ICMSType) => cms?.parent?.toLowerCase() === data?.cmsType?.toLowerCase()); + if (newMigrationData?.legacy_cms?.uploadedFile?.cmsType) { + filteredCmsData = all_cms?.filter((cms: ICMSType) => cms?.parent?.toLowerCase() === newMigrationData?.legacy_cms?.uploadedFile?.cmsType?.toLowerCase()); } const isFormatValid = filteredCmsData[0]?.allowed_file_formats?.some((format: ICardType) => { @@ -277,8 +249,8 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { return isValid; }); - //setIsFormatValid(isFormatValid); - + + //setIsFormatValid(isFormatValid); setIsDisabled(!isFormatValid || isEmptyString(newMigrationDataRef?.current?.legacy_cms?.affix)); if(!isFormatValid){ setValidationMessage(''); @@ -296,17 +268,17 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { } - } - if((! isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.parent?.toLowerCase()) && - newMigrationData?.legacy_cms?.selectedCms?.parent.toLowerCase() !== data?.cmsType.toLowerCase())) - { - setIsValidated(false); - setValidationMessage('file format is not appropriate'); - setIsValidationAttempted(true); - setShowMessage(true); - setIsLoading(false); - setIsDisabled(true); - } + //} + // if((! isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.parent?.toLowerCase()) && + // newMigrationData?.legacy_cms?.selectedCms?.parent.toLowerCase() !== data?.cmsType.toLowerCase())) + // { + // setIsValidated(false); + // setValidationMessage('file format is not appropriate'); + // setIsValidationAttempted(true); + // setShowMessage(true); + // setIsLoading(false); + // setIsDisabled(true); + // } setIsConfigLoading(false); } catch (error) { @@ -319,10 +291,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { } useEffect(() => { - if(isEmptyString(newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath)){ - getConfigDetails(); - } - + getConfigDetails(); }, []); useEffect(() => { @@ -332,7 +301,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { setIsConfigLoading(savedState.isConfigLoading); setIsValidated(savedState?.isValidated); setValidationMessage(savedState?.validationMessage); - setIsDisabled(savedState?.isDisabled); + //setIsDisabled(savedState?.isDisabled); setCmsType(savedState.cmsType); //setFileDetails(savedState.fileDetails); setFileExtension(savedState.fileExtension); @@ -392,7 +361,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { if(newMigrationData?.legacy_cms?.uploadedFile?.reValidate){ setValidationMessage(''); } - if(!isEmptyString(newMigrationData?.legacy_cms?.affix) && !newMigrationData?.legacy_cms?.uploadedFile?.isValidated ){ + if(!isEmptyString(newMigrationData?.legacy_cms?.affix) && !newMigrationData?.legacy_cms?.uploadedFile?.isValidated && !newMigrationData?.legacy_cms?.uploadedFile?.reValidate){ setIsDisabled(false); } setReValidate(newMigrationData?.legacy_cms?.uploadedFile?.reValidate || false); @@ -418,8 +387,6 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { const sanitizedCmsType = cmsType?.toLowerCase().replace(/[^\w\s-]/g, ''); const documentationUrl = VALIDATION_DOCUMENTATION_URL?.[sanitizedCmsType]; - - const validationClassName = isValidated ? 'success' : 'error'; @@ -468,7 +435,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { isLoading={isLoading} loadingColor="#6c5ce7" version="v2" - disabled={isDisabled || isEmptyString(affix) || reValidate} + disabled={!(reValidate || (!isDisabled && !isEmptyString(newMigrationData?.legacy_cms?.affix)))} > Validate File diff --git a/ui/src/components/LegacyCms/index.tsx b/ui/src/components/LegacyCms/index.tsx index 4df51d8d4..25b6cee2e 100644 --- a/ui/src/components/LegacyCms/index.tsx +++ b/ui/src/components/LegacyCms/index.tsx @@ -56,11 +56,12 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll /** ALL HOOKS HERE */ const [isMigrationLocked, setIsMigrationLocked] = useState(false); - const [isLoading, setIsLoading] = useState(newMigrationData?.isprojectMapped); + const [isLoading, setIsLoading] = useState(true); const [internalActiveStepIndex, setInternalActiveStepIndex] = useState(-1); const [stepperKey] = useState('legacy-Vertical-stepper'); const [isAllStepsCompleted, setIsAllStepsCompleted] = useState(false); + const [isProjectMapped, setisProjectMapped] = useState(newMigrationData?.isprojectMapped); const autoVerticalStepper = useRef(null); @@ -152,26 +153,6 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll ) { setInternalActiveStepIndex(2); } - dispatch(updateNewMigrationData({ - ...newMigrationData, - legacy_cms: { - currentStep: internalActiveStepIndex, - selectedCms: selectedCmsData, - selectedFileFormat: selectedFileFormatData, - uploadedFile: { - file_details:{ - localPath: legacyCMSData?.file_path, - awsData: legacyCMSData?.awsDetails, - isLocalPath: legacyCMSData?.is_localPath - }, - isValidated: legacyCMSData?.is_fileValid, - reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate - }, //need to add backend data once endpoint exposed. - affix: legacyCMSData?.affix ?? '', - isFileFormatCheckboxChecked: true, //need to add backend data once endpoint exposed. - isRestictedKeywordCheckboxChecked: true //need to add backend data once endpoint exposed. - } - })) setIsLoading(false); //Check for migration Status and lock. @@ -224,6 +205,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll if(!isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.cms_id) && !isEmptyString(newMigrationData?.legacy_cms?.affix) && newMigrationData?.legacy_cms?.uploadedFile?.isValidated){ setInternalActiveStepIndex(3); } + setisProjectMapped(newMigrationData?.isprojectMapped) },[newMigrationData]); @@ -244,7 +226,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll return ( <> - {isLoading || newMigrationData?.isprojectMapped ? ( + {isLoading || isProjectMapped ? (
diff --git a/ui/src/context/app/app.interface.ts b/ui/src/context/app/app.interface.ts index e5c841283..2532fcf2b 100644 --- a/ui/src/context/app/app.interface.ts +++ b/ui/src/context/app/app.interface.ts @@ -66,7 +66,8 @@ export interface IFile { validation?: string; file_details?: FileDetails; isValidated: boolean; - reValidate: boolean + reValidate: boolean; + cmsType: string } export interface ICMSType extends ICardType { @@ -308,6 +309,7 @@ export const DEFAULT_FILE: IFile = { }, isValidated: false, reValidate: false, + cmsType: '', }; export const DEFAULT_CMS_TYPE: ICMSType = { diff --git a/ui/src/pages/Migration/index.tsx b/ui/src/pages/Migration/index.tsx index 455c7195e..e0ef5bc65 100644 --- a/ui/src/pages/Migration/index.tsx +++ b/ui/src/pages/Migration/index.tsx @@ -61,6 +61,7 @@ import MigrationExecution from '../../components/MigrationExecution'; import SaveChangesModal from '../../components/Common/SaveChangesModal'; import { getMigratedStacks } from '../../services/api/project.service'; import { getStackLocales } from '../../services/api/stacks.service'; +import { getConfig } from '../../services/api/upload.service'; type StepperComponentRef = { handleStepChange: (step: number) => void; @@ -184,20 +185,71 @@ const Migration = () => { setCurrentStepIndex(stepIndex !== -1 ? stepIndex : 0); }; + const getFileExtension = (filePath: string): string => { + const normalizedPath = filePath?.replace(/\\/g, "/")?.replace(/\/$/, ""); + + // Use regex to extract the file extension + const match = normalizedPath?.match(/\.([a-zA-Z0-9]+)$/); + const ext = match ? match[1]?.toLowerCase() : ""; + + const fileName = filePath?.split('/')?.pop(); + //const ext = fileName?.split('.')?.pop(); + const validExtensionRegex = /\.(pdf|zip|xml|json)$/i; + return ext && validExtensionRegex?.test(`.${ext}`) ? `${ext}` : ''; + }; + + // funcrion to form file format object from config response + const fetchFileFormat = (data:any) => { + const filePath = data?.localPath?.toLowerCase(); + const fileFormat = getFileExtension(filePath); + const selectedFileFormatObj = { + description: "", + fileformat_id: fileFormat, + group_name: fileFormat, + isactive: true, + title: fileFormat === 'zip' ? fileFormat?.charAt(0)?.toUpperCase() + fileFormat?.slice(1) : fileFormat?.toUpperCase() + } + return selectedFileFormatObj; + } + +// funcrion to form upload object from config response + const getFileInfo = (data:any) => { + const newMigrationDataObj = { + name: data?.localPath, + url: data?.localPath, + isValidated: data?.localePath !== newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath ? false : newMigrationData?.legacy_cms?.uploadedFile?.isValidated, + file_details: { + isLocalPath: data?.isLocalPath, + cmsType: data?.cmsType, + localPath: data?.localPath, + awsData: { + awsRegion: data?.awsData?.awsRegion, + bucketName: data?.awsData?.bucketName, + buketKey: data?.awsData?.buketKey + } + }, + cmsType: data?.cmsType + }; + return newMigrationDataObj; + } + /** * Fetch the project data */ const fetchProjectData = async () => { if (isEmptyString(selectedOrganisation?.value) || isEmptyString(params?.projectId)) return; setIsProjectMapper(true); - const data = await getMigrationData(selectedOrganisation?.value, params?.projectId ?? ''); + const migrationData = await getMigrationData(selectedOrganisation?.value, params?.projectId ?? ''); const migratedstacks = await getMigratedStacks(selectedOrganisation?.value, projectId ); - - if (data) { + const {data} = await getConfig(); + const fileFormat = fetchFileFormat(data); + const uploadObj = getFileInfo(data); + + if (migrationData) { setIsLoading(false); - setProjectData(data?.data); + setProjectData(migrationData?.data); } - const projectData = data?.data; + const projectData = migrationData?.data; const legacyCmsData: ILegacyCMSComponent = await getCMSDataFromFile(CS_ENTRIES.LEGACY_CMS); @@ -213,7 +265,7 @@ const Migration = () => { ? selectedCmsData.allowed_file_formats?.find( (cms: ICardType) => cms?.fileformat_id === projectData?.legacy_cms?.file_format ) - : newMigrationData?.legacy_cms?.selectedFileFormat; + : fileFormat; const selectedOrganisationData = validateArray(organisationsList) ? organisationsList?.find((org: IDropDown) => org?.value === projectData?.org_id) @@ -253,11 +305,12 @@ const Migration = () => { const projectMapper = { ...newMigrationData, legacy_cms: { - ...newMigrationDataRef?.current?.legacy_cms, + ...newMigrationData?.legacy_cms, selectedCms: selectedCmsData, + selectedFileFormat: selectedFileFormatData, affix: projectData?.legacy_cms?.affix , - uploadedFile: { - ...newMigrationDataRef?.current?.legacy_cms, + uploadedFile: projectData?.legacy_cms?.is_fileValid ? { + ...newMigrationDataRef?.current?.legacy_cms?.uploadedFile, file_details: { localPath: projectData?.legacy_cms?.file_path, awsData: { @@ -269,7 +322,7 @@ const Migration = () => { }, isValidated: projectData?.legacy_cms?.is_fileValid, reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate - }, + } : uploadObj, isFileFormatCheckboxChecked: true, isRestictedKeywordCheckboxChecked: true, projectStatus: projectData?.status, From 83b4479748d1a842f7089d50c1cdd72d64de4ed7 Mon Sep 17 00:00:00 2001 From: AishDani Date: Thu, 27 Mar 2025 16:18:13 +0530 Subject: [PATCH 2/3] fix:project.json difference --- upload-api/migration-sitecore/package.json | 84 +++++++++++----------- upload-api/package.json | 2 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/upload-api/migration-sitecore/package.json b/upload-api/migration-sitecore/package.json index 7dff6c8f0..c7d65d32d 100644 --- a/upload-api/migration-sitecore/package.json +++ b/upload-api/migration-sitecore/package.json @@ -1,43 +1,43 @@ -{ - "name": "migration-sitecore", - "version": "1.0.0", - "description": "", - "main": "index.js", - "typings": "index.d.ts", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/contentstack-expert-services/migration-wordpress-xml.git" - }, - "keywords": [], - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/contentstack-expert-services/migration-wordpress-xml/issues" - }, - "homepage": "https://github.com/contentstack-expert-services/migration-wordpress-xml#readme", - "dependencies": { - "@contentstack/json-rte-serializer": "^2.0.2", - "@sitecore-jss/sitecore-jss-cli": "^21.2.4", - "ansi-colors": "^4.1.3", - "axios": "^1.3.4", - "chalk": "^4.1.0", - "cheerio": "^1.0.0-rc.12", - "cli-progress": "^3.11.1", - "fs-readdir-recursive": "^1.1.0", - "inquirer": "^8.2.4", - "jsdom": "^19.0.0", - "lodash": "^4.17.21", - "mkdirp": "^1.0.4", - "moment": "^2.30.1", - "pdf-stream": "^1.3.2", - "request": "^2.88.2", - "rimraf": "^4.1.2", - "uid": "^2.0.2", - "when": "^3.7.8", - "winston": "^3.7.2", - "xml2js": "^0.4.23" - } +{ + "name": "migration-sitecore", + "version": "1.0.0", + "description": "", + "main": "index.js", + "typings": "index.d.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/contentstack-expert-services/migration-wordpress-xml.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/contentstack-expert-services/migration-wordpress-xml/issues" + }, + "homepage": "https://github.com/contentstack-expert-services/migration-wordpress-xml#readme", + "dependencies": { + "@contentstack/json-rte-serializer": "^2.0.2", + "@sitecore-jss/sitecore-jss-cli": "^21.2.4", + "ansi-colors": "^4.1.3", + "axios": "^1.3.4", + "chalk": "^4.1.0", + "cheerio": "^1.0.0-rc.12", + "cli-progress": "^3.11.1", + "fs-readdir-recursive": "^1.1.0", + "inquirer": "^8.2.4", + "jsdom": "^19.0.0", + "lodash": "^4.17.21", + "mkdirp": "^1.0.4", + "moment": "^2.30.1", + "pdf-stream": "^1.3.2", + "request": "^2.88.2", + "rimraf": "^4.1.2", + "uid": "^2.0.2", + "when": "^3.7.8", + "winston": "^3.7.2", + "xml2js": "^0.4.23" + } } \ No newline at end of file diff --git a/upload-api/package.json b/upload-api/package.json index a554beadc..2c949b21f 100644 --- a/upload-api/package.json +++ b/upload-api/package.json @@ -56,4 +56,4 @@ "prettier": "^3.3.3", "xml2js": "^0.6.2" } -} \ No newline at end of file +} From 2efb5e39de2660952197220d64941f52babd3848 Mon Sep 17 00:00:00 2001 From: Sayali Joshi Date: Fri, 28 Mar 2025 15:40:38 +0530 Subject: [PATCH 3/3] Validation added --- ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx b/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx index aefe4b78d..354d0f9f6 100644 --- a/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx @@ -89,11 +89,11 @@ const LoadFileFormat = (props: LoadFileFormatProps) => { fileformat_id: fileFormat, group_name: fileFormat, isactive: true, - title: fileFormat === 'zip' ? fileFormat?.charAt(0)?.toUpperCase() + fileFormat?.slice(1) : fileFormat?.toUpperCase() + title: fileFormat === 'zip' ? fileFormat?.charAt?.(0)?.toUpperCase() + fileFormat?.slice?.(1) : fileFormat?.toUpperCase() } - setFileIcon(fileFormat === 'zip' ? fileFormat?.charAt(0).toUpperCase() + fileFormat.slice(1) : fileFormat?.toUpperCase()); + setFileIcon(fileFormat === 'zip' ? fileFormat?.charAt?.(0).toUpperCase() + fileFormat?.slice?.(1) : fileFormat?.toUpperCase()); } } catch (error) {