2021-12-14 19:14:53 +00:00
|
|
|
import { PropsWithChildren } from 'react';
|
2022-06-09 21:17:13 +00:00
|
|
|
import clsx from 'clsx';
|
2022-08-12 00:03:30 +00:00
|
|
|
import { Briefcase } from 'react-feather';
|
2021-12-14 19:14:53 +00:00
|
|
|
|
2022-07-25 16:24:54 +00:00
|
|
|
import './BEFeatureIndicator.css';
|
|
|
|
|
2021-12-14 19:14:53 +00:00
|
|
|
import { FeatureId } from '@/portainer/feature-flags/enums';
|
|
|
|
|
|
|
|
import { getFeatureDetails } from './utils';
|
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
featureId?: FeatureId;
|
2022-06-09 21:17:13 +00:00
|
|
|
showIcon?: boolean;
|
|
|
|
className?: string;
|
2021-12-14 19:14:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function BEFeatureIndicator({
|
|
|
|
featureId,
|
|
|
|
children,
|
2022-06-09 21:17:13 +00:00
|
|
|
showIcon = true,
|
|
|
|
className = '',
|
2021-12-14 19:14:53 +00:00
|
|
|
}: PropsWithChildren<Props>) {
|
|
|
|
const { url, limitedToBE } = getFeatureDetails(featureId);
|
|
|
|
|
|
|
|
if (!limitedToBE) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<a
|
2022-08-12 00:03:30 +00:00
|
|
|
className={clsx('be-indicator vertical-center', className)}
|
2021-12-14 19:14:53 +00:00
|
|
|
href={url}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
{children}
|
2022-08-12 00:03:30 +00:00
|
|
|
{showIcon && <Briefcase className="icon icon-sm vertical-center" />}
|
|
|
|
<span className="be-indicator-label break-words space-left">
|
2022-06-09 21:17:13 +00:00
|
|
|
Business Edition Feature
|
|
|
|
</span>
|
2021-12-14 19:14:53 +00:00
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|