Skip to content

Commit

Permalink
Merge pull request #1410 from jpuzz0/MTV-1786-target-namespace-tooltip
Browse files Browse the repository at this point in the history
[MTV-1786] Add tooltip to Create plan wizard's Target namespace field
  • Loading branch information
yaacov authored Dec 15, 2024
2 parents 4000d26 + f5e85a0 commit a1408ed
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
22 changes: 22 additions & 0 deletions packages/common/src/components/HelpIconPopover/HelpIconPopover.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';

import { Popover, PopoverProps } from '@patternfly/react-core';
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';

interface HelpIconPopoverProps {
children: React.ReactNode;
header?: string;
popoverProps?: Omit<PopoverProps, 'bodyContent' | 'titleContent'>;
}

export const HelpIconPopover: React.FC<HelpIconPopoverProps> = ({
children,
header,
popoverProps,
}) => (
<Popover position="right" bodyContent={children} headerContent={header} {...popoverProps}>
<button type="button" className="pf-c-form__group-label-help">
<HelpIcon />
</button>
</Popover>
);
3 changes: 3 additions & 0 deletions packages/common/src/components/HelpIconPopover/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @index(['./*', /__/g], f => `export * from '${f.path}';`)
export * from './HelpIconPopover';
// @endindex
1 change: 1 addition & 0 deletions packages/common/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './ExternalLink';
export * from './Filter';
export * from './FilterGroup';
export * from './FormGroupWithHelpText';
export * from './HelpIconPopover';
export * from './Icons';
export * from './LoadingDots';
export * from './Page';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ReactNode, useState } from 'react';
import { FilterableSelect } from 'src/components';
import SectionHeading from 'src/components/headers/SectionHeading';
import { useForkliftTranslation } from 'src/utils/i18n';
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { FormGroupWithHelpText, HelpIconPopover } from '@kubev2v/common';
import {
NetworkMapModelGroupVersionKind,
ProviderModelGroupVersionKind,
Expand All @@ -19,6 +19,8 @@ import {
Form,
FormSelect,
FormSelectOption,
Stack,
StackItem,
TextInput,
} from '@patternfly/react-core';

Expand Down Expand Up @@ -275,6 +277,26 @@ export const PlansCreateForm = ({
id="targetNamespace"
validated={validation.targetNamespace}
placeholder={t('Select a namespace')}
labelIcon={
<HelpIconPopover header={t('Target namespace')}>
<Stack hasGutter>
<StackItem>
<ForkliftTrans>
Namespaces, also known as projects, separate resources within clusters.
</ForkliftTrans>
</StackItem>

<StackItem>
<ForkliftTrans>
The target namespace is the namespace within your selected target provider
that your virtual machines will be migrated to. This is different from the
namespace that your migration plan will be created in and where your provider
was created.
</ForkliftTrans>
</StackItem>
</Stack>
</HelpIconPopover>
}
>
<FilterableSelect
selectOptions={availableTargetNamespaces.map((ns) => ({
Expand Down

0 comments on commit a1408ed

Please sign in to comment.