1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

feat(kubernetes): edit yaml support EE-2855 (#8016)

This commit is contained in:
Prabhat Khera 2022-11-22 09:40:44 +13:00 committed by GitHub
parent 7006c17ce4
commit 0f0513c684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 195 additions and 0 deletions

View file

@ -0,0 +1,83 @@
import ReactTooltip from 'react-tooltip';
import clsx from 'clsx';
import _ from 'lodash';
import ReactDOMServer from 'react-dom/server';
import { FeatureId } from '@/react/portainer/feature-flags/enums';
import { getFeatureDetails } from '@@/BEFeatureIndicator/utils';
import styles from './TooltipWithChildren.module.css';
type Position = 'top' | 'right' | 'bottom' | 'left';
export interface Props {
position?: Position;
message: string;
className?: string;
children: React.ReactNode;
heading?: string;
BEFeatureID?: FeatureId;
}
export function TooltipWithChildren({
message,
position = 'bottom',
className,
children,
heading,
BEFeatureID,
}: Props) {
const id = _.uniqueId('tooltip-');
const { url, limitedToBE } = BEFeatureID
? getFeatureDetails(BEFeatureID)
: { url: '', limitedToBE: false };
const messageHTML = (
<div className={styles.tooltipContainer}>
<div
className={clsx(
'w-full mb-2 inline-flex justify-between',
styles.tooltipHeading
)}
>
{heading && <span>{heading}</span>}
{BEFeatureID && limitedToBE && (
<a
href={url}
target="_blank"
rel="noreferrer"
className={styles.tooltipBeteaser}
>
Business Edition Only
</a>
)}
</div>
<div>{message}</div>
</div>
);
return (
<span
data-html
data-multiline
data-tip={ReactDOMServer.renderToString(messageHTML)}
data-for={id}
className={clsx(styles.icon, 'inline-flex text-base')}
>
{children}
<ReactTooltip
id={id}
multiline
type="info"
place={position}
effect="solid"
className={clsx(styles.tooltip, className)}
arrowColor="var(--bg-tooltip-color)"
delayHide={400}
clickable
/>
</span>
);
}