-
Notifications
You must be signed in to change notification settings - Fork 42
Use ui classic redux and router #533
Use ui classic redux and router #533
Conversation
0ad4d49
to
0afc6b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my, it's javascript... :scared:
|
||
.react-wrapper { | ||
height: 100%; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😨
6802c34
to
91138d1
Compare
It looks like it was always the intention to use Issue: #17 |
hi @Hyperkid123 - apologies for late response (I am returning from extended PTO 😄 ). Thanks for revisiting this one (and thanks to @michaelkro and @AllenBW for keeping this moving!). I have no issues at all with introducing connected-react-router if that is consistent w/ redux routing in MIQ. It seems like you may be missing some of the benefits of that library though after taking a quick glance. I will post a couple of comments inline and see what you think...this looks like a good direction though! |
@@ -189,7 +189,7 @@ class MigrationsCompletedList extends React.Component { | |||
onClick={e => { | |||
e.stopPropagation(); | |||
|
|||
redirectTo(`/migration/plan/${plan.id}`); | |||
redirectTo(`/plan/${plan.id}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you not want to use the connected react router's push method now? This should enable the history to be tracked in redux state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep i know about this. My mindset about this is PR, is to make as little changes as possible (we use the push, goBack etc. methods in ui-classic) to minimize chance of breaking something.
But if you will require these changes i will happily do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hyperkid123 i think it would be a nice to test this feature if it's not too much additional (otherwise, yes, fine w/ waiting).
I will try to pull this branch down and do some more testing on my side soon...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK i will do it, its very simple change anyway. The worst thing will be finding all the places where it should be used 😄 .
app/javascript/react/index.js
Outdated
</Router> | ||
</Provider> | ||
); | ||
class OwerView extends React.Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you mean to call this "Overview" or something else? I guess since this is the root of the application (and not technically the Overview), maybe we can just call this class "Index" ? just a consideration...
@@ -151,7 +151,11 @@ MappingWizardDatastoresStep.propTypes = { | |||
}; | |||
MappingWizardDatastoresStep.defaultProps = { | |||
clusterMappings: [], | |||
fetchStoragesUrls: {}, | |||
fetchStoragesUrls: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is the alternative to using the data
props in app/javascript/components/index.js
I am 100% OK with this. That is just an artifact of the original way to use the component registry (which now seems dated). This method should be easier to follow and preferred now it seems...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured it was used for configuration of the plugin. So if there is scenario, when it might be required to change those values (like using it in different product) i would maybe recommend to move them to redux and have some "read only" reducer for configuration. I think all components that are using this are connected anyway, so basically only the origin of the data would change. We would not have move the data to defaultProps
and we could eventually delete the whole coreComponents
file.
Only other thing that is depending on this are the routes i think, but it should not be hard to replace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@priley86 ok i will move it to default props for now. You guys can decide which path you want to take later. Also ,removing the original component registry should not be part of this PR. That is maybe something for future refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works!
0b6ba18
to
f33a38f
Compare
ddd4129
to
6e7ffef
Compare
Same in ManageIQ/manageiq-ui-classic#4371, this depends on the version of jsdom being used. |
@Hyperkid123 some background on react-intl can be found here... Initially in the project we were not sure how to best add lanaguage/date/time internationalization support in React and decided to follow this Foreman PR. However, it looks like Foreman did not move forward with this. Since we are using gettext and happy w/ that for messages, and now using Moment JS for dates/time, it seems like we can safely remove react-intl. @AllenBW @AparnaKarve - any thoughts on this? |
@priley86 I agree. 😏 🍶 😋 👍 |
@priley86 Yes, OK to remove react-intl |
@priley86 ok, i was just asking because i did not add the intl context to the component. |
Nah nothing of that nature was recently added @Hyperkid123, looking into it... maybe we'll just 🗑 6.10 tests 🤔 |
Oh yeah, sorry about that, looks like we don't support node 6 anymore... (Right now, this is just a |
Hmmm so yah think we can can all travis tests that run on node 6? (here and also SUI?) |
can can 💃 :D But yeah, can all the tests :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okie dokie, I'm ok with this, nothing breaks 🙇 a flippin awesome undertaking, thanks for the contribution @Hyperkid123 !!
@michaelkro @AparnaKarve ya'll wanta weigh in here before a merge? (we're ignoring the failing travis test)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took it for a spin, and everything looks good. Thank you for your time and effort on this @Hyperkid123!
Np, happy to help |
Tested this and seems to work well. It looks like with this change, we won't see the redux logging in the console anymore. We do have the Redux Dev tools Chrome extension to monitor the redux activity, but I do like the console logging better. Can we enable that if possible? Other than the above observation, everything else looks great! |
Gonna merge this before some really 🤕 merge conflicts start popping up.. @AparnaKarve totally not bailing on the need to console log redux activity! Can be done in another pr 🤗 |
Happy to see this landed! 🎆 Thanks to all for the effort 🍻 May I suggest the V2V team to ping @himdel, @skateman, @Hyperkid123 and @martinpovolny in case you are about to introduce some major concept in V2V. I mean something like routing, redux store, notifications or i18n. Something that has a big potential of clashing with the ui-classic. Please? It's absolutely not that I'd want to slow you down in your great job. I'd like the cooperation to be as smooth as possible. |
Yes, we definitely will @martinpovolny! 🍻 |
In order to fix ManageIQ/manageiq-ui-classic#4361 (comment). It is required to merge v2v router and redux with ui-classic.
Because ui-classic cannot use BrowserRouter (mainly because it would take an insane amount of time), we were forced to use hashRouter. Additionally, most of the screens, are controlled via toolbars, trees and other controls, that are not part of most of the components it was also required to use redux to handle some routing. This creates conflict between ui-classic routing and v2v routing.
Fortunately it can be fixed fairly easily.
PR dependencies in ui-classic
Necessary changes
/migration
prefix from them.remove theapp/javascript/components/index.js
for now i have moved these default props to corresponding components (mainly theindex.html.hml
, but it is not pretty and we should try to find some other place to put them)Test are green and from what i can tell, it works and fixes the error from the comment above. But this is the first time i see the v2v component, so somebody elso should go through it and try to find out if i forget something.