Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix [UI] fix "findDOMNode is deprecated" error across the app 1.9.0 #3152

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import React from 'react'
import React, { useRef } from 'react'
import PropTypes from 'prop-types'
import { CSSTransition } from 'react-transition-group'
import classNames from 'classnames'
Expand Down Expand Up @@ -96,6 +96,9 @@ const FeatureSetsPanelTargetStoreView = ({
triggerPartitionCheckbox,
validation
}) => {
const offlineFieldsRef = useRef(null)
const externalOfflineFieldsRef = useRef(null)

return (
<div className="feature-set-panel__item new-item-side-panel__item target-store">
<FeatureSetsPanelSection title="Target store">
Expand Down Expand Up @@ -322,12 +325,14 @@ const FeatureSetsPanelTargetStoreView = ({
{showAdvanced.parquet ? 'Hide advanced' : 'Show advanced'}
</span>
<CSSTransition
nodeRef={offlineFieldsRef}
in={showAdvanced.parquet}
timeout={200}
classNames="fade"
unmountOnExit
>
<PartitionFields
ref={offlineFieldsRef}
data={data.parquet}
handlePartitionRadioButtonClick={value =>
handlePartitionRadioButtonClick(value, PARQUET)
Expand Down Expand Up @@ -430,12 +435,14 @@ const FeatureSetsPanelTargetStoreView = ({
{showAdvanced.externalOffline ? 'Hide advanced' : 'Show advanced'}
</span>
<CSSTransition
nodeRef={externalOfflineFieldsRef}
in={showAdvanced.externalOffline}
timeout={200}
classNames="fade"
unmountOnExit
>
<PartitionFields
ref={externalOfflineFieldsRef}
data={data.externalOffline}
handlePartitionRadioButtonClick={value =>
handlePartitionRadioButtonClick(value, EXTERNAL_OFFLINE)
Expand Down
177 changes: 91 additions & 86 deletions src/elements/PartitionFields/PartitionFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,95 +33,100 @@ import {
timePartitioningGranularityOptions
} from '../../components/FeatureSetsPanel/FeatureSetsPanelTargetStore/featureSetsPanelTargetStore.util'

const PartitionFields = ({
data,
handlePartitionRadioButtonClick,
partitionColsOnBlur,
partitionColsOnChange,
partitionRadioButtonsState,
rangeOnChange,
selectedPartitionKind,
setPartitionColumnsValidation,
timePartitioningGranularityChange,
triggerPartitionAdvancedCheckboxes,
validation
}) => {
return (
<>
<div className="partition-fields__checkbox-container">
{Object.keys(partitionCheckboxTargetKind).map((type, index) => (
<CheckBox
item={{ id: type, label: partitionCheckboxTargetKind[type].label }}
key={index}
onChange={id => triggerPartitionAdvancedCheckboxes(id)}
selectedId={selectedPartitionKind.find(
kind => partitionCheckboxTargetKind[type].id === kind
)}
/>
))}
</div>
{selectedPartitionKind.includes('byKey') && (
<div className="radio-buttons-container">
<RadioButtons
elements={partitionRadioButtonsData}
onChangeCallback={handlePartitionRadioButtonClick}
selectedValue={partitionRadioButtonsState}
/>
const PartitionFields = React.forwardRef(
(
{
data,
handlePartitionRadioButtonClick,
partitionColsOnBlur,
partitionColsOnChange,
partitionRadioButtonsState,
rangeOnChange,
selectedPartitionKind,
setPartitionColumnsValidation,
timePartitioningGranularityChange,
triggerPartitionAdvancedCheckboxes,
validation
},
ref
) => {
return (
<>
<div className="partition-fields__checkbox-container" ref={ref}>
{Object.keys(partitionCheckboxTargetKind).map((type, index) => (
<CheckBox
item={{ id: type, label: partitionCheckboxTargetKind[type].label }}
key={index}
onChange={id => triggerPartitionAdvancedCheckboxes(id)}
selectedId={selectedPartitionKind.find(
kind => partitionCheckboxTargetKind[type].id === kind
)}
/>
))}
</div>
)}
<div className="partition-fields__inputs-container">
{partitionRadioButtonsState === 'numberOfBuckets' && (
<RangeInput
density="normal"
labelType="floatingLabel"
label="Number of Buckets"
required
invalid={!validation.partitionBuckets}
min={0}
onChange={rangeOnChange}
tip={
<span>
If you partition by key and the number of unique keys is very high it is recommended
to use buckets for better performance. In this case the path would be
<b> path/bucket-num/year=/month=/day=</b> etc.. In case the value is 0 then no
bucketing will be done and your data will be partitioned by key.
</span>
}
value={data.key_bucketing_number}
/>
{selectedPartitionKind.includes('byKey') && (
<div className="radio-buttons-container">
<RadioButtons
elements={partitionRadioButtonsData}
onChangeCallback={handlePartitionRadioButtonClick}
selectedValue={partitionRadioButtonsState}
/>
</div>
)}
{selectedPartitionKind.includes('byTime') && (
<Select
density="normal"
floatingLabel
onClick={timePartitioningGranularityChange}
options={timePartitioningGranularityOptions}
label="Partition Granularity"
selectedId={data.time_partitioning_granularity}
/>
)}
{selectedPartitionKind.includes('byColumns') && (
<Input
density="normal"
floatingLabel
invalid={!validation.partitionColumns}
onBlur={partitionColsOnBlur}
onChange={partitionColsOnChange}
label="Partition Columns"
placeholder="col1,col2,col3"
setInvalid={setPartitionColumnsValidation}
type="text"
value={data.partition_cols}
wrapperClassName="partition-cols"
/>
<div className="partition-fields__inputs-container">
{partitionRadioButtonsState === 'numberOfBuckets' && (
<RangeInput
density="normal"
labelType="floatingLabel"
label="Number of Buckets"
required
invalid={!validation.partitionBuckets}
min={0}
onChange={rangeOnChange}
tip={
<span>
If you partition by key and the number of unique keys is very high it is
recommended to use buckets for better performance. In this case the path would be
<b> path/bucket-num/year=/month=/day=</b> etc.. In case the value is 0 then no
bucketing will be done and your data will be partitioned by key.
</span>
}
value={data.key_bucketing_number}
/>
)}
{selectedPartitionKind.includes('byTime') && (
<Select
density="normal"
floatingLabel
onClick={timePartitioningGranularityChange}
options={timePartitioningGranularityOptions}
label="Partition Granularity"
selectedId={data.time_partitioning_granularity}
/>
)}
{selectedPartitionKind.includes('byColumns') && (
<Input
density="normal"
floatingLabel
invalid={!validation.partitionColumns}
onBlur={partitionColsOnBlur}
onChange={partitionColsOnChange}
label="Partition Columns"
placeholder="col1,col2,col3"
setInvalid={setPartitionColumnsValidation}
type="text"
value={data.partition_cols}
wrapperClassName="partition-cols"
/>
)}
</div>
{selectedPartitionKind.length === 0 && (
<ErrorMessage message="Must select at least one partitioning option" />
)}
</div>
{selectedPartitionKind.length === 0 && (
<ErrorMessage message="Must select at least one partitioning option" />
)}
</>
)
}
</>
)
}
)

PartitionFields.propTypes = {
data: PropTypes.shape({
Expand Down