Skip to content
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-1786] Add tooltip to Create plan wizard's Target namespace field #1410

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading