Skip to content
Merged

Dev #305

Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f4f8cb5
removed csdx utilities code
RohitKini Sep 12, 2024
817163a
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
RohitKini Sep 16, 2024
f14ecdd
added updated code
umeshmore45 Sep 16, 2024
049724c
Merge branch 'feature/merge_two' of https://github.com/contentstack/m…
RohitKini Sep 16, 2024
1c49aa6
added uid
umeshmore45 Sep 17, 2024
61d9485
logger functionality
RohitKini Sep 18, 2024
c8206fd
Merge branch 'feature/merge_two' of https://github.com/contentstack/m…
RohitKini Sep 18, 2024
4ff1b0a
logger functionality
RohitKini Sep 18, 2024
3bf2249
logger functionality
RohitKini Sep 18, 2024
461362d
added updated code
umeshmore45 Sep 19, 2024
5c605e6
added cli code
umeshmore45 Sep 19, 2024
74d321d
added bin
umeshmore45 Sep 19, 2024
a26cd52
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
RohitKini Sep 24, 2024
c456e3e
stacks limit check
RohitKini Sep 26, 2024
175eab7
Merge pull request #296 from contentstack/feature/rohit-updates
RohitKini Sep 26, 2024
1e11f79
Merge pull request #297 from contentstack/feature/merge_two
umeshmore45 Sep 30, 2024
e30acee
added create test route
RohitKini Sep 30, 2024
57ca484
Merge pull request #299 from contentstack/feature/rohit-updates
RohitKini Sep 30, 2024
10819d2
[CMG-311], [CMG-326]
sayalijoshi27 Oct 1, 2024
a0ae36f
Done changes in Contentmapper removed existing ct and global field st…
sayalijoshi27 Oct 1, 2024
ff43e2e
added test
umeshmore45 Oct 2, 2024
ff2deea
[CMG-82] - Create Project modal validation behaviour separated for na…
sayalijoshi27 Oct 3, 2024
ba89476
code added
umeshmore45 Oct 3, 2024
47bedd7
Merge pull request #300 from contentstack/feature/test-mig2
umeshmore45 Oct 3, 2024
418bb4d
Test Migration API integrated
sayalijoshi27 Oct 3, 2024
cd0581c
Merge pull request #301 from contentstack/bugfix/content-mapper
RohitKini Oct 4, 2024
cf19a63
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
sayalijoshi27 Oct 4, 2024
e5bd5e9
Test Migration API integrated
sayalijoshi27 Oct 3, 2024
bdcb680
rebased
umeshmore45 Oct 4, 2024
0e59657
Merge pull request #302 from contentstack/rebase
sayalijoshi27 Oct 4, 2024
8d34f28
Test migration button disabld and loader aaded
sayalijoshi27 Oct 4, 2024
1fc3d70
Merge pull request #303 from contentstack/feature/test-migration
RohitKini Oct 4, 2024
b5cf124
addded test ture boolean code
umeshmore45 Oct 4, 2024
561e04f
Merge pull request #304 from contentstack/feature/lowdb-fix
umeshmore45 Oct 4, 2024
2899517
Test Migration button disable changes
sayalijoshi27 Oct 4, 2024
8956f37
Merge pull request #306 from contentstack/feature/test-migration
sayalijoshi27 Oct 4, 2024
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: 3 additions & 0 deletions ui/src/components/MigrationFlowHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const MigrationFlowHeader = ({projectData, handleOnClick, isLoading }: Migration
const params: Params<string> = useParams();

const selectedOrganisation = useSelector((state: RootState)=>state?.authentication?.selectedOrganisation);
const newMigrationData = useSelector((state: RootState) => state?.migration?.newMigrationData);


useEffect(() => {
fetchProject();
Expand Down Expand Up @@ -65,6 +67,7 @@ const MigrationFlowHeader = ({projectData, handleOnClick, isLoading }: Migration
version="v2"
aria-label='Save and Continue'
isLoading={isLoading}
disabled={newMigrationData?.testStacks?.length > 0}
>
{stepValue}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ const HorizontalStepper = forwardRef(

useEffect(() => {
const stepIndex = parseInt(stepId || '', 10) - 1;

console.log("stepIndex", stepIndex);


if (!Number.isNaN(stepIndex) && stepIndex >= 0 && stepIndex < steps?.length) {
setShowStep(stepIndex);
Expand Down Expand Up @@ -193,7 +190,7 @@ const HorizontalStepper = forwardRef(
!stepsCompleted.includes(idx) && idx !== showStep && !stepsCompleted?.includes(idx - 1)
? 'disableEvents'
: '';
const completeDisable = stepsCompleted?.includes(idx) && idx < steps?.length - 1 ? 'completed disableEvents' : '';
const completeDisable = stepsCompleted?.includes(idx) && idx < steps?.length - 3 ? 'completed disableEvents' : '';
return (
<React.Fragment key={id}>
<div className="stepWrapperContainer">
Expand Down
32 changes: 17 additions & 15 deletions ui/src/components/TestMigration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CS_ENTRIES } from '../../utilities/constants';

// Interface
import { MigrationType } from './testMigration.interface';
import { INewMigration } from '../../context/app/app.interface';
import { INewMigration, TestStacks } from '../../context/app/app.interface';


// Component
Expand All @@ -29,7 +29,7 @@ import './index.scss';

const TestMigration = () => {
const [data, setData] = useState<MigrationType>({});
const [showLogs, setShowLogs] = useState<boolean>(false);
const [isLoading, setIsLoading] = useState<boolean>(false);

const newMigrationData = useSelector((state: RootState) => state?.migration?.newMigrationData);
const selectedOrganisation = useSelector((state: RootState)=>state?.authentication?.selectedOrganisation);
Expand All @@ -47,11 +47,10 @@ const TestMigration = () => {
});
}, []);

console.log("projectId", projectId);


// Method to create test stack
const handleCreateTestStack = async () => {
setIsLoading(true);

//get org plan details
const orgDetails = await getOrgDetails(selectedOrganisation?.value);
const stacks_details_key = Object.keys(orgDetails?.data?.organization?.plan?.features).find(key => orgDetails?.data?.organization?.plan?.features[key].uid === 'stacks') || '';
Expand Down Expand Up @@ -83,22 +82,24 @@ const TestMigration = () => {
data
);

const newMigrationDataObj: INewMigration = {
...newMigrationData,
test_migration: { stack_link: res?.data?.data?.url, stack_api_key: res?.data?.data?.data?.stack?.api_key }
};
if (res?.status === 200) {
setIsLoading(false);


dispatch(updateNewMigrationData((newMigrationDataObj)));
const newMigrationDataObj: INewMigration = {
...newMigrationData,
test_migration: { stack_link: res?.data?.data?.url, stack_api_key: res?.data?.data?.data?.stack?.api_key }
};

dispatch(updateNewMigrationData((newMigrationDataObj)));
}
}

const handleTestMigration = async () => {
const testRes = await createTestMigration(
newMigrationData?.destination_stack?.selectedOrg?.value,
projectId
);

console.log("testRes", testRes);

}

return (
Expand All @@ -111,9 +112,10 @@ const TestMigration = () => {
className="mt-3"
onClick={handleCreateTestStack}
version="v2"
// size="medium"
disabled={newMigrationData?.testStacks?.some((stack: TestStacks) => stack?.isMigrated === false)}
isLoading={isLoading}
>
Create Test Stack
Create Test Stack
</Button>
{(newMigrationData?.test_migration?.stack_api_key || newMigrationData?.test_migration?.stack_link) &&
<Field
Expand Down
9 changes: 8 additions & 1 deletion ui/src/context/app/app.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export interface IContentMapper {
contentTypeList:ContentTypeList[]
}
export interface INewMigration {
testStacks: TestStacks[];
mapperKeys: ContentTypeMap;
legacy_cms: ILegacyCms;
destination_stack: IDestinationStack;
Expand All @@ -185,6 +186,11 @@ export interface INewMigration {
stackDetails: IDropDown;
}

export interface TestStacks {
stackUid?: string;
isMigrated?: boolean;
}

export interface IMigrationData {
allFlowSteps: IFlowStep[];
currentFlowStep: IFlowStep;
Expand Down Expand Up @@ -329,7 +335,8 @@ export const DEFAULT_NEW_MIGRATION: INewMigration = {
content_mapping: DEFAULT_CONTENT_MAPPER,
test_migration: DEFAULT_TEST_MIGRATION,
isprojectMapped: false,
stackDetails: DEFAULT_DROPDOWN
stackDetails: DEFAULT_DROPDOWN,
testStacks: []
};

export const DEFAULT_URL_TYPE: IURLType = {
Expand Down
6 changes: 1 addition & 5 deletions ui/src/pages/Migration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const Migration = () => {
existingGlobal: existingGlobalFields
},
stackDetails: projectData?.stackDetails,
// mapper_keys: projectData?.mapper_keys,
testStacks: projectData?.test_stacks
};

dispatch(updateNewMigrationData(projectMapper));
Expand Down Expand Up @@ -451,12 +451,8 @@ const Migration = () => {
handleOnClickContentMapper,
handleOnClickTestMigration
];



return (


<div className='migration-steps-wrapper'>
{projectData &&
<>
Expand Down