Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
3 changes: 1 addition & 2 deletions ui/src/components/AccountPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const AccountPage = (props: AccountObj): JSX.Element => {
const { heading, copyrightText } = props.data;

const currentYear = new Date().getFullYear();
const previousYear = currentYear - 1;

return (
// eslint-disable-next-line react/no-unknown-property
Expand All @@ -27,7 +26,7 @@ const AccountPage = (props: AccountObj): JSX.Element => {
</div>
<div className="AccountPage__action">
<div className="AccountPage__content">{props?.children}</div>
<p className="copyright_text">{`© ${previousYear}-${currentYear} ${copyrightText}`}</p>
<p className="copyright_text">{`© ${currentYear} ${copyrightText}`}</p>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export interface ModifiedField {
at: number;
checked: boolean;
id: string;
otherCmsType: string;
backupFieldType: string;
parentId: string;
uid: string;
}
Expand Down
65 changes: 33 additions & 32 deletions ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -821,13 +821,13 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
}

const modifiedObj = (obj: FieldMapType) => {
const {otherCmsType, uid, id} = obj
const {backupFieldType, uid, id} = obj
const excludeArr = ["group"]
return {
id,
otherCmsType,
backupFieldType,
uid,
parentId : excludeArr?.includes(otherCmsType?.toLowerCase()) ? '' : getParentId(uid?.split('.')[0])
parentId : excludeArr?.includes(backupFieldType?.toLowerCase()) ? '' : getParentId(uid?.split('.')[0]?.toLowerCase())
}
}

Expand Down Expand Up @@ -897,9 +897,10 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
// Get the latest action performed row
const latestRow = findLatest(rowHistoryObj);

if(latestRow?.otherCmsType?.toLowerCase() === "group" && latestRow?.parentId === ''){
if(latestRow?.backupFieldType?.toLowerCase() === "group" && latestRow?.parentId === '') {
// get all child rows of group
const childItems = tableData?.filter((entry) => entry?.uid?.startsWith(latestRow?.uid + '.'));
const groupUid = latestRow?.uid?.toLowerCase();
const childItems = tableData?.filter((entry) => entry?.uid?.toLowerCase()?.startsWith(groupUid + '.'));
if (childItems && validateArray(childItems)) {
if(latestRow?.checked){
const lastEle = getLastElements(rowHistoryObj)
Expand Down Expand Up @@ -930,19 +931,19 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
}
} else if(latestRow?.parentId && !["title", "url"]?.includes(latestRow?.uid?.toLowerCase())){
// Extract the group UID if item is child of any group
const uidBeforeDot = latestRow?.uid?.split('.')[0];
const groupItem = tableData?.find((entry) => entry?.uid === uidBeforeDot);
const childItems = tableData?.filter((entry) => entry?.uid?.startsWith(groupItem?.uid + '.'));
const uidBeforeDot = latestRow?.uid?.split('.')[0]?.toLowerCase();
const groupItem = tableData?.find((entry) => entry?.uid === uidBeforeDot);
const childItems = tableData?.filter((entry) => entry?.uid?.toLowerCase()?.startsWith(groupItem?.uid + '.'));

if(latestRow?.checked){
if(latestRow?.checked) {
if(!selectedObj[latestRow?.parentId]){
selectedObj[latestRow?.parentId] = true
}
if(!selectedObj[latestRow?.id]){
selectedObj[latestRow?.id] = true
}
}else{
const lastEle = getLastElements(rowHistoryObj)
} else {
const lastEle = getLastElements(rowHistoryObj);

let allChildFalse = 0
childItems?.forEach((child) => {
Expand Down Expand Up @@ -976,7 +977,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
const handleValueChange = (value: FieldTypes, rowIndex: string) => {
setIsDropDownChanged(true);
setFieldValue(value);
const updatedRows: FieldMapType[] = tableData?.map((row) => {
const updatedRows: FieldMapType[] = selectedEntries?.map((row) => {
if (row?.uid === rowIndex) {
return { ...row, contentstackFieldType: value?.value };
}
Expand Down Expand Up @@ -1124,8 +1125,8 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
item?.child?.some(e => e?.id)
)

if(groupArray?.[0]?.child && previousSelectedValue !== selectedValue?.label && groupArray[0]?.uid === rowIndex){
for(const item of groupArray[0]?.child ?? []){
if(groupArray?.[0]?.child && previousSelectedValue !== selectedValue?.label && groupArray?.[0]?.uid === rowIndex){
for(const item of groupArray?.[0]?.child ?? []){
deletedExstingField[item?.uid] = {
label:item?.uid,
value:existingField[item?.uid]
Expand Down Expand Up @@ -1298,7 +1299,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
OptionsForRow.push(getMatchingOption(value, true, updatedDisplayName, uid ?? ''));
}

const existingLabel = existingField[groupArray[0]?.uid]?.label ?? '';
const existingLabel = existingField[groupArray?.[0]?.uid]?.label ?? '';
const lastLabelSegment = existingLabel.includes('>')
? existingLabel?.split('>')?.pop()?.trim()
: existingLabel;
Expand All @@ -1309,7 +1310,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
for (const item of array) {
const fieldTypeToMatch = Fields[item?.backupFieldType as keyof Mapping]?.type;
if (item?.id === data?.id) {
for (const key of existingField[groupArray[0]?.uid]?.value?.schema || []) {
for (const key of existingField[groupArray?.[0]?.uid]?.value?.schema || []) {

if (checkConditions(fieldTypeToMatch, key, item)) {
OptionsForRow.push(getMatchingOption(key, true, `${updatedDisplayName} > ${key?.display_name}` || '', `${uid}.${key?.uid}`));
Expand Down Expand Up @@ -1422,7 +1423,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
item?.child?.some(e => e?.id === data?.id)
);

const array = groupArray[0]?.child || []
const array = groupArray?.[0]?.child || []

if(value.data_type === 'group'){
processSchema(value, data, array,groupArray, OptionsForRow, fieldsOfContentstack)
Expand All @@ -1440,33 +1441,33 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R

// Handle case where there is exactly one match and it is auto-mapped
if(OptionsForRow?.length === 1 &&
(OptionsForRow[0]?.value?.uid === 'url' || OptionsForRow[0]?.value?.uid === 'title' || OptionsForRow[0]?.value?.data_type === 'group' || OptionsForRow[0]?.value?.data_type === 'reference'
(OptionsForRow?.[0]?.value?.uid === 'url' || OptionsForRow?.[0]?.value?.uid === 'title' || OptionsForRow?.[0]?.value?.data_type === 'group' || OptionsForRow?.[0]?.value?.data_type === 'reference'
))
{
updatedRows = updatedRows.map((row: FieldMapType) => {
if (row?.uid === data?.uid) {
return {
...row,
contentstackField: OptionsForRow[0]?.value?.display_name ?? '',
contentstackFieldUid: OptionsForRow[0]?.value?.uid ?? '',
contentstackField: OptionsForRow?.[0]?.value?.display_name ?? '',
contentstackFieldUid: OptionsForRow?.[0]?.value?.uid ?? '',
advanced: {
validationRegex: OptionsForRow[0]?.value?.format ?? '',
mandatory: OptionsForRow[0]?.value?.mandatory,
multiple: OptionsForRow[0]?.value?.multiple,
unique: OptionsForRow[0]?.value?.unique,
nonLocalizable: OptionsForRow[0]?.value?.non_localizable,
validationRegex: OptionsForRow?.[0]?.value?.format ?? '',
mandatory: OptionsForRow?.[0]?.value?.mandatory,
multiple: OptionsForRow?.[0]?.value?.multiple,
unique: OptionsForRow?.[0]?.value?.unique,
nonLocalizable: OptionsForRow?.[0]?.value?.non_localizable,
},
};
}
return row;
});

// Disable option if it's not already in existingField
if (!existingField[data?.uid] && OptionsForRow[0]) {
if (!existingField[data?.uid] && OptionsForRow?.[0]) {
OptionsForRow[0].isDisabled = true;
}
const newLabel = OptionsForRow[0]?.value?.display_name;
const newvalue = OptionsForRow[0]?.value;
const newLabel = OptionsForRow?.[0]?.value?.display_name;
const newvalue = OptionsForRow?.[0]?.value;

// Check if there's already a matching entry in updatedExstingField
const hasMatchingEntry = Object.values(updatedExstingField)?.some(
Expand All @@ -1483,7 +1484,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
existingField[data?.uid] = { label: newLabel, value: newvalue }
}

const newValue: string = OptionsForRow[0]?.value?.display_name;
const newValue: string = OptionsForRow?.[0]?.value?.display_name;
if (!updatedSelectedOptions?.includes(newValue)) {
updatedSelectedOptions.push(newValue);
}
Expand Down Expand Up @@ -1512,12 +1513,12 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R

const OptionValue: FieldTypes =
OptionsForRow?.length === 1 && (existingField[data?.uid] || updatedExstingField[data?.uid] ) &&
(OptionsForRow[0]?.value?.uid === 'url' || OptionsForRow[0]?.value?.uid === 'title' || OptionsForRow[0]?.value?.data_type === 'group' || OptionsForRow[0]?.value?.data_type === 'reference'
(OptionsForRow?.[0]?.value?.uid === 'url' || OptionsForRow?.[0]?.value?.uid === 'title' || OptionsForRow?.[0]?.value?.data_type === 'group' || OptionsForRow?.[0]?.value?.data_type === 'reference'

)
? {
label: OptionsForRow[0]?.value?.display_name,
value: OptionsForRow[0]?.value,
label: OptionsForRow?.[0]?.value?.display_name,
value: OptionsForRow?.[0]?.value,
isDisabled: true
}
: (OptionsForRow?.length === 0 || (OptionsForRow?.length > 0 && OptionsForRow?.every((item)=>item?.isDisabled)
Expand Down
17 changes: 2 additions & 15 deletions ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,22 +429,9 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
<div className="col-12">
<div className={containerClassName}>
{!isConfigLoading && !isEmptyString(fileDetails?.localPath) ? (
<div className='file-icon-group'>
// <div className='file-icon-group'>
<FileComponent fileDetails={fileDetails || {}} />
{/* {(showMessage && !isCancelLoading) &&
(<Tooltip content='cancel validation' position='top'>
<Icon icon='CloseNoborder' version='v2' onClick={handleCancelValidation}/>

</Tooltip> )
} */}
{/* { isCancelLoading &&
<div style={{justifyContent:'center', alignItems:'center', marginTop:'7px'}}>
<AsyncLoader color='$color-brand-primary-base'/>
</div>
} */}
</div>


// </div>
) :

<div className='loader'>
Expand Down
10 changes: 5 additions & 5 deletions ui/src/components/LegacyCms/legacyCms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@
margin-left: 10px !important;
border: 1px solid $color-brand-secondary-lightest;
border-radius: var(--TermCount, 5px);

}
.validation-container > * {
margin-right: 10px;
margin-left: 15px;
padding: 10px 15px;
}
// .validation-container > * {
// margin-right: 10px;
// margin-left: 15px;
// }
.error-container{
display: flex;
background-color: $color-base-white-5;
Expand Down
7 changes: 6 additions & 1 deletion ui/src/context/app/app.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const AppContextProvider: FC<IProps> = ({ children }) => {

useEffect(() => {
const token = getDataFromLocalStorage('app_token');
setAuthToken(token || '');
setAuthToken(token ?? '');

const storedNewMigration = sessionStorage.getItem('newMigration');
if (storedNewMigration) {
Expand All @@ -129,6 +129,11 @@ const AppContextProvider: FC<IProps> = ({ children }) => {
if (!isEmptyString(authToken)) {
getUserDetails();
}

// Debug token issue for hosting
const token = getDataFromLocalStorage('app_token');
setAuthToken(token ?? '');

}, [authToken]);

useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion upload-api/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

PORT=4002
NODE_BACKEND_API=http://localhost:5001
NODE_BACKEND_API =http://localhost:5001
5 changes: 2 additions & 3 deletions upload-api/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default {
plan: {
dropdown: { optionLimit: 100 }
},
cmsType: 'Sitecore',
cmsType: 'contentful',
isLocalPath: true,
awsData: {
awsRegion: 'us-east-2',
Expand All @@ -12,7 +12,6 @@ export default {
bucketName: 'migartion-test',
buketKey: 'project/package 45.zip'
},
// localPath: '/Users/shobhit.upadhyay/Downloads/contentful-data.json' //package 45.zip'
localPath: '/Users/shobhit.upadhyay/Downloads/package 47.zip'
localPath: '/Users/sayali.joshi/Downloads/contentfulDummyEmbedData.json' //package 45.zip'
// localPath: '/Users/umesh.more/Documents/ui-migration/migration-v2-node-server/upload-api/extracted_files/package 45.zip'
};