Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Vault Management UI (round 3) #4652

Merged
merged 123 commits into from Mar 3, 2017
Merged

Vault Management UI (round 3) #4652

merged 123 commits into from Mar 3, 2017

Conversation

jacogr
Copy link
Contributor

@jacogr jacogr commented Feb 23, 2017

Extending the work from #4446 & #4631, finally Closes https://github.com/ethcore/parity/issues/3501

Adds the following functionality -

  • Selection of vaults on default account creation screen
  • Display of vault info on list summaries

Future work -

  • Currently the Vault attach on create is only available on the single account creation mechanisms

CreateAccount vault selection -
parity 2017-02-23 16-47-46

Vault information on account summary -
parity 2017-02-23 17-06-35

Depends on the following to be merged -

@ngotchac ngotchac added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 3, 2017
@observer
export default class ChangeVault extends Component {
static propTypes = {
store: PropTypes.object.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit hard to know which store we're talking about here. Could use the same naming as vaultStore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, should have renamed with the others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On looking at the code. Store is the CreateAccount/store - used like that in all components in CreateAccount. (Not renaming it here accross all)

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, it's obvious what store it is inside the CreateAccount context. It's less obvious in the ChangeVault context (you cannot just look at the imports)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

~/ui/CreateAccount/ChangeVault

Copy link
Contributor

Choose a reason for hiding this comment

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

But it could be used elsewhere : views/Account/Header is not only used for Accounts but also for Address for example. Don't want to make a big thing, but I think that renaming it doesn't cost much and adds some readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No issues either way, but not going to do it just for the component and the others are out of scope for the PR. We should probably do it everywhere, we pass it everywhere as store. (Not just this component). Issues -

  1. As you said, it may not be obvious from reading what we are dealing with (fails a bit in "write code for reading")
  2. It conflicts with Redux store naming, i.e. when a MobX store & Redux is used (couple of places), the MobX store cannot be called 'store' in props

Should be logged for a global refactor/cleanup - https://github.com/ethcore/parity/issues/4748

isOpen: false
};

vaultStore = this.props.vaultStore || VaultStore.get(this.context.api);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be better to choose whether it should be passed as prop or not? I find it a bit confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually only done this way for testing.

Copy link
Contributor

@ngotchac ngotchac Mar 3, 2017

Choose a reason for hiding this comment

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

So.... ? One way or the other is fine, but we should choose one for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It only gets use by the tests here.

Copy link
Contributor

Choose a reason for hiding this comment

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

So as a prop ? Thus we don't need the VaultStore.get(this.context.api) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests (e.g. vaultSelect.spec.js) passes thrhough as prop to tightly control the conditions. Normal operations is via getter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any other components that has this kind of logic ? I think that if we really want to have clean logic, we would have one pure component that gets everything via its props and that get tested, and one wrapper component that passes to this pure component the right props from whatever (a store instance, context, ...)

@@ -220,7 +226,28 @@ export default class Store {
this.stage--;
}

createAccount = () => {
createAccount = (vaultStore) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it make sense to attach the vaultStore to this Store before, instead of passing this as an argument (might be used for other methods)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. We specifically don't want it in FirstRun. So it is an option, not a requirement.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could be optional without being an argument, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer passing it here when we create, only used at this point and set by the caller as an option.

@ngotchac
Copy link
Contributor

ngotchac commented Mar 3, 2017

The Vaults are showing twice...

image

And in Edit Meta : Warning: Failed prop type: The prop valueis marked as required inVaultSelect, but its value is undefined.

@jacogr
Copy link
Contributor Author

jacogr commented Mar 3, 2017

Last one is another botched merge. :(

@ngotchac
Copy link
Contributor

ngotchac commented Mar 3, 2017

Also, could we also use the tagged version of the Vault for the Account Summary in an Account page. It's not that great right now

@jacogr jacogr added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. labels Mar 3, 2017
@jacogr
Copy link
Contributor Author

jacogr commented Mar 3, 2017

Not doing that in here. I will as soon as we have a proper tag mechanism in-place, as it stands it is just more duplication which I'm not up for.

@jacogr jacogr added A0-pleasereview 🤓 Pull request needs code review. A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. A0-pleasereview 🤓 Pull request needs code review. labels Mar 3, 2017
@jacogr jacogr added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Mar 3, 2017
@ngotchac ngotchac added A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 3, 2017
@ngotchac
Copy link
Contributor

ngotchac commented Mar 3, 2017

Looks good, still some code-style gumbles, not blocking though.

@gavofyork gavofyork merged commit 1548201 into master Mar 3, 2017
@gavofyork gavofyork deleted the jg-vaults-3 branch March 3, 2017 18:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants