Skip to content

Commit 756bd10

Browse files
authored
Merge pull request #579 from contentstack/feature/dropdown-field-choices
Feature/dropdown field choices
2 parents ab72957 + 19878a2 commit 756bd10

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

ui/src/components/ContentMapper/index.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,21 @@ const Fields: MappingFields = {
176176
options: {
177177
'Dropdown':'dropdown'
178178
},
179-
type: 'dropdown',
179+
type: '',
180180
},
181181
'radio': {
182-
label :'Select',
182+
label :'Radio',
183183
options: {
184-
'Select':'select'
184+
'Radio':'radio'
185185
},
186-
type: 'radio',
186+
type: '',
187187
},
188188
'checkbox': {
189-
label:'Select',
189+
label:'Checkbox',
190190
options: {
191-
'Select':'checkbox'
191+
'Checkbox':'checkbox'
192192
},
193-
type:'checkbox'
193+
type:''
194194
},
195195
'global_field':{
196196
label : 'Global',
@@ -1532,7 +1532,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
15321532
isDisabled: true
15331533
}
15341534
: (OptionsForRow?.length === 0 || (OptionsForRow?.length > 0 && OptionsForRow?.every((item)=>item?.isDisabled)
1535-
&& (!existingField[data?.uid]?.label || ! updatedExstingField[data?.uid]?.label ) ) || (OptionsForRow?.length > 0 && data?.contentstackFieldType === "dropdown"))
1535+
&& (!existingField[data?.uid]?.label || ! updatedExstingField[data?.uid]?.label ) ))
15361536
? {
15371537
label: Fields[data?.contentstackFieldType]?.label ?? 'No Option',
15381538
value: Fields[data?.contentstackFieldType]?.label ?? 'No Option',
@@ -1541,7 +1541,6 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
15411541
data?.contentstackFieldType === 'url' ||
15421542
data?.backupFieldType === "reference" ||
15431543
data?.contentstackFieldType === "global_field" ||
1544-
data?.contentstackFieldType === "dropdown" ||
15451544
data?.otherCmsType === undefined ||
15461545
data?.backupFieldType === 'app' ||
15471546
data?.backupFieldType === 'extension'

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,22 @@ const LoadStacks = (props: LoadFileFormatProps) => {
8484
const [isError, setIsError] = useState<boolean>(false);
8585
const [errorMessage, setErrorMessage] = useState<string>('');
8686
const [placeholder] = useState<string>('Select a stack');
87+
const [localePlaceholder, setlocalePlaceholder ] = useState<string>('Master Locale will be set after stack selection');
8788
const newMigrationDataRef = useRef(newMigrationData);
8889

8990
useEffect(() => {
9091
newMigrationDataRef.current = newMigrationData;
9192
}, [newMigrationData]);
9293

94+
useEffect(()=>{
95+
if(selectedStack?.value !== undefined && selectedStack?.master_locale){
96+
setlocalePlaceholder('')
97+
}
98+
else{
99+
setlocalePlaceholder('Master Locale will be set after stack selection');
100+
}
101+
},[selectedStack])
102+
93103
useEffect(() => {
94104
if (!isEmptyString(newMigrationData?.destination_stack?.selectedStack?.value)) {
95105
setSelectedStack(newMigrationData?.destination_stack?.selectedStack);
@@ -336,12 +346,8 @@ const LoadStacks = (props: LoadFileFormatProps) => {
336346
id="master_locale"
337347
aria-label="master_locale"
338348
version={'v2'}
339-
placeholder={
340-
selectedStack?.master_locale
341-
? ''
342-
: 'Master Locale will be set after stack selection'
343-
}
344-
value={selectedStack?.master_locale}
349+
placeholder={localePlaceholder}
350+
value={selectedStack?.value !== undefined ? selectedStack?.master_locale : ''}
345351
width="600px"
346352
className="orgInput"
347353
isReadOnly

upload-api/migration-sitecore/libs/contenttypes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ const groupFlat = (data, item) => {
372372
contentstackField: item?.meta?.name,
373373
contentstackFieldUid: uidCorrector({ uid: item?.meta?.key }),
374374
contentstackFieldType: 'group',
375-
backupFieldType: 'group'
375+
backupFieldType: 'group',
376+
backupFieldUid: uidCorrector({ uid: item?.meta?.key })
376377
};
377378
flat?.push(group);
378379
data?.schema?.forEach((element) => {

0 commit comments

Comments
 (0)