Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into 442-navigate-on-migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiendupont committed Apr 7, 2021
2 parents f1f44d1 + 35ca5c1 commit 9d641c0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 35 deletions.
54 changes: 20 additions & 34 deletions src/app/Mappings/components/MappingBuilder/MappingBuilder.tsx
Expand Up @@ -42,18 +42,6 @@ export const MappingBuilder: React.FunctionComponent<IMappingBuilderProps> = ({
setBuilderItems,
isWizardMode = false,
}: IMappingBuilderProps) => {
const messageSelectBoth = 'You must select a source and target before adding another mapping.';
const messageExhausted = `All source ${
mappingType === MappingType.Network ? 'networks' : 'datastores'
} have been mapped.`;

const getTooltipContent = () => {
if (builderItems.length === availableSources.length) {
return messageExhausted;
}
return messageSelectBoth;
};

const reset = () => setBuilderItems([{ source: null, target: null, highlight: false }]);
const isReset = builderItems.length === 1 && !builderItems[0].source && !builderItems[0].target;
const addEmptyItem = () =>
Expand Down Expand Up @@ -169,28 +157,26 @@ export const MappingBuilder: React.FunctionComponent<IMappingBuilderProps> = ({
justifyContent={{ default: 'justifyContentCenter' }}
spaceItems={{ default: 'spaceItemsMd' }}
>
<ConditionalTooltip
isTooltipEnabled={
!builderItems.every((item) => item.source && item.target) ||
builderItems.length === availableSources.length
}
content={getTooltipContent()}
position="bottom"
>
<div>
<Button
isDisabled={
!builderItems.every((item) => item.source && item.target) ||
builderItems.length === availableSources.length
}
variant="secondary"
icon={<PlusCircleIcon />}
onClick={addEmptyItem}
>
Add
</Button>
</div>
</ConditionalTooltip>
{builderItems.every((item) => item.source && item.target) ? (
<ConditionalTooltip
isTooltipEnabled={builderItems.length === availableSources.length}
content={`All source ${
mappingType === MappingType.Network ? 'networks' : 'datastores'
} have been mapped.`}
position="bottom"
>
<div>
<Button
isDisabled={builderItems.length === availableSources.length}
variant="secondary"
icon={<PlusCircleIcon />}
onClick={addEmptyItem}
>
Add
</Button>
</div>
</ConditionalTooltip>
) : null}
<Button variant="secondary" onClick={reset} isDisabled={isReset}>
Remove all
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/app/Providers/HostsPage.tsx
Expand Up @@ -56,7 +56,7 @@ export const HostsPage: React.FunctionComponent = () => {
</Level>
<Level className={spacing.mtLg}>
<LevelItem>
<Title headingLevel="h1">Hosts - {match?.params.providerName}</Title>
<Title headingLevel="h1">Hosts</Title>
</LevelItem>
</Level>
</PageSection>
Expand Down

0 comments on commit 9d641c0

Please sign in to comment.