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

[WIP] Create DualPaneMapper component and implement step 2 of mapping wizard #40

Closed
wants to merge 12 commits into from

Conversation

michaelkro
Copy link
Contributor

@michaelkro michaelkro commented Feb 9, 2018

[WIP]

Initial implementation and integration of DualPaneMapper

CI failure is due to a setState call in componentDidMount. Just doing this to stub data for now

https://github.com/priley86/miq_v2v_ui_plugin/issues/26

Notes

  1. DualPaneMapper.scss was copied and pasted from here, with some minor customization.
  2. The Target and Source clusters panes are less wide than what you see in the mocks here V2V POC. This is because our actual Wizard Modal is significantly less wide than what is depicted in the mocks.

Todo:

  • Sort clusters in lists. Do we want them sorted alphabetically? This could also be handled by a redux selector function.
  • Implement x of y items selected info at bottom of Source Clusters pane as shown in mocks

@priley86
Copy link
Member

priley86 commented Feb 9, 2018

@michaelkro can you post some screenshots for @serenamarie125 to review after you are getting close? Great job starting this!

@michaelkro
Copy link
Contributor Author

@priley86 yup, no problem!

* Disable add mapping button until a valid mapping has been selected
* Remove mapped items from source and target cluster lists after
clicking button
* Extract DualPaneMapper as a standalone component
* MappingWizardClustersStep will implement instances of DualPaneMapper
and TreeView
* MappingWizardClustersStep will manage clusters state
@michaelkro michaelkro changed the title [WIP] Create DualPaneMapper component [WIP] Create DualPaneMapper component and implement step 2 of mapping wizard Feb 10, 2018
* Add mappings to TreeView
  * Only parent nodes are selectable
  * Parent nodes are expanded by default
* Remove individual mappings
* Remove all mappings
@michaelkro
Copy link
Contributor Author

mapping-wizard-step2-1

@michaelkro
Copy link
Contributor Author

mapping-wizard-step2-2

@michaelkro
Copy link
Contributor Author

mapping-wizard-step2-3

@michaelkro
Copy link
Contributor Author

@priley86 @serenamarie125 here are some screenshots. I still have a couple todos (listed in main PR comment)

* Create TreeViewContainer component to declutter
MappingWizardClustersStep
* Fix bug in removeMapping method (missing parentheses)
* Add classNames and styles
@michaelkro
Copy link
Contributor Author

fullscreen_2_12_18__3_50_pm

@michaelkro
Copy link
Contributor Author

fullscreen_2_12_18__3_52_pm

* Optional component that is rendered in the DualPanelMapperList
component if `hasCounter` is passed in as true.
* Expects `selectedItems` and `totalItems` props
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';

const DualPaneMapperCount = ({ selectedItems, totalItems }) => (
<div className="dual-pane-mapper-count">
{selectedItems} of {totalItems} items selected
{selectedItems} {__('of')} {totalItems} {__('items selected')}
Copy link
Contributor

Choose a reason for hiding this comment

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

@michaelkro Can you use sprintf here in order to keep the whole sentence intact.

Something like this -

__(sprintf('%s of %s items selected', {selectedItems}, {totalItems}));

Whole sentences work better with translators.

@michaelkro
Copy link
Contributor Author

{__('Remove Mapping')}
</Button>{' '}
<Button disabled={mappings.length === 0} onClick={removeAll}>
{__('Remove all')}

Choose a reason for hiding this comment

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

@michaelkro Can you please useInitial capitalization ? "Remove All" with a capital A

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, no problem! :)

DualPaneMapperList

The first implementation requires passing props down two levels, first
through DualPaneMapperList, then into DualPaneMapperCounter, which is
not ideal.

const DualPaneMapperCount = ({ selectedItems, totalItems }) => (
<div className="dual-pane-mapper-count">
{__(sprintf('%s of %s items selected', selectedItems, totalItems))}
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!
Just realized that it should have been -
sprintf(__('%s of %s items selected'), selectedItems, totalItems)
(my apologies)

Otherwise the string would not be extracted for translation.

michaelkro referenced this pull request in michaelkro/manageiq-v2v Feb 14, 2018
@michaelkro michaelkro mentioned this pull request Feb 14, 2018
2 tasks
michaelkro referenced this pull request in michaelkro/manageiq-v2v Feb 14, 2018
@michaelkro
Copy link
Contributor Author

Closing in favor of https://github.com/priley86/miq_v2v_ui_plugin/pull/44

@michaelkro michaelkro closed this Feb 15, 2018
@michaelkro michaelkro deleted the step-2 branch April 2, 2018 17:54
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.

4 participants