e2corporation commented on code in PR #3297:
URL: https://github.com/apache/incubator-devlake/pull/3297#discussion_r984530501
##########
config-ui/src/pages/configure/settings/jira.jsx:
##########
@@ -177,58 +177,35 @@ export default function JiraSettings(props) {
}, [typeMappingAll, onSettingsChange, configuredBoard?.id])
useEffect(() => {
- if (typeMappingBug && typeMappingIncident && typeMappingRequirement) {
- const RequirementMappings =
- typeMappingRequirement !== ''
- ? typeMappingRequirement.map((r) =>
- createTypeMapObject(r.value, MAPPING_TYPES.Requirement)
- )
- : []
- const IncidentMappings =
- typeMappingIncident !== ''
- ? typeMappingIncident.map((i) =>
- createTypeMapObject(i.value, MAPPING_TYPES.Incident)
- )
- : []
- const BugMappings =
- typeMappingBug !== ''
- ? typeMappingBug.map((b) =>
- createTypeMapObject(b.value, MAPPING_TYPES.Bug)
- )
- : []
- const CombinedMappings = [
- ...RequirementMappings,
- ...IncidentMappings,
- ...BugMappings
- ].filter((m) => m !== null)
- const MappingTypeObjects = CombinedMappings.reduce((pV, cV) => {
- return { ...cV, ...pV }
- }, {})
- setTypeMappingAll(MappingTypeObjects)
- console.log(
- '>> INCIDENT TYPE MAPPING OBJECTS....',
- RequirementMappings,
- IncidentMappings,
- BugMappings
- )
- console.log('>> ALL MAPPINGS COMBINED...', CombinedMappings)
- console.log(
- '>> FINAL MAPPING OBJECTS FOR API REQUEST...',
- MappingTypeObjects
- )
- }
- }, [typeMappingBug, typeMappingIncident, typeMappingRequirement])
+ setTypeMappingAll((ma) => ({
+ ...ma,
+ ...(typeMappingBug || [])
+ .map((r) => createTypeMapObject(r.value, MAPPING_TYPES.Requirement))
Review Comment:
Is this supposed to be MAPPING_TYPES.Bug ?
##########
config-ui/src/pages/configure/settings/jira.jsx:
##########
@@ -177,58 +177,35 @@ export default function JiraSettings(props) {
}, [typeMappingAll, onSettingsChange, configuredBoard?.id])
useEffect(() => {
- if (typeMappingBug && typeMappingIncident && typeMappingRequirement) {
- const RequirementMappings =
- typeMappingRequirement !== ''
- ? typeMappingRequirement.map((r) =>
- createTypeMapObject(r.value, MAPPING_TYPES.Requirement)
- )
- : []
- const IncidentMappings =
- typeMappingIncident !== ''
- ? typeMappingIncident.map((i) =>
- createTypeMapObject(i.value, MAPPING_TYPES.Incident)
- )
- : []
- const BugMappings =
- typeMappingBug !== ''
- ? typeMappingBug.map((b) =>
- createTypeMapObject(b.value, MAPPING_TYPES.Bug)
- )
- : []
- const CombinedMappings = [
- ...RequirementMappings,
- ...IncidentMappings,
- ...BugMappings
- ].filter((m) => m !== null)
- const MappingTypeObjects = CombinedMappings.reduce((pV, cV) => {
- return { ...cV, ...pV }
- }, {})
- setTypeMappingAll(MappingTypeObjects)
- console.log(
- '>> INCIDENT TYPE MAPPING OBJECTS....',
- RequirementMappings,
- IncidentMappings,
- BugMappings
- )
- console.log('>> ALL MAPPINGS COMBINED...', CombinedMappings)
- console.log(
- '>> FINAL MAPPING OBJECTS FOR API REQUEST...',
- MappingTypeObjects
- )
- }
- }, [typeMappingBug, typeMappingIncident, typeMappingRequirement])
+ setTypeMappingAll((ma) => ({
+ ...ma,
+ ...(typeMappingBug || [])
+ .map((r) => createTypeMapObject(r.value, MAPPING_TYPES.Requirement))
Review Comment:
Is this supposed to be `MAPPING_TYPES.Bug` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]