Skip to content
Merged

Dev #103

Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
84dd11c
add trim false in case of tfa token in login api
shristi-sinha May 7, 2024
c15d573
Merge pull request #93 from contentstack/feature/tfa-token-validation
umeshmore45 May 7, 2024
bb54887
add advanced field in mapper model
shristi-sinha May 7, 2024
091b2b1
Merge pull request #94 from contentstack/feature/add-mapper-json
shreyasBhoyar May 7, 2024
bae09bf
code refactor
sayalijoshi27 May 7, 2024
647ca18
solved locale issue
snehalsankhe May 8, 2024
3dbe63c
add validation for error handling
snehalsankhe May 9, 2024
a361b9f
Merge pull request #95 from contentstack/cmg-99-locales-search
AishDani May 9, 2024
53d848b
create a function to get all locals of particular stack and add that…
shristi-sinha May 9, 2024
06dcd46
Merge pull request #96 from contentstack/feature/get-all-locale
shreyasBhoyar May 9, 2024
d65aa5f
Solved bugs
snehalsankhe May 9, 2024
8513574
Merge pull request #97 from contentstack/cmg-99-locales-search
sayalijoshi27 May 9, 2024
d115a48
[CMG-103] - UI for Mapping with group field
sayalijoshi27 May 9, 2024
1a6e4fb
Code refactored: resolved PR comments
sayalijoshi27 May 10, 2024
90700da
Merge pull request #98 from contentstack/feature/CMG-103
AishDani May 10, 2024
ffc12dc
Merge branch 'dev' of https://github.com/contentstack/migration-v2-no…
sayalijoshi27 May 10, 2024
2953148
feat:integrated advanced propertise with backend
AishDani May 10, 2024
3df80e2
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani May 10, 2024
02f5f32
refactor:resized modal size
AishDani May 10, 2024
0bad06d
refactor:changed library sequences
AishDani May 10, 2024
b1565f8
Merge pull request #99 from contentstack/feature/project-dashboard
sayalijoshi27 May 10, 2024
3bd3583
[CMG-102] - UI for for On row uncheck make isdeleted value to true
sayalijoshi27 May 10, 2024
f4f8ded
Content mapper merged
sayalijoshi27 May 10, 2024
ad7d166
Removed console
sayalijoshi27 May 10, 2024
b978606
Merge pull request #100 from contentstack/feature/CMG-102
AishDani May 10, 2024
71142e7
refactor:resolved project name error showing on tab change
AishDani May 10, 2024
3040039
[CMG-105] - UI - Disable Title and Url fields from being mapped
sayalijoshi27 May 10, 2024
0c869ce
Merge pull request #101 from contentstack/feature/project-dashboard
sayalijoshi27 May 10, 2024
f0af2e3
Merge pull request #102 from contentstack/feature/CMG-102
snehalsankhe May 13, 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
63 changes: 56 additions & 7 deletions ui/src/components/AdvancePropertise/index.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,72 @@
import { useState } from 'react';

import {
ModalBody,
ModalHeader,
FieldLabel,
TextInput,
ToggleSwitch
ToggleSwitch,
Tooltip
} from '@contentstack/venus-components';

import './index.scss';


