You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/22 06:50:17 UTC

[GitHub] [incubator-devlake] mintsweet opened a new pull request, #3165: fix(config-ui): adjust some content about dora

mintsweet opened a new pull request, #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165

   ### ⚠️ Pre Checklist
   
   > Please complete _ALL_ items in this checklist, and remove before submitting
   
   - [ ] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).
   - [ ] I have added relevant tests.
   - [ ] I have added relevant documentation.
   - [ ] I will add labels to the PR, such as `pr-type/bug-fix`, `pr-type/feature-development`, etc.
   
   
   
   # Summary
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   1. Added environment mapping field.
   2. Adjust the default value of the dora deployment field.
   
   ### Does this close any open issues?
   none.
   
   ### Screenshots
   ![screenshot-20220922-144912](https://user-images.githubusercontent.com/37237996/191677655-9650bc13-d206-4e5e-b393-e5a741370b06.png)
   
   
   ### Other Information
   none.
   


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977765583


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -202,95 +190,19 @@ const Deployment = (props) => {
                 <InputGroup
                   id='deploy-tag-production'
                   placeholder='(?i)deploy'
-                  value={transformation?.productionPattern}
+                  value={transformation?.deploymentPattern}
                   onChange={(e) =>
                     onSettingsChange(
-                      { productionPattern: e.target.value },
+                      { deploymentPattern: e.target.value },
                       entityIdKey
                     )
                   }
                   disabled={isSaving}
                   className='input'
                   maxLength={255}
-                  rightElement={
-                    isDeployTagEmpty ? (
-                      <Tooltip
-                        intent={Intent.PRIMARY}
-                        content='Deployment Tag RegEx required'
-                      >
-                        <Icon
-                          icon='warning-sign'
-                          color={Colors.GRAY3}
-                          size={12}
-                          style={{ margin: '8px' }}
-                        />
-                      </Tooltip>
-                    ) : null
-                  }
-                  required
-                />
-              </FormGroup>
-            </div>
-            {/* <div className='formContainer'>

Review Comment:
   It's fine to leave it stripped for now.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977757181


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -202,95 +190,19 @@ const Deployment = (props) => {
                 <InputGroup
                   id='deploy-tag-production'
                   placeholder='(?i)deploy'
-                  value={transformation?.productionPattern}
+                  value={transformation?.deploymentPattern}
                   onChange={(e) =>
                     onSettingsChange(
-                      { productionPattern: e.target.value },
+                      { deploymentPattern: e.target.value },
                       entityIdKey
                     )
                   }
                   disabled={isSaving}
                   className='input'
                   maxLength={255}
-                  rightElement={
-                    isDeployTagEmpty ? (
-                      <Tooltip
-                        intent={Intent.PRIMARY}
-                        content='Deployment Tag RegEx required'
-                      >
-                        <Icon
-                          icon='warning-sign'
-                          color={Colors.GRAY3}
-                          size={12}
-                          style={{ margin: '8px' }}
-                        />
-                      </Tooltip>
-                    ) : null
-                  }
-                  required
-                />
-              </FormGroup>
-            </div>
-            {/* <div className='formContainer'>

Review Comment:
   I would normally delete it as well, but this may save time in the future from having to re-create the inputs again. 



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] abeizn merged pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
abeizn merged PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977672207


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -15,76 +15,45 @@
  * limitations under the License.
  *
  */
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import React, { useState, useEffect } from 'react'
 import {
   Intent,
   FormGroup,
   RadioGroup,
   InputGroup,
   Radio,
-  Tag,
-  Icon,
-  Colors,
-  Tooltip
+  Tag
 } from '@blueprintjs/core'
 import { Providers, ProviderLabels } from '@/data/Providers'
+
 const Deployment = (props) => {
   const {
-    connection,
     provider,
     transformation,
-    configuredProject,
-    configuredBoard,
     entityIdKey,
-    entities = [],
     isSaving = false,
     onSettingsChange = () => {}
   } = props
 
-  const [deployTag, setDeployTag] = useState(
-    transformation?.productionPattern || ''
-  )
-  const [enableDeployTag, setEnableDeployTag] = useState(
-    [
-      transformation?.productionPattern
-      // transformation?.stagingPattern,
-      // transformation?.testingPattern
-    ].some((t) => t && t !== '')
-      ? 1
-      : 0
-  )
-  const isDeployTagEmpty = useMemo(
-    () =>
-      enableDeployTag &&
-      (transformation?.productionPattern === '' ||
-        !transformation?.productionPattern),
-    [enableDeployTag, transformation?.productionPattern]
-  )
+  const [selectValue, setSelectValue] = useState(1)
 
-  const clearDeploymentTags = useCallback(
-    (deploymentOption) => {
-      if (entityIdKey && deploymentOption === 0) {
-        onSettingsChange({ productionPattern: '' }, entityIdKey)
-        // onSettingsChange({ stagingPattern: '' }, entityIdKey)
-        // onSettingsChange({ testingPattern: '' }, entityIdKey)
-      }
-    },
-    [entityIdKey, onSettingsChange]
-  )
+  useEffect(() => {
+    setSelectValue(
+      transformation?.deploymentPattern ||
+        transformation?.deploymentPattern === ''
+        ? 1
+        : 0
+    )
+  }, [transformation?.deploymentPattern])
 
-  const handleDeploymentPreference = useCallback(

Review Comment:
   @mintsweet This handler should not have been refactored, with these changes you are now introducing `undefined` and `[object]` entries into the main Transformations stack.
   
   <img width="1223" alt="Screen Shot 2022-09-22 at 9 40 03 AM" src="https://user-images.githubusercontent.com/1742233/191762885-4c261760-816a-4250-a0b9-29aac2b54406.png">
   
   



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977755303


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -15,76 +15,45 @@
  * limitations under the License.
  *
  */
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import React, { useState, useEffect } from 'react'
 import {
   Intent,
   FormGroup,
   RadioGroup,
   InputGroup,
   Radio,
-  Tag,
-  Icon,
-  Colors,
-  Tooltip
+  Tag
 } from '@blueprintjs/core'
 import { Providers, ProviderLabels } from '@/data/Providers'
+
 const Deployment = (props) => {
   const {
-    connection,
     provider,
     transformation,
-    configuredProject,
-    configuredBoard,
     entityIdKey,
-    entities = [],
     isSaving = false,
     onSettingsChange = () => {}
   } = props
 
-  const [deployTag, setDeployTag] = useState(
-    transformation?.productionPattern || ''
-  )
-  const [enableDeployTag, setEnableDeployTag] = useState(
-    [
-      transformation?.productionPattern
-      // transformation?.stagingPattern,
-      // transformation?.testingPattern
-    ].some((t) => t && t !== '')
-      ? 1
-      : 0
-  )
-  const isDeployTagEmpty = useMemo(
-    () =>
-      enableDeployTag &&
-      (transformation?.productionPattern === '' ||
-        !transformation?.productionPattern),
-    [enableDeployTag, transformation?.productionPattern]
-  )
+  const [selectValue, setSelectValue] = useState(1)
 
-  const clearDeploymentTags = useCallback(
-    (deploymentOption) => {
-      if (entityIdKey && deploymentOption === 0) {
-        onSettingsChange({ productionPattern: '' }, entityIdKey)
-        // onSettingsChange({ stagingPattern: '' }, entityIdKey)
-        // onSettingsChange({ testingPattern: '' }, entityIdKey)
-      }
-    },
-    [entityIdKey, onSettingsChange]
-  )
+  useEffect(() => {
+    setSelectValue(
+      transformation?.deploymentPattern ||
+        transformation?.deploymentPattern === ''
+        ? 1
+        : 0
+    )
+  }, [transformation?.deploymentPattern])
 
-  const handleDeploymentPreference = useCallback(

Review Comment:
   This is the result of asking the backend, deployPattern is empty by default, which means option 1, and option 2 does not need to pass deployPattern, so I set it to undefined.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977753125


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -202,95 +190,19 @@ const Deployment = (props) => {
                 <InputGroup
                   id='deploy-tag-production'
                   placeholder='(?i)deploy'
-                  value={transformation?.productionPattern}
+                  value={transformation?.deploymentPattern}
                   onChange={(e) =>
                     onSettingsChange(
-                      { productionPattern: e.target.value },
+                      { deploymentPattern: e.target.value },
                       entityIdKey
                     )
                   }
                   disabled={isSaving}
                   className='input'
                   maxLength={255}
-                  rightElement={
-                    isDeployTagEmpty ? (
-                      <Tooltip
-                        intent={Intent.PRIMARY}
-                        content='Deployment Tag RegEx required'
-                      >
-                        <Icon
-                          icon='warning-sign'
-                          color={Colors.GRAY3}
-                          size={12}
-                          style={{ margin: '8px' }}
-                        />
-                      </Tooltip>
-                    ) : null
-                  }
-                  required
-                />
-              </FormGroup>
-            </div>
-            {/* <div className='formContainer'>

Review Comment:
   Sorry, I am a little bit of code cleanliness, I want to delete the commented content, I don't know if it will be used again, I will restore it.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
mintsweet commented on PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#issuecomment-1255142412

   @e2corporation Today's teammates are anxious to test, so this PR has not been reviewed by you, I am very sorry.


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977673239


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -15,76 +15,45 @@
  * limitations under the License.
  *
  */
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import React, { useState, useEffect } from 'react'
 import {
   Intent,
   FormGroup,
   RadioGroup,
   InputGroup,
   Radio,
-  Tag,
-  Icon,
-  Colors,
-  Tooltip
+  Tag
 } from '@blueprintjs/core'
 import { Providers, ProviderLabels } from '@/data/Providers'
+
 const Deployment = (props) => {
   const {
-    connection,
     provider,
     transformation,
-    configuredProject,
-    configuredBoard,
     entityIdKey,
-    entities = [],
     isSaving = false,
     onSettingsChange = () => {}
   } = props
 
-  const [deployTag, setDeployTag] = useState(
-    transformation?.productionPattern || ''
-  )
-  const [enableDeployTag, setEnableDeployTag] = useState(
-    [
-      transformation?.productionPattern
-      // transformation?.stagingPattern,
-      // transformation?.testingPattern
-    ].some((t) => t && t !== '')
-      ? 1
-      : 0
-  )
-  const isDeployTagEmpty = useMemo(
-    () =>
-      enableDeployTag &&
-      (transformation?.productionPattern === '' ||
-        !transformation?.productionPattern),
-    [enableDeployTag, transformation?.productionPattern]
-  )
+  const [selectValue, setSelectValue] = useState(1)
 
-  const clearDeploymentTags = useCallback(
-    (deploymentOption) => {
-      if (entityIdKey && deploymentOption === 0) {
-        onSettingsChange({ productionPattern: '' }, entityIdKey)
-        // onSettingsChange({ stagingPattern: '' }, entityIdKey)
-        // onSettingsChange({ testingPattern: '' }, entityIdKey)
-      }
-    },
-    [entityIdKey, onSettingsChange]
-  )
+  useEffect(() => {
+    setSelectValue(
+      transformation?.deploymentPattern ||
+        transformation?.deploymentPattern === ''
+        ? 1
+        : 0
+    )
+  }, [transformation?.deploymentPattern])
 
-  const handleDeploymentPreference = useCallback(
-    (deployOptionState) => {
-      setEnableDeployTag(deployOptionState)
-      switch (deployOptionState) {
-        case 0:
-          clearDeploymentTags(deployOptionState)
-          break
-        case 1:
-          break
-      }
-    },
-    [clearDeploymentTags]
-  )
+  const handleChangeSelectValue = (sv) => {
+    if (entityIdKey && sv === 0) {
+      onSettingsChange({ deploymentPattern: undefined }, entityIdKey)

Review Comment:
   `deploymentPattern` is a string field that is bound to the input, it should never be set or initialized to undefined.
   
   <img width="1186" alt="Screen Shot 2022-09-22 at 9 38 57 AM" src="https://user-images.githubusercontent.com/1742233/191763108-6e286139-bb0e-4858-8896-725e9855e556.png">
   



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#issuecomment-1255148557

   > @e2corporation Today's teammates are anxious to test, so this PR has not been reviewed by you, I am very sorry.
   
   I understand, I am just being extra cautious as we are about to freeze so I don't want to introduce last minute bugs. We should have time to resolve any issues during our testing window.


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977666790


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -202,95 +190,19 @@ const Deployment = (props) => {
                 <InputGroup
                   id='deploy-tag-production'
                   placeholder='(?i)deploy'
-                  value={transformation?.productionPattern}
+                  value={transformation?.deploymentPattern}
                   onChange={(e) =>
                     onSettingsChange(
-                      { productionPattern: e.target.value },
+                      { deploymentPattern: e.target.value },
                       entityIdKey
                     )
                   }
                   disabled={isSaving}
                   className='input'
                   maxLength={255}
-                  rightElement={
-                    isDeployTagEmpty ? (
-                      <Tooltip
-                        intent={Intent.PRIMARY}
-                        content='Deployment Tag RegEx required'
-                      >
-                        <Icon
-                          icon='warning-sign'
-                          color={Colors.GRAY3}
-                          size={12}
-                          style={{ margin: '8px' }}
-                        />
-                      </Tooltip>
-                    ) : null
-                  }
-                  required
-                />
-              </FormGroup>
-            </div>
-            {/* <div className='formContainer'>

Review Comment:
   @mintsweet These tags are supposed to be re-activated in the future that's why this code was commented and left in tact. Why was it removed?



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977759537


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -15,76 +15,45 @@
  * limitations under the License.
  *
  */
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import React, { useState, useEffect } from 'react'
 import {
   Intent,
   FormGroup,
   RadioGroup,
   InputGroup,
   Radio,
-  Tag,
-  Icon,
-  Colors,
-  Tooltip
+  Tag
 } from '@blueprintjs/core'
 import { Providers, ProviderLabels } from '@/data/Providers'
+
 const Deployment = (props) => {
   const {
-    connection,
     provider,
     transformation,
-    configuredProject,
-    configuredBoard,
     entityIdKey,
-    entities = [],
     isSaving = false,
     onSettingsChange = () => {}
   } = props
 
-  const [deployTag, setDeployTag] = useState(
-    transformation?.productionPattern || ''
-  )
-  const [enableDeployTag, setEnableDeployTag] = useState(
-    [
-      transformation?.productionPattern
-      // transformation?.stagingPattern,
-      // transformation?.testingPattern
-    ].some((t) => t && t !== '')
-      ? 1
-      : 0
-  )
-  const isDeployTagEmpty = useMemo(
-    () =>
-      enableDeployTag &&
-      (transformation?.productionPattern === '' ||
-        !transformation?.productionPattern),
-    [enableDeployTag, transformation?.productionPattern]
-  )
+  const [selectValue, setSelectValue] = useState(1)
 
-  const clearDeploymentTags = useCallback(
-    (deploymentOption) => {
-      if (entityIdKey && deploymentOption === 0) {
-        onSettingsChange({ productionPattern: '' }, entityIdKey)
-        // onSettingsChange({ stagingPattern: '' }, entityIdKey)
-        // onSettingsChange({ testingPattern: '' }, entityIdKey)
-      }
-    },
-    [entityIdKey, onSettingsChange]
-  )
+  useEffect(() => {
+    setSelectValue(
+      transformation?.deploymentPattern ||
+        transformation?.deploymentPattern === ''
+        ? 1
+        : 0
+    )
+  }, [transformation?.deploymentPattern])
 
-  const handleDeploymentPreference = useCallback(

Review Comment:
   backend will treat `deploymenPattern === ""` differently than it being missing from the request payload? It should be safe to pass deploymentPattern as empty string if its not being used. General rule is, if a property is bound to a text input like this it should not have an undefined value.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r977756646


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -15,76 +15,45 @@
  * limitations under the License.
  *
  */
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import React, { useState, useEffect } from 'react'
 import {
   Intent,
   FormGroup,
   RadioGroup,
   InputGroup,
   Radio,
-  Tag,
-  Icon,
-  Colors,
-  Tooltip
+  Tag
 } from '@blueprintjs/core'
 import { Providers, ProviderLabels } from '@/data/Providers'
+
 const Deployment = (props) => {
   const {
-    connection,
     provider,
     transformation,
-    configuredProject,
-    configuredBoard,
     entityIdKey,
-    entities = [],
     isSaving = false,
     onSettingsChange = () => {}
   } = props
 
-  const [deployTag, setDeployTag] = useState(
-    transformation?.productionPattern || ''
-  )
-  const [enableDeployTag, setEnableDeployTag] = useState(
-    [
-      transformation?.productionPattern
-      // transformation?.stagingPattern,
-      // transformation?.testingPattern
-    ].some((t) => t && t !== '')
-      ? 1
-      : 0
-  )
-  const isDeployTagEmpty = useMemo(
-    () =>
-      enableDeployTag &&
-      (transformation?.productionPattern === '' ||
-        !transformation?.productionPattern),
-    [enableDeployTag, transformation?.productionPattern]
-  )
+  const [selectValue, setSelectValue] = useState(1)
 
-  const clearDeploymentTags = useCallback(
-    (deploymentOption) => {
-      if (entityIdKey && deploymentOption === 0) {
-        onSettingsChange({ productionPattern: '' }, entityIdKey)
-        // onSettingsChange({ stagingPattern: '' }, entityIdKey)
-        // onSettingsChange({ testingPattern: '' }, entityIdKey)
-      }
-    },
-    [entityIdKey, onSettingsChange]
-  )
+  useEffect(() => {
+    setSelectValue(
+      transformation?.deploymentPattern ||
+        transformation?.deploymentPattern === ''
+        ? 1
+        : 0
+    )
+  }, [transformation?.deploymentPattern])
 
-  const handleDeploymentPreference = useCallback(
-    (deployOptionState) => {
-      setEnableDeployTag(deployOptionState)
-      switch (deployOptionState) {
-        case 0:
-          clearDeploymentTags(deployOptionState)
-          break
-        case 1:
-          break
-      }
-    },
-    [clearDeploymentTags]
-  )
+  const handleChangeSelectValue = (sv) => {
+    if (entityIdKey && sv === 0) {
+      onSettingsChange({ deploymentPattern: undefined }, entityIdKey)

Review Comment:
   delopyPattern does not need to pass any value to the backend when option 2, so I set it to undefined.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3165: fix(config-ui): adjust some content about dora

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3165:
URL: https://github.com/apache/incubator-devlake/pull/3165#discussion_r979577208


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -15,76 +15,45 @@
  * limitations under the License.
  *
  */
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import React, { useState, useEffect } from 'react'
 import {
   Intent,
   FormGroup,
   RadioGroup,
   InputGroup,
   Radio,
-  Tag,
-  Icon,
-  Colors,
-  Tooltip
+  Tag
 } from '@blueprintjs/core'
 import { Providers, ProviderLabels } from '@/data/Providers'
+
 const Deployment = (props) => {
   const {
-    connection,
     provider,
     transformation,
-    configuredProject,
-    configuredBoard,
     entityIdKey,
-    entities = [],
     isSaving = false,
     onSettingsChange = () => {}
   } = props
 
-  const [deployTag, setDeployTag] = useState(
-    transformation?.productionPattern || ''
-  )
-  const [enableDeployTag, setEnableDeployTag] = useState(
-    [
-      transformation?.productionPattern
-      // transformation?.stagingPattern,
-      // transformation?.testingPattern
-    ].some((t) => t && t !== '')
-      ? 1
-      : 0
-  )
-  const isDeployTagEmpty = useMemo(
-    () =>
-      enableDeployTag &&
-      (transformation?.productionPattern === '' ||
-        !transformation?.productionPattern),
-    [enableDeployTag, transformation?.productionPattern]
-  )
+  const [selectValue, setSelectValue] = useState(1)
 
-  const clearDeploymentTags = useCallback(
-    (deploymentOption) => {
-      if (entityIdKey && deploymentOption === 0) {
-        onSettingsChange({ productionPattern: '' }, entityIdKey)
-        // onSettingsChange({ stagingPattern: '' }, entityIdKey)
-        // onSettingsChange({ testingPattern: '' }, entityIdKey)
-      }
-    },
-    [entityIdKey, onSettingsChange]
-  )
+  useEffect(() => {
+    setSelectValue(
+      transformation?.deploymentPattern ||
+        transformation?.deploymentPattern === ''
+        ? 1
+        : 0
+    )
+  }, [transformation?.deploymentPattern])
 
-  const handleDeploymentPreference = useCallback(

Review Comment:
   I will confirm this with my back-end colleagues today to ensure that no problems will be introduced.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org