Skip to content

Commit 4023f25

Browse files
committed
Merge branch 'pre-stage' of github.com:contentstack/migration-v2 into dev
2 parents 3c05d7f + b1f0f2e commit 4023f25

File tree

7 files changed

+16
-47
lines changed

7 files changed

+16
-47
lines changed

.talismanrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ fileignoreconfig:
6161

6262
- filename: ui/src/components/Common/Card/card.tsx
6363
checksum: 6c6194f6b8f470ad107e59f2c4247647bdaa804e458c06b007cf9e074aabac69
64+
- filename: upload-api/migration-sitecore/libs/contenttypes.js
65+
checksum: b30d7792e245cbf979d151677af4454b327271 cc46ee3058f54ee6192d433638
66+
- filename: ui/src/components/ContentMapper/index.tsx
67+
checksum: b2f520ab58cd790b204f7dcc26f84606185ca0abd96162e2672d3497643e18e7
6468

6569
- filename: upload-api/src/config/index.ts
6670
checksum: bd1465785804b3e3942d79f4424498bec838e5aba431c715eb419f3d39cf8d30

ui/src/components/ContentMapper/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref:
293293
const [isCsCTypeUpdated, setsCsCTypeUpdated] = useState<boolean>(false);
294294
const [isLoadingSaveButton, setisLoadingSaveButton] = useState<boolean>(false);
295295
const [activeFilter, setActiveFilter] = useState<string>('');
296-
const [isAllCheck, setIsAllCheck] = useState<boolean>(false);
296+
const [isAllCheck, setIsAllCheck] = useState<boolean>(false);
297+
297298

