Skip to content

Commit fc45e03

Browse files
authored
Merge pull request #220 from keithchong/9219-TechPreviewBadge
Use Tech Preview Badge with Tooltip (#9219)
2 parents 9480ae0 + b18697b commit fc45e03

File tree

12 files changed

+71
-18
lines changed

12 files changed

+71
-18
lines changed

locales/en/plugin__gitops-plugin.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"by name": "by name",
4949
"ConsoleLink": "ConsoleLink",
5050
"ConsoleLinks": "ConsoleLinks",
51+
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
5152
"No GitOps manifest URLs found": "No GitOps manifest URLs found",
5253
"Error cannot retrieve applications": "Cannot retrieve applications. Ensure the Argo CD applications are available and check the log for the 'cluster' pod created by the GitOps Operator.",
5354
"No Application groups found": "No Application groups found",
@@ -213,6 +214,7 @@
213214
"Unable to load data": "Unable to load data",
214215
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
215216
"AppProjects": "ArgoCD AppProjects",
217+
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
216218
"Create AppProject": "Create AppProject",
217219
"Search by name...": "Search by name...",
218220
"Labels": "Labels",
@@ -335,6 +337,7 @@
335337
"Created at": "Created at",
336338
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
337339
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
340+
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
338341
"Sync": "Sync",
339342
"Stop": "Stop",
340343
"Refresh": "Refresh",

locales/ja/plugin__gitops-plugin.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"by name": "名前別",
4949
"ConsoleLink": "ConsoleLink",
5050
"ConsoleLinks": "ConsoleLinks",
51+
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
5152
"No GitOps manifest URLs found": "GitOps マニフェスト URL が見つかりません",
5253
"Error cannot retrieve applications": "エラー、アプリケーションを取得できません",
5354
"No Application groups found": "アプリケーショングループが見つかりません",
@@ -213,6 +214,7 @@
213214
"Unable to load data": "Unable to load data",
214215
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
215216
"AppProjects": "AppProjects",
217+
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
216218
"Create AppProject": "Create AppProject",
217219
"Search by name...": "Search by name...",
218220
"Labels": "Labels",
@@ -335,6 +337,7 @@
335337
"Created at": "Created at",
336338
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
337339
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
340+
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
338341
"Sync": "Sync",
339342
"Stop": "Stop",
340343
"Refresh": "Refresh",

locales/ko/plugin__gitops-plugin.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"by name": "이름 별",
4949
"ConsoleLink": "콘솔 링크",
5050
"ConsoleLinks": "콘솔 링크",
51+
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
5152
"No GitOps manifest URLs found": "GitOps 매니페스트 URL을 찾을 수 없습니다",
5253
"Error cannot retrieve applications": "오류로 인해 애플리케이션을 검색할 수 없습니다",
5354
"No Application groups found": "애플리케이션 그룹을 찾을 수 없습니다",
@@ -213,6 +214,7 @@
213214
"Unable to load data": "Unable to load data",
214215
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
215216
"AppProjects": "AppProjects",
217+
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
216218
"Create AppProject": "Create AppProject",
217219
"Search by name...": "Search by name...",
218220
"Labels": "Labels",
@@ -335,6 +337,7 @@
335337
"Created at": "Created at",
336338
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
337339
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
340+
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
338341
"Sync": "Sync",
339342
"Stop": "Stop",
340343
"Refresh": "Refresh",

locales/zh/plugin__gitops-plugin.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"by name": "按名称",
4949
"ConsoleLink": "控制台链接",
5050
"ConsoleLinks": "控制台链接",
51+
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
5152
"No GitOps manifest URLs found": "未找到 GitOps 清单 URL",
5253
"Error cannot retrieve applications": "错误,无法检索应用程序",
5354
"No Application groups found": "未找到应用程序组",
@@ -213,6 +214,7 @@
213214
"Unable to load data": "Unable to load data",
214215
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
215216
"AppProjects": "AppProjects",
217+
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
216218
"Create AppProject": "Create AppProject",
217219
"Search by name...": "Search by name...",
218220
"Labels": "Labels",
@@ -335,6 +337,7 @@
335337
"Created at": "Created at",
336338
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
337339
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
340+
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
338341
"Sync": "Sync",
339342
"Stop": "Stop",
340343
"Refresh": "Refresh",
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
import * as React from 'react';
2-
import { useTranslation } from 'react-i18next';
2+
import { TFunction, useTranslation } from 'react-i18next';
33

4-
import { Label } from '@patternfly/react-core';
4+
import { Label, Tooltip } from '@patternfly/react-core';
55

66
import './Badge.scss';
77

8-
const TechPreviewBadge: React.FC = () => {
9-
const { t } = useTranslation('plugin__gitops-plugin');
8+
const getBadgeLabel = (t: TFunction) => {
109
return (
1110
<Label className="gitops-plugin__preview-badge">
1211
{t('plugin__gitops-plugin~Tech preview')}
1312
</Label>
1413
);
1514
};
1615

16+
const TechPreviewBadge: React.FC<{ tooltipContent?: string }> = ({ tooltipContent }) => {
17+
const { t } = useTranslation('plugin__gitops-plugin');
18+
return tooltipContent ? (
19+
<Tooltip content={tooltipContent}>{getBadgeLabel(t)}</Tooltip>
20+
) : (
21+
getBadgeLabel(t)
22+
);
23+
};
24+
1725
export default TechPreviewBadge;

src/components/topology/sidebar/DeploymentSideBarDetails.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
33
import classNames from 'classnames';
44
import * as _ from 'lodash';
5+
import TechPreviewBadge from 'src/components/import/badges/TechPreviewBadge';
56

67
import {
78
DetailsTabSectionExtensionHook,
@@ -33,7 +34,6 @@ import { Label as PfLabel, LabelGroup as PfLabelGroup } from '@patternfly/react-
3334
import { PencilAltIcon } from '@patternfly/react-icons';
3435
import { GraphElement } from '@patternfly/react-topology';
3536

36-
import DevPreviewBadge from '../../../components/import/badges/DevPreviewBadge';
3737
import { RolloutKind } from '../types';
3838

3939
export type LabelProps = {
@@ -242,7 +242,9 @@ export const DeploymentSideBarDetails: React.FC<DeploymentSideBarDetailsProps> =
242242
<>
243243
<div className="ocs-sidebar-tabsection">
244244
<div className="co-m-pane__heading-owner">
245-
<DevPreviewBadge />
245+
<TechPreviewBadge
246+
tooltipContent={t('Rollouts in the Topology View is under tech preview')}
247+
/>
246248
<SidebarSectionHeading text={'Rollout'} />
247249
</div>
248250
</div>

src/components/topology/sidebar/resource-sections.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as React from 'react';
2+
import TechPreviewBadge from 'src/components/import/badges/TechPreviewBadge';
23

4+
import { t } from '@gitops/utils/hooks/useGitOpsTranslation';
35
import {
46
DetailsTabSectionExtensionHook,
57
K8sResourceKind,
@@ -8,7 +10,6 @@ import { TopologyDataObject } from '@openshift-console/dynamic-plugin-sdk/lib/ex
810
import { getResource } from '@openshift-console/dynamic-plugin-sdk-internal';
911
import { GraphElement } from '@patternfly/react-topology';
1012

11-
import DevPreviewBadge from '../../../components/import/badges/DevPreviewBadge';
1213
import { PodOverviewItem } from '../console/PodsOverview';
1314
import { usePodsForRollouts } from '../usePodsForRollouts';
1415

@@ -61,7 +62,9 @@ export const ResourceSection: React.FC<{
6162
<div className="ocs-sidebar-tabsection">
6263
<div className="co-m-pane__heading-owner">
6364
<span>
64-
<DevPreviewBadge />
65+
<TechPreviewBadge
66+
tooltipContent={t('Rollouts in the Topology View is under tech preview')}
67+
/>
6568
<SidebarSectionHeading text={'Pods'} />
6669
</span>
6770
<div>

src/gitops/components/project/ProjectList.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { useLocation } from 'react-router-dom-v5-compat';
4-
import DevPreviewBadge from 'src/components/import/badges/DevPreviewBadge';
4+
import TechPreviewBadge from 'src/components/import/badges/TechPreviewBadge';
55

66
import ActionsDropdown from '@gitops/utils/components/ActionDropDown/ActionDropDown';
77
import { modelToGroupVersionKind, modelToRef } from '@gitops/utils/utils';
@@ -195,7 +195,13 @@ const ProjectList: React.FC<ProjectListTabProps> = ({
195195
<ListPageHeader
196196
title={t('AppProjects')}
197197
badge={
198-
location?.pathname?.includes('openshift-gitops-operator') ? null : <DevPreviewBadge />
198+
location?.pathname?.includes('openshift-gitops-operator') ? null : (
199+
<TechPreviewBadge
200+
tooltipContent={t(
201+
'This list page is under tech preview, but not necessarily the resources it represents',
202+
)}
203+
/>
204+
)
199205
}
200206
helpText={
201207
location.pathname?.includes('openshift-gitops-operator') ? (

src/gitops/components/rollout/RolloutList.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { Link } from 'react-router-dom-v5-compat';
33
import classNames from 'classnames';
4-
import DevPreviewBadge from 'src/components/import/badges/DevPreviewBadge';
4+
import TechPreviewBadge from 'src/components/import/badges/TechPreviewBadge';
55

66
import { AppProjectKind } from '@gitops/models/AppProjectModel';
77
import ActionsDropdown from '@gitops/utils/components/ActionDropDown/ActionDropDown';
@@ -181,7 +181,13 @@ const RolloutList: React.FC<RolloutListTabProps> = ({
181181
<ListPageHeader
182182
title={t('Argo Rollouts')}
183183
badge={
184-
location.pathname?.includes('openshift-gitops-operator') ? null : <DevPreviewBadge />
184+
location.pathname?.includes('openshift-gitops-operator') ? null : (
185+
<TechPreviewBadge
186+
tooltipContent={t(
187+
'This list page is under tech preview, but not necessarily the resources it represents',
188+
)}
189+
/>
190+
)
185191
}
186192
helpText={
187193
location.pathname?.includes('openshift-gitops-operator') ? (

src/gitops/components/shared/ApplicationList.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
3-
import DevPreviewBadge from 'src/components/import/badges/DevPreviewBadge';
3+
import TechPreviewBadge from 'src/components/import/badges/TechPreviewBadge';
44

55
import { ApplicationSetKind } from '@gitops/models/ApplicationSetModel';
66
import {
@@ -206,7 +206,13 @@ const ApplicationList: React.FC<ApplicationProps> = ({
206206
<ListPageHeader
207207
title={t('plugin__gitops-plugin~Applications')}
208208
badge={
209-
location.pathname?.includes('openshift-gitops-operator') ? null : <DevPreviewBadge />
209+
location.pathname?.includes('openshift-gitops-operator') ? null : (
210+
<TechPreviewBadge
211+
tooltipContent={t(
212+
'This list page is under tech preview, but not necessarily the resources it represents',
213+
)}
214+
/>
215+
)
210216
}
211217
helpText={
212218
location.pathname?.includes('openshift-gitops-operator') ? (

0 commit comments

Comments
 (0)