|
1 | 1 | import React from 'react';
|
2 | 2 | import PropTypes from 'prop-types';
|
3 |
| -import { reduxForm } from 'redux-form'; |
4 | 3 | import ReactTabs from 'react-tabs';
|
5 | 4 |
|
6 |
| -import * as Validate from '../validate'; |
7 | 5 | import { FormComponent, Form, TextInput, TextareaInput, SubmitButton,
|
8 |
| - CheckBoxInput, SelectInput } from './Form'; |
9 |
| -import Expand from './Expand'; |
10 |
| -import { contains } from '../utils'; |
11 |
| -import * as Action from '../actions'; |
| 6 | + CheckBoxInput, SelectInput } from '../Form'; |
| 7 | +import Expand from '../Expand'; |
| 8 | +import { contains } from '../../utils'; |
| 9 | +import * as Action from '../../actions'; |
12 | 10 |
|
13 | 11 |
|
14 | 12 | const { Tab, Tabs, TabList, TabPanel } = { ...ReactTabs };
|
@@ -131,38 +129,4 @@ FeaturizeForm.defaultProps = {
|
131 | 129 | error: ""
|
132 | 130 | };
|
133 | 131 |
|
134 |
| -const mapStateToProps = (state, ownProps) => { |
135 |
| - const featuresList = state.features.featsWithCheckedTags; |
136 |
| - |
137 |
| - const initialValues = { }; |
138 |
| - featuresList.map((f, idx) => { initialValues[f] = true; return null; }); |
139 |
| - |
140 |
| - const filteredDatasets = state.datasets.filter(dataset => |
141 |
| - (dataset.project_id === ownProps.selectedProject.id)); |
142 |
| - const zerothDataset = filteredDatasets[0]; |
143 |
| - |
144 |
| - return { |
145 |
| - featuresByCategory: state.features.features_by_category, |
146 |
| - tagList: state.features.tagList, |
147 |
| - featuresList, |
148 |
| - featureDescriptions: state.features.descriptions, |
149 |
| - datasets: filteredDatasets, |
150 |
| - fields: featuresList.concat( |
151 |
| - ['datasetID', 'featuresetName', 'customFeatsCode'] |
152 |
| - ), |
153 |
| - initialValues: { ...initialValues, |
154 |
| - datasetID: zerothDataset ? zerothDataset.id.toString() : "", |
155 |
| - customFeatsCode: "" } |
156 |
| - }; |
157 |
| -}; |
158 |
| - |
159 |
| -const validate = Validate.createValidator({ |
160 |
| - datasetID: [Validate.required], |
161 |
| - featuresetName: [Validate.required] |
162 |
| -}); |
163 |
| - |
164 |
| -export default reduxForm({ |
165 |
| - form: 'featurize', |
166 |
| - fields: [''], |
167 |
| - validate |
168 |
| -}, mapStateToProps)(FeaturizeForm); |
| 132 | +export default FeaturizeForm; |
0 commit comments