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