Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions ui/src/cmsData/legacyCms.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@
"_metadata": {
"uid": "cs6c761d71844ac800"
},
"title": "Add Source Prefix",
"description": "Add a 2–5 character prefix for the source name. Use only letters, no numbers or special characters.",
"title": "Add Source Affix",
"description": "Add a 2–5 character affix for the source name. Use only letters, no numbers or special characters.",
"step_lock_text": "Editing this step is currently disabled. To make changes in Draft mode, please deactivate the migration.",
"lock": false,
"active": false,
"empty_step_placeholder": "No Prefix Entered..."
"empty_step_placeholder": "No affix Entered..."
},
{
"step_id": "Step3",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/cmsData/projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"uid": "5ff5db2c09b54cf994ac9c0684d9a9eb",
"children": [
{
"text": "Let's get started on streamlining your content migration process! Simply follow the steps and unlock a seamless transfer experience."
"text": "Begin your content migration journey by creating a new project. Follow the steps to ensure a smooth and efficient transfer of your content."
}
]
},
Expand Down
63 changes: 40 additions & 23 deletions ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
nonLocalizable: false
});

const [active, setActive] = useState<number>(0);
const [active, setActive] = useState<number | null>(0);

const [searchContentType, setSearchContentType] = useState('');

Expand Down Expand Up @@ -613,16 +613,16 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
const openContentType = (i: number) => {
setIsFieldDeleted(false);
setActive(i);
const otherTitle = contentTypes?.[i]?.otherCmsTitle;
const otherTitle = filteredContentTypes?.[i]?.otherCmsTitle;
setOtherCmsTitle(otherTitle);
setContentTypeUid(contentTypes?.[i]?.id ?? '');
fetchFields(contentTypes?.[i]?.id ?? '', searchText || '');
setOtherCmsUid(contentTypes?.[i]?.otherCmsUid);
setSelectedContentType(contentTypes?.[i]);
setIsContentType(contentTypes?.[i]?.type === "content_type");
setContentTypeUid(filteredContentTypes?.[i]?.id ?? '');
fetchFields(filteredContentTypes?.[i]?.id ?? '', searchText || '');
setOtherCmsUid(filteredContentTypes?.[i]?.otherCmsUid);
setSelectedContentType(filteredContentTypes?.[i]);
setIsContentType(filteredContentTypes?.[i]?.type === "content_type");
setOtherContentType({
label: contentTypeMapped?.[otherTitle] ?? `Select ${contentTypes?.[i]?.type === "content_type" ? 'Content Type' : 'Global Field'} from existing stack`,
value: contentTypeMapped?.[otherTitle] ?? `Select ${contentTypes?.[i]?.type === "content_type" ? 'Content Type' : 'Global Field'} from existing stack`
label: contentTypeMapped?.[otherTitle] ?? `Select ${filteredContentTypes?.[i]?.type === "content_type" ? 'Content Type' : 'Global Field'} from existing stack`,
value: contentTypeMapped?.[otherTitle] ?? `Select ${filteredContentTypes?.[i]?.type === "content_type" ? 'Content Type' : 'Global Field'} from existing stack`
});
}

Expand All @@ -641,19 +641,25 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
setSelectedEntries(newTableData);
};

