You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2022/10/13 09:54:59 UTC
[incubator-devlake] branch main updated: fix(config-ui): transformation not updating correctly when switching boards (#3297)
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new bc74e44b fix(config-ui): transformation not updating correctly when switching boards (#3297)
bc74e44b is described below
commit bc74e44b917cdb2a08397ffc848f88640ae2e64a
Author: 青湛 <0x...@gmail.com>
AuthorDate: Thu Oct 13 17:54:54 2022 +0800
fix(config-ui): transformation not updating correctly when switching boards (#3297)
---
config-ui/src/pages/configure/settings/jira.jsx | 73 +++++++++----------------
1 file changed, 26 insertions(+), 47 deletions(-)
diff --git a/config-ui/src/pages/configure/settings/jira.jsx b/config-ui/src/pages/configure/settings/jira.jsx
index 90dacf79..2ec55e15 100644
--- a/config-ui/src/pages/configure/settings/jira.jsx
+++ b/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.Bug))
+ .reduce((c, p) => ({ ...c, ...p }), {})
+ }))
+ }, [typeMappingBug])
useEffect(() => {
- console.log('>> CONN SETTINGS OBJECT ', connection)
- if (connection && connection.id) {
- // Parse Type Mappings (V2)
- // setStatusMappings([])
- }
- }, [connection])
+ setTypeMappingAll((ma) => ({
+ ...ma,
+ ...(typeMappingIncident || [])
+ .map((r) => createTypeMapObject(r.value, MAPPING_TYPES.Incident))
+ .reduce((c, p) => ({ ...c, ...p }), {})
+ }))
+ }, [typeMappingIncident])
+
+ useEffect(() => {
+ setTypeMappingAll((ma) => ({
+ ...ma,
+ ...(typeMappingRequirement || [])
+ .map((r) => createTypeMapObject(r.value, MAPPING_TYPES.Requirement))
+ .reduce((c, p) => ({ ...c, ...p }), {})
+ }))
+ }, [typeMappingRequirement])
useEffect(() => {
if (configuredBoard?.id) {
+ setTypeMappingAll({})
setTypeMappingRequirement(requirementTags[configuredBoard?.id])
onSettingsChange(
{ requirementTags: requirementTags[configuredBoard?.id] },
@@ -239,6 +216,7 @@ export default function JiraSettings(props) {
useEffect(() => {
if (configuredBoard?.id) {
+ setTypeMappingAll({})
setTypeMappingBug(bugTags[configuredBoard?.id])
onSettingsChange(
{ bugTags: bugTags[configuredBoard?.id] },
@@ -249,6 +227,7 @@ export default function JiraSettings(props) {
useEffect(() => {
if (configuredBoard?.id) {
+ setTypeMappingAll({})
setTypeMappingIncident(incidentTags[configuredBoard?.id])
onSettingsChange(
{ incidentTags: incidentTags[configuredBoard?.id] },