diff --git a/api/src/models/FieldMapper.ts b/api/src/models/FieldMapper.ts index 8e25c6d2d..4a9cbd772 100644 --- a/api/src/models/FieldMapper.ts +++ b/api/src/models/FieldMapper.ts @@ -10,6 +10,10 @@ interface Advanced { Multiple: boolean; Unique: boolean; NonLocalizable: boolean; + EmbedObject: boolean; + EmbedObjects:any; + MinChars: string; + MaxChars: number; } /** diff --git a/api/src/models/project-lowdb.ts b/api/src/models/project-lowdb.ts index d73d67566..e5c03ce9c 100644 --- a/api/src/models/project-lowdb.ts +++ b/api/src/models/project-lowdb.ts @@ -62,6 +62,7 @@ interface Project { isNewStack: boolean; newStackId: string; stackDetails: []; + mapper_keys: []; } interface ProjectDocument { diff --git a/api/src/services/contentMapper.service.ts b/api/src/services/contentMapper.service.ts index f71fac676..ca90cd8f3 100644 --- a/api/src/services/contentMapper.service.ts +++ b/api/src/services/contentMapper.service.ts @@ -51,7 +51,7 @@ const putTestData = async (req: Request) => { const id = field?.id?.replace(/[{}]/g, "")?.toLowerCase() || uuidv4(); field.id = id; fieldIds.push(id); - return { id, projectId, isDeleted: true, ...field }; + return { id, projectId, isDeleted: false, ...field }; }); FieldMapperModel.update((data: any) => { data.field_mapper = [...(data?.field_mapper ?? []), ...fields]; @@ -419,7 +419,7 @@ const updateContentType = async (req: Request) => { if (fieldIndex > -1 && field?.ContentstackFieldType !== "") { FieldMapperModel.update((data: any) => { data.field_mapper[fieldIndex] = field; - data.field_mapper[fieldIndex].isDeleted = false; + //data.field_mapper[fieldIndex].isDeleted = false; }); } }); diff --git a/api/src/services/org.service.ts b/api/src/services/org.service.ts index 1719ce781..ef82b56b6 100644 --- a/api/src/services/org.service.ts +++ b/api/src/services/org.service.ts @@ -38,7 +38,7 @@ const getAllStacks = async (req: Request): Promise => { }, }) ); - + // console.info(err, res); if (err) { logger.error( getLogMessage( @@ -63,10 +63,12 @@ const getAllStacks = async (req: Request): Promise => { ); }); } - const locale = await getStackLocal(token_payload, stacks); + // const locale:any[] + // const locale = await getStackLocal(token_payload, stacks); return { data: { - stacks: locale, + // stacks: locale, + stacks, }, status: res.status, }; diff --git a/api/src/services/projects.service.ts b/api/src/services/projects.service.ts index a3f7b949a..57593b4d3 100644 --- a/api/src/services/projects.service.ts +++ b/api/src/services/projects.service.ts @@ -1002,7 +1002,7 @@ const updateContentMapper = async (req: Request) => { try { ProjectModelLowdb.update((data: any) => { - data.projects[projectIndex].content_mapper = content_mapper; + data.projects[projectIndex].mapper_keys = content_mapper; data.projects[projectIndex].updated_at = new Date().toISOString(); }); diff --git a/ui/src/App.tsx b/ui/src/App.tsx index cc3ccdfca..db1aa1166 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,4 +1,4 @@ -import { Suspense } from 'react'; +import { Suspense, useEffect } from 'react'; import { Provider } from 'react-redux'; import { PersistGate } from 'redux-persist/integration/react'; import { FullPageLoader } from '@contentstack/venus-components'; @@ -18,6 +18,20 @@ import { useNetworkCheck } from './components/NetworkProvider'; function App() { const isOnline = useNetworkCheck(); + useEffect(() => { + const selectModal = document.querySelector('.ReactModalPortal'); + + if (selectModal instanceof HTMLElement) { + if (!isOnline) { + // Hide the modal by setting display to none + selectModal.style.display = 'none'; + } else { + // Show the modal by setting display to block + selectModal.style.display = 'block'; + } + } + }, [isOnline]); + return ( <> {isOnline ? ( @@ -38,5 +52,4 @@ function App() { ); } - export default App; diff --git a/ui/src/cmsData/region_login.json b/ui/src/cmsData/region_login.json index 507b185ca..c4ed384da 100644 --- a/ui/src/cmsData/region_login.json +++ b/ui/src/cmsData/region_login.json @@ -53,7 +53,7 @@ "_metadata": { "uid": "cs77a3bf15c456afbb" } }, { - "region": "EU", + "region": "GCP_NA", "service_icon": { "uid": "blt57dafa9c1472b46f", "created_at": "2024-07-29T10:57:59.058Z", @@ -82,7 +82,7 @@ } }, { - "region": "AZURE_EU", + "region": "EU", "service_icon": { "uid": "bltbe45879eac0025d8", "created_at": "2023-10-31T06:59:22.783Z", @@ -106,7 +106,7 @@ "_metadata": { "uid": "csf578f8fbea1ae0c0" } }, { - "region": "GCP_NA", + "region": "AZURE_EU", "service_icon": { "uid": "blt85d2a7024c613199", "created_at": "2023-10-31T07:00:56.567Z", diff --git a/ui/src/components/AdvancePropertise/advanceProperties.interface.ts b/ui/src/components/AdvancePropertise/advanceProperties.interface.ts index 0e5a15db0..bf2011839 100644 --- a/ui/src/components/AdvancePropertise/advanceProperties.interface.ts +++ b/ui/src/components/AdvancePropertise/advanceProperties.interface.ts @@ -116,6 +116,10 @@ export interface UpdatedSettings { * Indicates whether the component is non-localizable. */ NonLocalizable?: boolean; + + Multiple?: boolean; + + EmbedObjects?: any } /** diff --git a/ui/src/components/AdvancePropertise/index.tsx b/ui/src/components/AdvancePropertise/index.tsx index 060d9f937..1f55644c7 100644 --- a/ui/src/components/AdvancePropertise/index.tsx +++ b/ui/src/components/AdvancePropertise/index.tsx @@ -22,6 +22,11 @@ import { ContentType } from '../ContentMapper/contentMapper.interface'; // Styles import './index.scss'; +interface ContentTypeOption { + label: string; + value: string; +} + /** * Component for displaying advanced properties. * @param props - The schema properties. @@ -44,17 +49,23 @@ const AdvancePropertise = (props: SchemaProps) => { allowImagesOnly: props?.value?.AllowImagesOnly, nonLocalizable: props?.value?.NonLocalizable, embedObject: true, - embedAssests: true + embedAssests: true, + multiple: props?.value?.Multiple, + embedObjects: props?.value?.EmbedObjects }); + const embedObjects = props?.value?.EmbedObjects?.map((item: string) => ({ + label: item, + value: item, + })); // State for content types const [contentTypes, setContentTypes] = useState([]); - const [ctValue, setCTValue] = useState(null); + const [ctValue, setCTValue] = useState(embedObjects); + const [embedObjectslabels, setEmbedObjectsLabels] = useState(props?.value?.EmbedObjects); useEffect(() => { fetchContentTypes(''); }, []) - /** * Fetches the content types list. * @param searchText - The search text. @@ -77,16 +88,27 @@ const AdvancePropertise = (props: SchemaProps) => { [field]: (event.target as HTMLInputElement)?.value })); + const currentToggleStates = { + ...toggleStates, + [field]: (event.target as HTMLInputElement)?.value, + }; + props?.updateFieldSettings( props?.rowId, { + ...props?.value, [field?.charAt(0)?.toUpperCase() + field?.slice(1)]: (event.target as HTMLInputElement)?.value, validationRegex: '', - Mandatory: false, - Multiple: false, + MinChars: currentToggleStates?.minChars, + MaxChars:currentToggleStates?.maxChars, + Mandatory: currentToggleStates?.mandatory, + Multiple: currentToggleStates?.multiple, Unique: false, - NonLocalizable: false, - EmbedObject: false + NonLocalizable: currentToggleStates?.nonLocalizable, + EmbedObject: currentToggleStates?.embedObject, + EmbedObjects: embedObjectslabels, + MinRange: currentToggleStates?.minRange, + MaxRange: currentToggleStates?.maxRange, }, checkBoxChanged ); @@ -103,22 +125,35 @@ const AdvancePropertise = (props: SchemaProps) => { ...prevStates, [field]: value })); - + const currentToggleStates = { + ...toggleStates, + [field]: value, + }; + props?.updateFieldSettings( props?.rowId, { [field?.charAt(0)?.toUpperCase() + field?.slice(1)]: value, validationRegex: '', - Mandatory: false, - Multiple: false, + Mandatory: currentToggleStates?.mandatory, + Multiple: currentToggleStates?.multiple, Unique: false, - NonLocalizable: false, - EmbedObject: false + NonLocalizable: currentToggleStates?.nonLocalizable, + EmbedObject: currentToggleStates?.embedObject, + EmbedObjects : embedObjectslabels }, checkBoxChanged ); }; + useEffect(() => { + + if (ctValue && Array.isArray(ctValue)) { + const labels = ctValue.map((item) => item.label); + setEmbedObjectsLabels(labels); + } + }, [ctValue]); + // Option for content types const option = Array.isArray(contentTypes) ? contentTypes.map((option) => ({ label: option?.otherCmsTitle, value: option?.otherCmsTitle })) @@ -323,7 +358,18 @@ const AdvancePropertise = (props: SchemaProps) => {