Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

feat: Batch update #11

Closed
wants to merge 30 commits into from
Closed

feat: Batch update #11

wants to merge 30 commits into from

Conversation

kakoc
Copy link
Contributor

@kakoc kakoc commented Aug 18, 2018

batch-loading
saving-succ
saving-err

Used stubs for Tasks and Assignments parts(they are not implemented; they will be implemented in other tasks, how i understood). So, when they will be implemented need make integration and write tests

kakoc and others added 24 commits August 10, 2018 10:54
make separated Table component for JSInterview parsing result
added opportunity set assignments fields to each xlsx column
@kakoc kakoc changed the title Batch update feat: Batch update Aug 18, 2018
export default connect(
mapStateToProps,
mapDispatchToProps,
)(BatchUpdate);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please separate the file into simpler components

<div className={'row justify-content-lg-center'} style={{ marginTop: '20px' }}>
{this.showOperationsResult()}
</div>
<div className={'row justify-content-lg-center'} style={{ marginTop: '20px' }}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use inline styles?

<div className="col-md-3">
<Dropdown
defaultValue="Select Task"
onSelect={(task: any) => this.setState({ selectedTask: task.id })}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use arrow functions into render method

saveTable = async (): Promise<any> => {
const formData = this.prepareFormDataForSaving();

const res = await axios.patch('/api/batch-update/save-table', formData, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move AJAX query to core/api

parseTable = async (): Promise<any> => {
const formData = new FormData();
formData.set('table', this.state.files[0]);
const res = await axios.post('/api/batch-update/parse-table', formData, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move AJAX query to core/api

style: cellStyle,
},
{ Header: 'Select field', accessor: 'dropdown', style: cellStyle, minWidth: 300 },
]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create constant for table config


const cn = classNames(require('./index.scss'));

class Dropdown extends React.Component<any, any> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add types

return (
<ButtonDropdown
isOpen={this.state.isOpen}
toggle={() => this.setState((prevState: any) => ({ isOpen: !prevState.isOpen }))}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use arrow functions into render method

};
};

const mapDispatchToProps = (dispatch: any, props: any): any => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mapDispatchToProps(dispatch, [ownProps]): dispatchProps] (Object or Function): If an object is passed, each function inside it is assumed to be a Redux action creator. An object with the same function names, but with every action creator wrapped into a dispatch call so they may be invoked directly, will be merged into the component’s props.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

import { makeErrorsList, messageMaker } from '../utils';

const dataRetriever = (...what: any[]) => (data: any) =>
what.reduce((needRetrievedData: any[], needValue: any) => needRetrievedData.concat(data[needValue]), []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i got the point you can do same thing easily with map

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done)

@Shastel Shastel removed their assignment Apr 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants