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

Convert TaxCloud panel to React #3121

Merged
merged 29 commits into from
Nov 20, 2017

Conversation

foladipo
Copy link
Contributor

@foladipo foladipo commented Oct 17, 2017

Resolves #3093 .

This PR converts the TaxCloud settings panel from using AutoForm to using React for editing its settings.

Test Instructions

  • Login as admin.
  • Open the TaxCloud settings panel. Observe the current API Login ID and API Key values (if any).
  • Change the login ID or/and API key in the TaxCloud settings form and submit the form. Observe an alert that confirms that the new settings were saved successfully.
  • Refresh the page and open the TaxCloud panel again. Observe that the form now contains the login ID or API key you entered above.
  • Note: Instead of refreshing the page, you can use RoboMongo (or similar) to inspect the DB. Just search the Package collection for the package with name: taxes-taxcloud. Then cycle between editing the TaxCloud settings form and checking the settings.taxcloud field in the said package. You'll notice that that field always changes as appropriate.

@foladipo foladipo changed the title [WIP] Convert TaxCloud panel to React Convert TaxCloud panel to React Oct 19, 2017
@foladipo foladipo requested a review from brent-hoover October 19, 2017 14:03
Copy link
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

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

This is sort of an incomplete conversion. We should be converting this to the container/component pattern and eliminate all the Blaze we can.

);
};

TaxCloudSettingsForm.propTypes = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

* @since 1.5.1
* @return {Object} - returns the data found for the said Package.
*/
function getPackageData(pkgName) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use this function instead:

getPackageSettings(name) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

So I think we want to pretty much eliminate all this code in the old template file and replace this with a container and just have a placeholder that renders the container.

@foladipo
Copy link
Contributor Author

@zenweasel Roger that. Implementing those reviews right away.

@brent-hoover
Copy link
Collaborator

This is the container example I was talking about

import { compose, withProps } from "recompose";

See how it relates to the component here:

import { Components } from "@reactioncommerce/reaction-components";

@foladipo foladipo changed the title Convert TaxCloud panel to React [WIP] Convert TaxCloud panel to React Oct 22, 2017
@foladipo
Copy link
Contributor Author

Roger that @zenweasel . That example is really helpful.

@foladipo
Copy link
Contributor Author

Status update

This PR is currently WIP because I'm busy implementing the changes above.

@foladipo
Copy link
Contributor Author

Status update

Two of the reviews above have been implemented. The one that remains is to create and use the container component discussed above.

@foladipo
Copy link
Contributor Author

Status update

Review #3 has been implemented. Will soon remove the [WIP] tag, but only after some more testing/linting.

@brent-hoover brent-hoover dismissed stale reviews from machikoyasuda and mikemurray October 31, 2017 17:52

Suggested method is not the same as requirements

@foladipo
Copy link
Contributor Author

Roger that @zenweasel . I'll work on adding tests for the packages/update method.

@foladipo
Copy link
Contributor Author

foladipo commented Nov 1, 2017

@zenweasel After adding the specs for package/update, how do I run the tests in that file alone?

@foladipo
Copy link
Contributor Author

foladipo commented Nov 1, 2017

@zenweasel I have pushed the tests for packages/update. Please review.

NB: For now, I used describe.only and it.only while writing these tests. This will allow us to focus on running, reviewing and improving these tests, instead of those of the entire project. But once the review process is done, I'll revert to using describe and it.

@foladipo
Copy link
Contributor Author

foladipo commented Nov 7, 2017

UPDATE

I added a spec for when package/update is called with arguments of the wrong type.

cc @zenweasel

brent-hoover
brent-hoover previously approved these changes Nov 8, 2017
machikoyasuda
machikoyasuda previously approved these changes Nov 8, 2017
Copy link
Contributor

@machikoyasuda machikoyasuda left a comment

Choose a reason for hiding this comment

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

The JSDoc comments look good to me!

<div className="rui taxcloud-settings-form">
{!settings.taxcloud.apiLoginId &&
<div className="alert alert-info">
<span data-i18n="admin.taxSettings.taxcloudCredentials">Add API Login ID to enable</span>
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 data-i18n use the translation component <Components.Translation defaultValue="" i18nkey="" />

@brent-hoover brent-hoover dismissed stale reviews from machikoyasuda and themself via bba0eb5 November 8, 2017 22:43
@brent-hoover
Copy link
Collaborator

@mikemurray Thanks for catching the data-i18n. In the interest of getting this merged I made the requested change. If that's correct can you review and approve?

@brent-hoover
Copy link
Collaborator

@mikemurray Can you double-check that my changes are good and we can approve?

@brent-hoover
Copy link
Collaborator

Thanks @mikemurray

@spencern spencern changed the base branch from master to release-1.5.9 November 20, 2017 23:57
@spencern spencern merged commit 83b7b04 into release-1.5.9 Nov 20, 2017
@spencern spencern deleted the folusho-convert-taxcloud-panel-to-react-3093 branch November 20, 2017 23:58
@spencern spencern mentioned this pull request Nov 21, 2017
Akarshit pushed a commit that referenced this pull request Jan 7, 2018
…ud-panel-to-react-3093

Convert TaxCloud panel to React
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants