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

Move componentRegistry, mount, mount_react_component to v2v #334

Merged
merged 3 commits into from
May 24, 2018
Merged

Move componentRegistry, mount, mount_react_component to v2v #334

merged 3 commits into from
May 24, 2018

Conversation

himdel
Copy link
Contributor

@himdel himdel commented May 21, 2018

Not being used in ui-classic, there's a new registry being rolled out now,
less interdependencies if we just keep it here.

ManageIQ/manageiq-ui-classic#3963: needed because no registry in gaprindashvili ui-classic

(This PR is based on #331, merge that one first please)

@priley86
Copy link
Member

will await #331 resolution

package.json Outdated
@@ -64,6 +64,8 @@
"file-saver": "^1.3.8",
"intl": "~1.2.5",
"jquery": "~3.2.1",
"lodash.foreach": "^4.5.0",
"lodash.map": "^4.6.0",
Copy link
Member

Choose a reason for hiding this comment

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

is there any reason why to continue using lodash map and lodash foreach? I believe there are es6 compatible versions of those methods..

https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_each
https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_map

Copy link
Member

Choose a reason for hiding this comment

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

orderby is not so simple though and used by our sortabular/table sorting component ;(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, probably no reason at all for the 2 :)

@himdel himdel changed the title move componentRegistry, mount, mount_react_component to v2v [WIP] move componentRegistry, mount, mount_react_component to v2v May 22, 2018
@himdel
Copy link
Contributor Author

himdel commented May 22, 2018

Fixed the lodash imports, but rebased on top of #331 so I'll have to rebase again once that one is in :) (hence the WIP)

@priley86
Copy link
Member

ok... now #331 has been merged... rebase and some minor eslint fixes it looks like...

@himdel himdel changed the title [WIP] move componentRegistry, mount, mount_react_component to v2v Move componentRegistry, mount, mount_react_component to v2v May 23, 2018
himdel added 3 commits May 23, 2018 11:50
not being used in ui-classic, there's a new registry being rolled out now,
less interdependencies if we just keep it here
no point for iterating over an array, or getting keys of a hash
@AparnaKarve
Copy link
Contributor

@himdel So the idea behind this PR to avoid backporting a ton of other PRs in ui-classic to gaprindashvili?

@priley86
Copy link
Member

priley86 commented May 23, 2018

since this creates a local component registry (and no longer references window.ManageIQ.react - is it OK to assume that component registry is going away or you are just doing this temporarily? If it's local to v2v, I assume it could also be removed later on.

I would like to revisit this pattern in the future if we can. I think we may be able to achieve module separation using webpack code splits / ES6 JS modules instead of the global cache. I'm still not accustom to this sort of pattern and not sure what other teams are going w/ here.

@priley86
Copy link
Member

for the short term (i.e. for upcoming releases) - i have no issue w/ this at all. Just let us know if you'd like this in gaprindashvili and master?

@priley86
Copy link
Member

tested this locally.. it works fine for me.

@himdel
Copy link
Contributor Author

himdel commented May 24, 2018

So.. basically, last week, we finished setting up the new registry in ops UI - that one is now documented in guides.

The idea is to use the new registry instead - but mostly only for the root component - essentially any time you need to render a react component in non-react context.

The new registry can work with any react component directly - dropping the need for components to take only data and store as props. (And we have a = react 'Name', {(props)} helper to render it anywhere.)

So... I'm moving the old registry here, as right now, v2v completely depends on it right now.
Also, it is not available in gaprindashvili, so moving this here solves that.
And it won't be available in master for much longer (pretty much waiting for this PR for that, and a similar graphql change), so moving here makes sure we don't break it.

So the idea behind this PR to avoid backporting a ton of other PRs in ui-classic to gaprindashvili?

Yup, a ton :). And not to break it when we remove it.

is it OK to assume that component registry is going away or you are just doing this temporarily? If it's local to v2v, I assume it could also be removed later on.

Yup, the idea behind it being local is that you're free to change it to something more standard (or not, up to you) :). (And you'll know you can't break any other plugin by doing that.)

Just let us know if you'd like this in gaprindashvili and master?

Both gaprindashvili and master please :).

@priley86
Copy link
Member

priley86 commented May 24, 2018

The idea is to use the new registry instead - but mostly only for the root component - essentially any time you need to render a react component in non-react context.

Ok, this is making more sense now. From an MIQ standpoint supporting multiple frontend frameworks, I can see the case for this on adding React support to the legacy Ng pages. This is not really necessary in a React only architecture I suppose.

Yup, the idea behind it being local is that you're free to change it to something more standard (or not, up to you) :). (And you'll know you can't break any other plugin by doing that.)

With a lot of product teams moving to consuming PatternFly React and those components becoming standardized and more scalable directly from PF, I hope this need diminishes, but I see your point here. I tend to prefer consuming directly from PF for new React pages unless we are extending a component for a specific need across MIQ. In that case we have the ManageIQ/react-ui-components repo. I.m.o. we should try to make the upstream PF React components as flexible as possible first though.

Both gaprindashvili and master please :).

Not a problem. I would like to reconsider this topic post release. Thanks for your patience.

@priley86
Copy link
Member

@AparnaKarve do you have any more concerns before merge?

@AparnaKarve
Copy link
Contributor

Verified locally that these changes work.
Merging...

@AparnaKarve AparnaKarve merged commit fce5aff into ManageIQ:master May 24, 2018
@himdel himdel deleted the registry branch May 25, 2018 13:02
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.

4 participants