const handleSchemaPreview = (title: string) => {
return cbModal({
component: (props: ModalObj) => (
<SchemaModal
schemaData={tableData}
contentType={title}
{...props}
/>
),
modalProps: {
shouldCloseOnOverlayClick: true
}
});
const handleSchemaPreview = async (title: string, contentTypeId: string) => {
try {
const { data } = await getFieldMapping(contentTypeId ?? '', 0, 30, searchText ?? '', projectId);
return cbModal({
component: (props: ModalObj) => (
<SchemaModal
schemaData={data?.fieldMapping}
contentType={title}
{...props}
/>
),
modalProps: {
shouldCloseOnOverlayClick: true
}
});
} catch (err) {
console.log(err);
return err;
}
};

const accessorCall = (data: FieldMapType) => {
Expand Down Expand Up @@ -1760,9 +1766,20 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
if (value !== 'All') {
setFilteredContentTypes(filteredCT);
setCount(filteredCT?.length);

if (filteredCT?.some((ct) => ct?.otherCmsUid === otherCmsUid)) {
const selectedIndex = filteredCT.findIndex(ct => ct?.otherCmsUid === otherCmsUid);
setActive(selectedIndex);
} else {
setActive(null)
}

} else {
setFilteredContentTypes(contentTypes);
setCount(contentTypes?.length);

const selectedIndex = contentTypes.findIndex(ct => ct?.otherCmsUid === otherCmsUid);
setActive(selectedIndex);
}
setShowFilter(false);
}
Expand Down Expand Up @@ -1895,7 +1912,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
</span>
<span className='ml-10'>
<Tooltip content="Schema Preview" position="bottom">
<button className='list-button schema-preview' onClick={() => handleSchemaPreview(content?.otherCmsTitle)}>{SCHEMA_PREVIEW}</button>
<button className='list-button schema-preview' onClick={() => handleSchemaPreview(content?.otherCmsTitle, content?.id ?? '')}>{SCHEMA_PREVIEW}</button>
</Tooltip>
</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/LegacyCms/Actions/LoadPrefix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const LoadPreFix = (props: LoadSelectCmsProps) => {
} else if (!isValidPrefix(value)) {
setIsRestrictedKey(false);
setIsError(true);
setErrorMessage('Prefix must be 2 to 5 letters, with no numbers or special characters.');
setErrorMessage('Affix must be 2 to 5 letters, with no numbers or special characters.');
} else {
setPrefix(value);
setIsError(false);
Expand Down Expand Up @@ -123,7 +123,7 @@ const LoadPreFix = (props: LoadSelectCmsProps) => {
value={prefix}
autoFocus={true}
width="large"
placeholder={'Add Prefix'}
placeholder={'Add Affix'}
version="v2"
error={isError}
aria-label='affix'
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/MigrationExecution/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const MigrationExecution = () => {
name="stackKey"
value={getPlaceHolder(item?.title)}
version="v2"
disabled
// width="regular"
/>
</Field>
Expand Down
5 changes: 2 additions & 3 deletions ui/src/components/SchemaModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const getTopLevelIcons = (field: FieldMapType) => {
return icons['tag'];
}

if (field?.contentstackFieldType === 'Select' || field?.contentstackFieldType === 'dropdown') {
if (field?.contentstackFieldType === 'Select' || field?.contentstackFieldType === 'dropdown' || field?.contentstackFieldType === 'checkbox' || field?.contentstackFieldType === 'radio') {
return icons['select'];
}

Expand Down Expand Up @@ -180,7 +180,7 @@ const TreeView = ({ schema = [] }: schemaType) => {
</ul>
);
};

return (
<div className="schema">
<div className="entries-outline">
Expand All @@ -192,7 +192,6 @@ const TreeView = ({ schema = [] }: schemaType) => {
outlineName = item?.uid?.replace(/\.+/g, '_');
}
const hasNested = hasNestedValue(item);

return (
<li
key={`${item?.otherCmsField}${item?.contentstackFieldType}`}
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/TestMigration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ const TestMigration = () => {

// to disable buttons as per isMigrated state
useEffect(() => {
if (newMigrationData?.testStacks.find((stack) => stack?.stackUid === newMigrationData?.test_migration?.stack_api_key)?.isMigrated === false) {
if (newMigrationData?.testStacks?.find((stack) => stack?.stackUid === newMigrationData?.test_migration?.stack_api_key)?.isMigrated === false) {
setDisableCreateStack(true);
}

if (newMigrationData?.testStacks.find((stack) => stack?.stackUid === newMigrationData?.test_migration?.stack_api_key)?.isMigrated === true) {
if (newMigrationData?.testStacks?.find((stack) => stack?.stackUid === newMigrationData?.test_migration?.stack_api_key)?.isMigrated === true) {
setdisableTestMigration(true);
}
}, [newMigrationData]);
Expand All @@ -76,7 +76,7 @@ const TestMigration = () => {
//get org plan details
try {
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') || '';
const stacks_details_key = Object.keys(orgDetails?.data?.organization?.plan?.features)?.find(key => orgDetails?.data?.organization?.plan?.features[key].uid === 'stacks') || '';

const max_stack_limit = orgDetails?.data?.organization?.plan?.features[stacks_details_key]?.max_limit;

Expand Down
1 change: 1 addition & 0 deletions ui/src/pages/Projects/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
.EmptyState__description {
p {
color: $color-font-base;
margin: $px-5 0;
}
}

Expand Down
5 changes: 1 addition & 4 deletions ui/src/pages/Projects/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const Projects = () => {
<Button
key={`${index.toString()}`}
buttonType={cta?.theme}
className="mt-10 no-project-add-btn create-project-cta"
className="mt-20 no-project-add-btn create-project-cta"
onClick={() => openModal()}
size="large"
>
Expand All @@ -202,9 +202,6 @@ const Projects = () => {
{cta?.title}
</Button>
))}
<div className='helpText'>
{HTMLReactParser(jsonToHtml(emptystate?.help_text ?? {}))}
</div>
</EmptyState>
)}

Expand Down