Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Issue 362 options dropdown refactor #387

Merged

Conversation

shannonlal
Copy link
Contributor

This is an initial refactoring of the options dialog. I have broken the options dialog into 3 different components. I have not done any refactoring/optimizing of the code at this point. In the next PR I will start adding Jest test for the different components. I am trying to keep the PR's small so I did not add any additional tests at this point.

@n-riesco If you have few minutes would you mind doing a quick review of this code. I welcome any comments or suggestions.

Thanks

@n-riesco
Copy link
Contributor

I'll review this PR later tonight. But if you have the chance before, could change the PR, so that it doesn't touch yarn.lock, please? I know yarn.lock is corrupted, but I'm fixing that in #385 (where I'm removing some dependencies).

this.renderSQLOptions = this.renderSQLOptions.bind(this);
this.renderElasticsearchIndecies = this.renderElasticsearchIndecies.bind(this);
this.renderElasticsearchDocs = this.renderElasticsearchDocs.bind(this);
}

static propTypes = {
// See type of react-select's Select `value` property
Copy link
Contributor

@n-riesco n-riesco Feb 26, 2018

Choose a reason for hiding this comment

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

I expected selectedTable and selectedIndex to be PropTypes.string (since we used them as keys).
Would PropTypes.string break anything?


static propTypes = {
// See type of react-select's Select `value` property
selectedTable: PropTypes.any,
selectedIndex: PropTypes.any,

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this line was here to make clear the above comment only applies to selectedTable and selectedIndex.

this.renderElasticsearchIndecies = this.renderElasticsearchIndecies.bind(this);
this.renderElasticsearchDocs = this.renderElasticsearchDocs.bind(this);
}

renderSQLOptions() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this code has moved to <SQLOptions>, let's get rid of this method.

return (<SQLOptions selectedTable={selectedTable}
tablesRequest={tablesRequest}
setTable={setTable}
/>);
}

renderElasticsearchIndecies() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this code has moved to <ESIndicesOptions>, let's get rid of this method.

return (<ESIndicesOptions elasticsearchMappingsRequest={EMR}
setIndex={setIndex}
selectedIndex={selectedIndex}
/>);
}

renderElasticsearchDocs() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this code has moved to <ESDocsOptions>, let's get rid of this method.


export default class ESDocsOptions extends Component {
static propTypes = {
selectedTable: PropTypes.any,
Copy link
Contributor

Choose a reason for hiding this comment

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

If we can't use PropTypes.string here, then we should bring back the comment // See type of react-select's Select 'value' property.

static propTypes = {
elasticsearchMappingsRequest: PropTypes.object,
setIndex: PropTypes.func,
selectedIndex: PropTypes.any
Copy link
Contributor

Choose a reason for hiding this comment

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

If we can't use PropTypes.string here, then we should bring back the comment // See type of react-select's Select 'value' property.

export default class SQLOptions extends Component {

static propTypes = {
selectedTable: PropTypes.any,
Copy link
Contributor

Choose a reason for hiding this comment

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

If we can't use PropTypes.string here, then we should bring back the comment // See type of react-select's Select 'value' property.

@n-riesco
Copy link
Contributor

I'd like new files to be lowercase. How about sql-options.jsx, es-indices-options.jsx and es-docs-options.jsx?

@n-riesco
Copy link
Contributor

Since #385 fixes yarn.lock and updates yarn lint so that it also checks .jsx files, I'd wait for #385 to be merged.

@shannonlal
Copy link
Contributor Author

@n-riesco Please ignore the latest commits. I accidentally pushed to my repo and triggered the build. I will wait until you have merged #385 and then will resolve the yarn.lock issue.

Merge branch 'upstream-master' into Issue-362-OptionsDropdown-Refactor
@shannonlal
Copy link
Contributor Author

@n-riesco I fixed most of your comments and removed the yarn.lock from the commit. Let me know if you have any additional comments or if you want to just merge this in.

Thanks

@n-riesco
Copy link
Contributor

n-riesco commented Mar 3, 2018

💃 could you do a squash and merge, please?

peek 2018-03-03 20-38

@shannonlal shannonlal merged commit 1e04ec1 into plotly:master Mar 3, 2018
@shannonlal
Copy link
Contributor Author

Thanks

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.

2 participants