export interface SchemaProps {
fieldtype: string;
value: any;
rowId: string;
updateFieldSettings:(rowId:string, value:any, checkBoxChanged:boolean)=> void;
isLocalised:boolean;
closeModal: () => void;
data:any
}
const AdvancePropertise = (props: SchemaProps) => {
const AdvancePropertise = (props: SchemaProps) => {


const [toggleStates, setToggleStates] = useState({
validationRegex: props?.value?.ValidationRegex,
mandatory: props?.value?.Mandatory,
multiple: props?.value?.Multiple,
unique: props?.value?.Unique,
nonLocalizable: props?.value?.NonLocalizable
});

const handleToggleChange = (field: string, value: boolean, checkBoxChanged: boolean) => {

setToggleStates(prevStates => ({
...prevStates,
[field]: value
}));

props?.updateFieldSettings(props?.rowId, {[field?.charAt(0)?.toUpperCase() + field?.slice(1)]: value}, checkBoxChanged);
};

const handleOnChange = ( field: string, event: any, checkBoxChanged: boolean) => {
setToggleStates(prevStates => ({
...prevStates,
[field]: event?.target?.value
}));

props?.updateFieldSettings(props?.rowId, {[field?.charAt(0)?.toUpperCase() + field?.slice(1)]: event?.target?.value}, checkBoxChanged);

}


return (
<>
<ModalHeader title={`${props.fieldtype} propertise`} closeModal={props.closeModal} />
<ModalHeader title={`${props?.fieldtype} propertise`} closeModal={props?.closeModal} />
<ModalBody>
<FieldLabel htmlFor="someInput" version="v2">
Validation (Regex)
</FieldLabel>
<TextInput
className="validation-input"
type="text"
value={toggleStates?.validationRegex}
placeholder="Enter value"
version="v2"
onChange={(e:any)=> handleOnChange("validationRegex",e, true)}
/>
<FieldLabel className="option-label" htmlFor="someInput" version="v2">
Options
Expand All @@ -36,26 +76,35 @@ const AdvancePropertise = (props: SchemaProps) => {
label="Mandatory"
labelColor="primary"
labelPosition="right"
checked={props?.value?.mandatory}
checked={toggleStates?.mandatory}
onChange={(e:any) => handleToggleChange("mandatory" , e?.target?.checked, true)}
/>
<ToggleSwitch
label="Multiple"
labelColor="primary"
labelPosition="right"
checked={props?.value?.multiple}
checked={toggleStates?.multiple}
onChange={(e:any) => handleToggleChange("multiple" ,e?.target?.checked, true)}
/>
<ToggleSwitch
label="Unique"
labelColor="primary"
labelPosition="right"
checked={props?.value?.unique}
checked={toggleStates?.unique}
onChange={(e:any) => handleToggleChange("unique" , e?.target?.checked,true)}
/>
<Tooltip content='Available only if there are multiple languages in your stack' position='top' disabled={props?.isLocalised}>
<ToggleSwitch
id="disabled"
disabled={ ! props?.isLocalised}
label="Non-localizable"
labelColor="primary"
labelPosition="right"
checked={props?.value?.non_localizable}
checked={toggleStates?.nonLocalizable}
onChange={(e:any) => handleToggleChange("nonLocalizable" , e?.target?.checked,true)}
/>

</Tooltip>
<p className="non-localizable-message">
If enabled, editing this field is restricted in localized entries. The field will use
the value of the master-language entry in all localized entries.
Expand Down
7 changes: 4 additions & 3 deletions ui/src/components/Common/AddStack/addStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const AddStack = (props: any): JSX.Element => {
const [addStackCMSData, setAddStackCMSData] = useState<AddStackCMSData>(defaultAddStackCMSData);
const onSubmit = async (formData: any) => {
setIsProcessing(true);
const resp = await props.onSubmit({
const resp = await props?.onSubmit({
name: formData?.name || props?.defaultValues?.name,
description: formData?.description || props?.defaultValues?.description,
locale: formData?.locale?.value || props?.defaultValues?.locale
Expand All @@ -55,7 +55,7 @@ const AddStack = (props: any): JSX.Element => {
notificationContent: { text: 'Stack created successfully' },
type: 'success'
});
props.closeModal();
props?.closeModal();
} else {
Notification({ notificationContent: { text: 'Failed to create the stack' }, type: 'error' });
}
Expand Down Expand Up @@ -88,7 +88,8 @@ const AddStack = (props: any): JSX.Element => {
uid: key,
label: response?.data?.locales[key],
value: key,
locale: key,
master_locale: key,
locales:[],
created_at: key
}))
: [];
Expand Down
10 changes: 9 additions & 1 deletion ui/src/components/ContentMapper/contentMapper.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ interface mapDataType {
contentTypes: ContentType[];
projectId: string;
}
interface Advanced {
ValidationRegex: string,
mandatory:boolean,
multiple:boolean,
unique:boolean,
nonLocalizable:boolean
}
export interface ContentMapperType {
content_types_heading?: string;
cta: CTA;
Expand All @@ -24,7 +31,7 @@ export interface ContentstackFields {

export interface FieldTypes {
label: string;
value: string;
value: any;
}
export interface TableTypes {
sortBy: any;
Expand Down Expand Up @@ -57,6 +64,7 @@ export interface FieldMapType {
uid: string;
id: string;
_invalid?: boolean;
advanced:Advanced
}

export interface ItemStatus {
Expand Down
Loading