1
1
import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
2
3
import { reduxForm } from 'redux-form' ;
3
4
import ReactTabs from 'react-tabs' ;
4
5
@@ -10,11 +11,7 @@ import { contains } from '../utils';
10
11
import * as Action from '../actions' ;
11
12
12
13
13
- const Tab = ReactTabs . Tab ;
14
- const Tabs = ReactTabs . Tabs ;
15
- const TabList = ReactTabs . TabList ;
16
- const TabPanel = ReactTabs . TabPanel ;
17
-
14
+ const { Tab, Tabs, TabList, TabPanel } = { ...ReactTabs } ;
18
15
19
16
const FeaturizeForm = ( props ) => {
20
17
const { fields, fields : { datasetID, featuresetName, customFeatsCode } ,
@@ -69,9 +66,13 @@ const FeaturizeForm = (props) => {
69
66
< TabPanel >
70
67
< a
71
68
href = "#"
72
- onClick = { ( ) => {
69
+ onClick = {
70
+ ( ) => {
73
71
props . dispatch ( Action . groupToggleCheckedFeatures (
74
- props . featuresByCategory [ ctgy ] ) ) ; } }
72
+ props . featuresByCategory [ ctgy ]
73
+ ) ) ;
74
+ }
75
+ }
75
76
>
76
77
Check/Uncheck All
77
78
</ a >
@@ -103,7 +104,8 @@ const FeaturizeForm = (props) => {
103
104
< TabPanel >
104
105
< TextareaInput
105
106
label = "Enter Python code defining custom features"
106
- rows = "10" cols = "50"
107
+ rows = "10"
108
+ cols = "50"
107
109
{ ...customFeatsCode }
108
110
/>
109
111
</ TabPanel >
@@ -113,19 +115,21 @@ const FeaturizeForm = (props) => {
113
115
) ;
114
116
} ;
115
117
FeaturizeForm . propTypes = {
116
- fields : React . PropTypes . object . isRequired ,
117
- datasets : React . PropTypes . arrayOf ( React . PropTypes . object ) . isRequired ,
118
- error : React . PropTypes . string ,
119
- handleSubmit : React . PropTypes . func . isRequired ,
120
- submitting : React . PropTypes . bool . isRequired ,
121
- resetForm : React . PropTypes . func . isRequired ,
122
- selectedProject : React . PropTypes . object ,
123
- featuresByCategory : React . PropTypes . object ,
124
- tagList : React . PropTypes . arrayOf ( React . PropTypes . string ) . isRequired ,
125
- featuresList : React . PropTypes . array ,
126
- featureDescriptions : React . PropTypes . object
118
+ fields : PropTypes . object . isRequired ,
119
+ datasets : PropTypes . arrayOf ( PropTypes . object ) . isRequired ,
120
+ error : PropTypes . string ,
121
+ handleSubmit : PropTypes . func . isRequired ,
122
+ submitting : PropTypes . bool . isRequired ,
123
+ resetForm : PropTypes . func . isRequired ,
124
+ selectedProject : PropTypes . object . isRequired ,
125
+ featuresByCategory : PropTypes . object . isRequired ,
126
+ tagList : PropTypes . arrayOf ( PropTypes . string ) . isRequired ,
127
+ featuresList : PropTypes . array . isRequired ,
128
+ featureDescriptions : PropTypes . object . isRequired
129
+ } ;
130
+ FeaturizeForm . defaultProps = {
131
+ error : ""
127
132
} ;
128
-
129
133
130
134
const mapStateToProps = ( state , ownProps ) => {
131
135
const featuresList = state . features . featsWithCheckedTags ;
@@ -144,7 +148,8 @@ const mapStateToProps = (state, ownProps) => {
144
148
featureDescriptions : state . features . descriptions ,
145
149
datasets : filteredDatasets ,
146
150
fields : featuresList . concat (
147
- [ 'datasetID' , 'featuresetName' , 'customFeatsCode' ] ) ,
151
+ [ 'datasetID' , 'featuresetName' , 'customFeatsCode' ]
152
+ ) ,
148
153
initialValues : { ...initialValues ,
149
154
datasetID : zerothDataset ? zerothDataset . id . toString ( ) : "" ,
150
155
customFeatsCode : "" }
0 commit comments