-
Notifications
You must be signed in to change notification settings - Fork 22
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
MTV-1690: Plan wizard - Step 2 - Update mappings section #1391
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
DataList, | ||
DataListAction, | ||
DataListCell, | ||
DataListItem, | ||
DataListItemCells, | ||
DataListItemRow, | ||
} from '@patternfly/react-core'; | ||
|
||
export const MappingListHeader = ({ | ||
sourceHeading, | ||
destinationHeading, | ||
}: { | ||
sourceHeading: string; | ||
destinationHeading: string; | ||
}) => ( | ||
<DataList isCompact aria-label="" className="forklift-page-mapping-list--header"> | ||
<DataListItem aria-labelledby=""> | ||
<DataListItemRow> | ||
<DataListItemCells | ||
dataListCells={[ | ||
<DataListCell key="source">{sourceHeading}</DataListCell>, | ||
<DataListCell key="destination">{destinationHeading}</DataListCell>, | ||
]} | ||
/> | ||
<DataListAction aria-label="empty" id="empty" aria-labelledby="" aria-hidden> | ||
<div className="forklift-page-mapping-list--header-action-spacer"></div> | ||
</DataListAction> | ||
</DataListItemRow> | ||
</DataListItem> | ||
</DataList> | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ import { | |
DataListItem, | ||
DataListItemCells, | ||
DataListItemRow, | ||
Form, | ||
FormGroup, | ||
} from '@patternfly/react-core'; | ||
import { | ||
Select, | ||
|
@@ -89,49 +91,58 @@ export const MappingListItem: FC<MappingListItemProps> = ({ | |
<DataListItemCells | ||
dataListCells={[ | ||
<DataListCell key="source"> | ||
<Select | ||
variant={SelectVariant.single} | ||
aria-label="" | ||
onToggle={setToggleSrcOpen} | ||
onSelect={onSelectSource} | ||
selections={source} | ||
isOpen={isSrcOpen} | ||
isDisabled={isDisabled} | ||
aria-labelledby="" | ||
isGrouped | ||
menuAppendTo={() => document.body} | ||
> | ||
<SelectGroup label={usedSourcesLabel} key="usedSources"> | ||
{toGroup(usedSources, noSourcesLabel, source)} | ||
</SelectGroup> | ||
<SelectGroup label={generalSourcesLabel} key="generalSources"> | ||
{toGroup(generalSources, noSourcesLabel, source)} | ||
</SelectGroup> | ||
</Select> | ||
<Form> | ||
<FormGroup label={t('Source')}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrapped existing Selects in FormGroup so that they can be given labels for small screen widths There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice ! |
||
<Select | ||
variant={SelectVariant.single} | ||
aria-label="" | ||
onToggle={setToggleSrcOpen} | ||
onSelect={onSelectSource} | ||
selections={source} | ||
isOpen={isSrcOpen} | ||
isDisabled={isDisabled} | ||
aria-labelledby="" | ||
isGrouped | ||
menuAppendTo={() => document.body} | ||
> | ||
<SelectGroup label={usedSourcesLabel} key="usedSources"> | ||
{toGroup(usedSources, noSourcesLabel, source)} | ||
</SelectGroup> | ||
<SelectGroup label={generalSourcesLabel} key="generalSources"> | ||
{toGroup(generalSources, noSourcesLabel, source)} | ||
</SelectGroup> | ||
</Select> | ||
</FormGroup> | ||
</Form> | ||
</DataListCell>, | ||
<DataListCell key="destination"> | ||
<Select | ||
variant={SelectVariant.single} | ||
aria-label="" | ||
onToggle={setToggleTrgOpen} | ||
onSelect={onSelectDestination} | ||
selections={destination} | ||
isOpen={isTrgOpen} | ||
isDisabled={isDisabled} | ||
aria-labelledby="" | ||
menuAppendTo={() => document.body} | ||
> | ||
{destinations.map((label) => ( | ||
<SelectOption value={label} key={label} /> | ||
))} | ||
</Select> | ||
<Form> | ||
<FormGroup label={t('Target')}> | ||
<Select | ||
variant={SelectVariant.single} | ||
aria-label="" | ||
onToggle={setToggleTrgOpen} | ||
onSelect={onSelectDestination} | ||
selections={destination} | ||
isOpen={isTrgOpen} | ||
isDisabled={isDisabled} | ||
aria-labelledby="" | ||
menuAppendTo={() => document.body} | ||
> | ||
{destinations.map((label) => ( | ||
<SelectOption value={label} key={label} /> | ||
))} | ||
</Select> | ||
</FormGroup> | ||
</Form> | ||
</DataListCell>, | ||
]} | ||
/> | ||
<DataListAction | ||
id={`mapping_list_item_${index}`} | ||
aria-label={t('Actions')} | ||
aria-labelledby="" | ||
className="pf-v5-u-align-items-center" | ||
> | ||
<Button | ||
onClick={onClick} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ import { CreateVmMigrationPageState, NetworkAlerts, StorageAlerts } from '../typ | |
|
||
import { EditableDescriptionItem } from './EditableDescriptionItem'; | ||
import { MappingList } from './MappingList'; | ||
import { MappingListHeader } from './MappingListHeader'; | ||
import { StateAlerts } from './StateAlerts'; | ||
|
||
const buildNetworkMessages = ( | ||
|
@@ -294,23 +295,23 @@ export const PlansCreateForm = ({ | |
</Form> | ||
|
||
<SectionHeading | ||
text={t('Storage and network mappings')} | ||
text={t('Network mappings')} | ||
className="forklift--create-vm-migration-plan--section-header" | ||
/> | ||
> | ||
<ResourceLink | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shifted ResourceLink labels into the section headings |
||
groupVersionKind={NetworkMapModelGroupVersionKind} | ||
namespace={netMap.metadata?.namespace} | ||
name={netMap.metadata?.name} | ||
className="forklift-page-resource-link-in-description-item" | ||
linkTo={false} | ||
/> | ||
</SectionHeading> | ||
|
||
<DescriptionListGroup> | ||
<DescriptionListTerm> | ||
<span className="forklift-page-editable-description-item"> | ||
{t('Network map:')} | ||
<ResourceLink | ||
groupVersionKind={NetworkMapModelGroupVersionKind} | ||
namespace={netMap.metadata?.namespace} | ||
name={netMap.metadata?.name} | ||
className="forklift-page-resource-link-in-description-item" | ||
linkTo={false} | ||
/> | ||
</span> | ||
</DescriptionListTerm> | ||
<MappingListHeader | ||
sourceHeading={t('Source network')} | ||
destinationHeading={t('Target network')} | ||
/> | ||
<DescriptionListDescription className="forklift-page-mapping-list"> | ||
<StateAlerts | ||
variant={AlertVariant.danger} | ||
|
@@ -344,19 +345,25 @@ export const PlansCreateForm = ({ | |
/> | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
|
||
<SectionHeading | ||
text={t('Storage mappings')} | ||
className="forklift--create-vm-migration-plan--section-header" | ||
> | ||
<ResourceLink | ||
groupVersionKind={StorageMapModelGroupVersionKind} | ||
namespace={storageMap.metadata?.namespace} | ||
name={storageMap.metadata?.name} | ||
className="forklift-page-resource-link-in-description-item" | ||
linkTo={false} | ||
/> | ||
</SectionHeading> | ||
|
||
<DescriptionListGroup> | ||
<DescriptionListTerm> | ||
<span className="forklift-page-editable-description-item"> | ||
{t('Storage map:')} | ||
<ResourceLink | ||
groupVersionKind={StorageMapModelGroupVersionKind} | ||
namespace={storageMap.metadata?.namespace} | ||
name={storageMap.metadata?.name} | ||
className="forklift-page-resource-link-in-description-item" | ||
linkTo={false} | ||
/> | ||
</span> | ||
</DescriptionListTerm> | ||
<MappingListHeader | ||
sourceHeading={t('Source storage')} | ||
destinationHeading={t('Target storage')} | ||
/> | ||
<DescriptionListDescription className="forklift-page-mapping-list"> | ||
<StateAlerts | ||
variant={AlertVariant.danger} | ||
|
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.
So that the
NM
andSM
labels in the headers appear next to the text and are vertically centered