298299
/** ALL HOOKS Here */
299300
const { projectId = '' } = useParams();
@@ -547,7 +548,6 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref:
547548
}, [contentTypeSchema]);
548549
useEffect(() => {
549550
if (existingField && isCsCTypeUpdated) {
550-
setIsAllCheck(false);
551551
const matchedKeys = new Set<string>();
552552

553553
contentTypeSchema?.forEach((item) => {
@@ -832,7 +832,6 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref:
832832

833833
// add row ids with their data to rowHistoryObj
834834
useEffect(() => {
835-
setIsAllCheck(false);
836835
Object.keys(rowHistoryObj)?.forEach(key => delete rowHistoryObj[key]);
837836
tableData?.forEach(item => {
838837
rowHistoryObj[item?.id] = [{ checked: true, at: Date.now(), ...modifiedObj(item) }]
@@ -1002,7 +1001,6 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref:
10021001
const handleValueChange = (value: FieldTypes, rowIndex: string, rowContentstackFieldUid: string) => {
10031002
setIsDropDownChanged(true);
10041003
setFieldValue(value);
1005-
setIsAllCheck(false);
10061004
const updatedRows: FieldMapType[] = selectedEntries?.map?.((row) => {
10071005
if (row?.uid === rowIndex && row?.contentstackFieldUid === rowContentstackFieldUid) {
10081006
return { ...row, contentstackFieldType: value?.value };
@@ -1641,7 +1639,6 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref:
16411639

16421640
const handleSaveContentType = async () => {
16431641
setisLoadingSaveButton(true);
1644-
setIsAllCheck(false);
16451642
const orgId = selectedOrganisation?.uid;
16461643
const projectID = projectId;
16471644
if (

ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ const LanguageMapper = ({stack, uid} :{ stack : IDropDown, uid : string}) => {
480480
const [cmsLocaleOptions, setcmsLocaleOptions] = useState<{ label: string; value: string }[]>([]);
481481
const [sourceLocales, setsourceLocales] = useState<{ label: string; value: string }[]>([]);
482482
const [isLoading, setisLoading] = useState<boolean>(false);
483-
const [currentStack, setCurrentStack] = useState<IDropDown>(stack);
483+
const [currentStack, setCurrentStack] = useState<IDropDown>();
484484
const [previousStack, setPreviousStack] = useState<IDropDown>();
485485
const [isStackChanged, setisStackChanged] = useState<boolean>(false);
486486
const [stackValue, setStackValue] = useState<string>(stack?.value)

ui/src/components/DestinationStack/Actions/LoadStacks.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ const LoadStacks = (props: LoadFileFormatProps) => {
8686
const [placeholder] = useState<string>('Select a stack');
8787
const [localePlaceholder, setlocalePlaceholder ] = useState<string>('Master Locale will be set after stack selection');
8888
const newMigrationDataRef = useRef(newMigrationData);
89-
const [isStackLoading, setIsStackLoading] = useState<boolean>(true);
9089

9190
useEffect(() => {
9291
newMigrationDataRef.current = newMigrationData;
@@ -112,7 +111,6 @@ const LoadStacks = (props: LoadFileFormatProps) => {
112111
const handleOnSave = async (data: Stack) => {
113112
try {
114113
// Post data to backend
115-
setIsStackLoading(true);
116114
const resp = await createStacksInOrg(selectedOrganisation?.value, {
117115
...data,
118116
master_locale: data?.locale
@@ -155,7 +153,6 @@ const LoadStacks = (props: LoadFileFormatProps) => {
155153
};
156154

157155
dispatch(updateNewMigrationData(newMigrationDataObj));
158-
setIsStackLoading(false);
159156
// call for Step Change
160157
props.handleStepChange(props?.currentStep, true);
161158

@@ -360,7 +357,7 @@ const LoadStacks = (props: LoadFileFormatProps) => {
360357
</div>
361358
</div>
362359

363-
{newMigrationData?.destination_stack?.selectedStack?.value && (!isEmptyString(newMigrationData?.destination_stack?.selectedStack?.value) || !isStackLoading) &&(
360+
{newMigrationData?.destination_stack?.selectedStack?.value && (
364361
<div className="language-mapper">
365362
<div className="info-lang">
366363
<div className="stackTitle language-title">Language Mapping</div>
@@ -379,7 +376,7 @@ const LoadStacks = (props: LoadFileFormatProps) => {
379376

380377
<LanguageMapper
381378
uid={selectedStack?.uid ?? ''}
382-
stack={newMigrationData?.destination_stack?.selectedStack ?? DEFAULT_DROPDOWN} />
379+
stack={selectedStack ?? DEFAULT_DROPDOWN} />
383380
</div>
384381
)}
385382
</div>

ui/src/components/DestinationStack/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const DestinationStackComponent = ({
101101
},[newMigrationData?.isprojectMapped]);
102102

103103
useEffect(()=>{
104-
if(!isEmptyString(newMigrationData?.destination_stack?.selectedStack?.value )
104+
if(! isEmptyString(newMigrationData?.destination_stack?.selectedStack?.value )
105105
){
106106
handleAllStepsComplete(true);
107107
}

ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface UploadState {
2626
fileFormat?: string;
2727
isConfigLoading: boolean;
2828
isLoading: boolean;
29-
isValidated?: boolean;
29+
isValidated: boolean;
3030
isDisabled?: boolean;
3131
processing: string;
3232
progressPercentage: number;
@@ -193,7 +193,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
193193
{
194194
isLoading,
195195
isConfigLoading,
196-
//isValidated,
196+
isValidated,
197197
validationMessgae,
198198
isDisabled,
199199
cmsType,
@@ -294,7 +294,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
294294
if (savedState) {
295295
setIsLoading(savedState.isLoading);
296296
setIsConfigLoading(savedState.isConfigLoading);
297-
//setIsValidated(savedState?.isValidated);
297+
setIsValidated(savedState?.isValidated);
298298
setValidationMessage(savedState?.validationMessage);
299299
//setIsDisabled(savedState?.isDisabled);
300300
setCmsType(savedState.cmsType);
@@ -319,7 +319,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
319319
{
320320
isLoading,
321321
isConfigLoading,
322-
//isValidated,
322+
isValidated,
323323
validationMessgae,
324324
//isDisabled,
325325
cmsType,
@@ -335,7 +335,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
335335
}, [
336336
isLoading,
337337
isConfigLoading,
338-
//isValidated,
338+
isValidated,
339339
validationMessgae,
340340
//isDisabled,
341341
cmsType,

ui/src/pages/Migration/index.tsx

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { cbModal, Notification } from '@contentstack/venus-components';
77
// Redux files
88
import { RootState } from '../../store';
99
import { updateMigrationData, updateNewMigrationData } from '../../store/slice/migrationDataSlice';
10-
import { useWarnOnRefresh } from '../../hooks/useWarnOnrefresh';
1110

1211
// Services
1312
import {
@@ -106,38 +105,10 @@ const Migration = () => {
106105
const saveRef = useRef<ContentTypeSaveHandles>(null);
107106
const newMigrationDataRef = useRef(newMigrationData);
108107

109-
const [isSaved, setIsSaved] = useState<boolean>(false);
110-
111108
useEffect(() => {
112109
fetchData();
113110
}, [params?.stepId, params?.projectId, selectedOrganisation?.value]);
114111

115-
useWarnOnRefresh(isSaved);
116-
117-
useEffect(()=>{
118-
const hasNonEmptyMapping =
119-
newMigrationData?.destination_stack?.localeMapping &&
120-
Object.entries(newMigrationData?.destination_stack?.localeMapping || {})?.every(
121-
([label, value]: [string, string]) =>
122-
Boolean(label?.trim()) &&
123-
value !== '' &&
124-
value !== null &&
125-
value !== undefined
126-
);
127-
if(legacyCMSRef?.current && !isCompleted && newMigrationData?.project_current_step === 1){
128-
setIsSaved(true);
129-
}
130-
else if ((isCompleted && !isEmptyString(newMigrationData?.destination_stack?.selectedStack?.value) && newMigrationData?.project_current_step === 2)){
131-
setIsSaved(true);
132-
}
133-
else if(newMigrationData?.content_mapping?.isDropDownChanged){
134-
setIsSaved(true);
135-
}
136-
else{
137-
setIsSaved(false);
138-
}
139-
},[isCompleted, newMigrationData])
140-
141112
/**
142113
* Dispatches the isprojectMapped key to redux
143114
*/
@@ -255,7 +226,7 @@ const Migration = () => {
255226
...newMigrationData?.legacy_cms?.uploadedFile,
256227
name: data?.localPath,
257228
url: data?.localPath,
258-
isValidated: false,
229+
isValidated: data?.localPath !== newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath ? false : newMigrationData?.legacy_cms?.uploadedFile?.isValidated,
259230
file_details: {
260231
isLocalPath: data?.isLocalPath,
261232
cmsType: data?.cmsType,

0 commit comments

Comments
 (0)