Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor:resolved duplicate mapper fields
  • Loading branch information
AishDani committed Jul 10, 2024
commit b0ac49be2cbe7ee18c3ac4274a25ea7b6a9a2884
8 changes: 4 additions & 4 deletions ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
const [isLoading, setIsLoading] = useState<boolean>(false);

const { projectId = '' } = useParams();

/**** ALL METHODS HERE ****/

//Handle Legacy cms selection
Expand Down Expand Up @@ -214,9 +214,9 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
</div>
:
isLoading ? (
<>
<CircularLoader size='small'/>
</>
<div className='loader'>
<CircularLoader/>
</div>
) :
(cmsData && validateArray(cmsData) && (
<div className="service_list_legacy">
Expand Down
9 changes: 7 additions & 2 deletions ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {

//Handle further action on file is uploaded to server
const handleOnFileUploadCompletion = async () => {
setValidationMessage('');
setIsLoading(true);
setProgressPercentage(30);
setShowProgress(true);
setProcessing('Processing..30%')

const res: any = await fileValidation(projectId);
setIsLoading(false);

const newMigrationDataObj: INewMigration = {
...newMigrationData,
Expand Down Expand Up @@ -161,7 +163,6 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
}, projectId);

setShowMessage(true);
setIsLoading(false);
setProgressPercentage(100);
setTimeout(() => {
setProcessing('Processing ...100%')
Expand Down Expand Up @@ -294,6 +295,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
setProcessing(savedState.processing);
}
if (savedState && savedState.isLoading) {

handleOnFileUploadCompletion();
}
},[]);
Expand Down Expand Up @@ -372,7 +374,10 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {

) :

<CircularLoader size='small'/>}
<div className='loader'>
<CircularLoader/>
</div>
}
{showMessage &&
(
<>
Expand Down
5 changes: 3 additions & 2 deletions ui/src/components/LegacyCms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted

//Update New Migration data;
const selectedCmsData: ICMSType = validateArray(data.all_cms)
? data.all_cms?.some((cms: ICMSType) => {
? data.all_cms?.find((cms: ICMSType) => {
return cms?.cms_id === legacyCMSData?.cms})
: DEFAULT_CMS_TYPE;

Expand Down Expand Up @@ -174,7 +174,6 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted
dispatch(updateNewMigrationData({
...newMigrationData,
legacy_cms: {
...newMigrationData?.legacy_cms,
currentStep: internalActiveStepIndex,
selectedCms: selectedCmsData,
selectedFileFormat: selectedFileFormatData || newMigrationData?.legacy_cms?.selectedFileFormat ,
Expand All @@ -191,6 +190,8 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted
}
}))
setIsLoading(false);
console.log(selectedCmsData);


//Check for migration Status and lock.
// Status where Migration is to be Locked:
Expand Down
8 changes: 8 additions & 0 deletions ui/src/components/LegacyCms/legacyCms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,11 @@
flex-direction: row;
gap: 30px;
}
.loader{
margin-left: 20px;
.CircularLoader--size-small{
width: 2rem !important;
height: 2rem !important;
}

}
8 changes: 4 additions & 4 deletions uplaode-api/migration-sitecore/libs/contenttypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const templatesComponents = ({ path, basePath }) => {
const allFields = [];
const allPaths = read(path?.[i]?.pth)
for (let j = 0; j < allPaths?.length; j++) {
if (allPaths?.[j]?.includes("/data.json") || allPaths?.[j]?.includes("/data.json.json")) {
if (allPaths?.[j]?.endsWith("/data.json")) {
const innerField = [];
const components = helper.readFile(
`${path?.[i]?.pth}/${allPaths?.[j]}`
Expand Down Expand Up @@ -415,7 +415,7 @@ const contentTypeMapper = ({ components, standardValues, content_type, basePath,
const optionsPath = read(`${sitecore_folder}/master/sitecore/content/Common/${isDataSourcePresent}`)
const refName = [];
optionsPath?.forEach((newPath) => {
if (newPath?.includes("data.json.json") | newPath?.includes("data.json")) {
if (newPath?.endsWith("data.json.json")) {
const data = helper.readFile(`${sitecore_folder}/master/sitecore/content/Common/${isDataSourcePresent}/${newPath}`)
if (data?.item?.$?.template) {
refName.push(data?.item?.$?.template)
Expand Down Expand Up @@ -520,7 +520,7 @@ function singleContentTypeCreate({ templatePaths, globalPath, sitecore_folder })
let templatesStandaedValuePath = {};
let templatesMetaDataPath = {};
for (let i = 0; i < newPath?.length; i++) {
if (newPath?.[i]?.includes("data.json") || newPath?.[i]?.includes("/data.json.json")) {
if (newPath?.[i]?.endsWith("data.json")) {
const data = helper?.readFile(`${templatePaths}/${newPath?.[i]}`);
if (data?.item?.$?.template === "template section") {
templatesComponentsPath?.push(
Expand Down Expand Up @@ -562,7 +562,7 @@ function ExtractContentTypes(sitecore_folder) {
const folder = read(sitecore_folder);
const templatePaths = [];
for (let i = 0; i < folder?.length; i++) {
if (folder?.[i]?.includes("templates") && (folder?.[i]?.includes("/data.json") || folder?.[i]?.includes("/data.json.json"))) {
if (folder?.[i]?.includes("templates") && folder?.[i]?.endsWith("/data.json")) {
const data = helper?.readFile(`${sitecore_folder}/${folder?.[i]}`)
if (data?.item?.$?.template === "template") {
templatePaths?.push(`${sitecore_folder}/${folder?.[i]}`?.split("/{")?.[0])
Expand Down