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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]