Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit a5e2fa8

Browse files
authored
feat(RHINENG:19590): Lightspeed Rebrand prep (#580)
* feat(RHINENG:19590): Lightspeed Rebrand prep * fix(lint): fix linting issues
1 parent 971b38b commit a5e2fa8

File tree

7 files changed

+77
-35
lines changed

7 files changed

+77
-35
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@redhat-cloud-services/frontend-components-utilities": "^5.0.13",
1616
"@redhat-cloud-services/insights-common-typescript": "^6.1.3",
1717
"@sentry/webpack-plugin": "^3.3.1",
18+
"@unleash/proxy-client-react": "^5.0.1",
1819
"antlr4ts": "0.5.0-alpha.4",
1920
"assert-never": "1.2.1",
2021
"axios": "^1.7.7",
@@ -39,6 +40,7 @@
3940
"redux-logger": "^3.0.6",
4041
"redux-promise-middleware": "^6.2.0",
4142
"typestyle": "2.1.0",
43+
"unleash-proxy-client": "^3.7.8",
4244
"yup": "0.32.9",
4345
"zod": "1.11.11"
4446
},

src/components/Policy/ActionForm/ActionNotificationForm.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { format } from 'react-string-format';
66

77
import { AppContext } from '../../../app/AppContext';
88
import Config from '../../../config/Config';
9-
import { Messages } from '../../../properties/Messages';
9+
import { Messages, useFeatureFlag } from '../../../properties/Messages';
1010
import { getOuiaProps } from '../../../utils/getOuiaProps';
1111
import { ActionFormProps } from './ActionFormProps';
1212

1313
export const ActionNotificationForm: React.FunctionComponent<ActionFormProps> = (props: ActionFormProps) => {
1414

1515
const hooksUrl = React.useMemo(() => Config.pages.notifications(), []);
1616
const appContext = useContext(AppContext);
17-
17+
const isLightspeedEnabled = useFeatureFlag('platform.lightspeed-rebrand');
1818
return (
1919
<div { ...getOuiaProps('Policy/Action/Hook', props) }>
2020
<Text>
@@ -28,7 +28,8 @@ export const ActionNotificationForm: React.FunctionComponent<ActionFormProps> =
2828
{ !appContext.userSettings.isSubscribedForNotifications && (
2929
<InsightsEmailOptIn
3030
ouiaId="action-email.wizard-email-required"
31-
content={ Messages.wizards.policy.actions.emailOptIn }
31+
content={ isLightspeedEnabled ? Messages.wizards.policy.actions.emailOptInLightspeed
32+
: Messages.wizards.policy.actions.emailOptIn }
3233
bundle="rhel"
3334
insights={ getInsights() }
3435
/>

src/components/Policy/Wizard/Usage.tsx

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as React from 'react';
44
import { style } from 'typestyle';
55

66
import Config from '../../../config/Config';
7-
import { Messages } from '../../../properties/Messages';
7+
import { Messages, useFeatureFlag } from '../../../properties/Messages';
88
import { getOuiaProps } from '../../../utils/getOuiaProps';
99

1010
const codeClass = style({
@@ -21,33 +21,35 @@ const padLeftClassName = style({
2121

2222
// build the text as we expect it to look but this is manual and not automatic
2323
// We'll need to revisit this later.
24-
class TextItemExtension extends React.Component {
25-
render() {
26-
return (
27-
<TextContent className={ padLeftClassName } >
28-
<Text component={ TextVariants.p }>{ Messages.wizards.policy.hints.hintParagraph1 }</Text>
29-
<Text
30-
component={ TextVariants.a }
31-
className={ linkMarginClassName }
32-
href={ Config.pages.factsDocumentation }
33-
target="_blank"
34-
rel='noopener noreferrer'
35-
>
36-
{ Messages.wizards.policy.hints.hintLinkTitle }
37-
</Text>
38-
<Text component={ TextVariants.h5 } className="lg">{ Messages.wizards.policy.hints.hintSyntaxExamplesSection }</Text>
39-
<Text >{ Messages.wizards.policy.hints.hintQuestion1 }</Text>
40-
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion1Ans }</i></Text>
41-
<Text >{ Messages.wizards.policy.hints.hintQuestion2 }</Text>
42-
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion2Ans }</i></Text>
43-
<Text >{ Messages.wizards.policy.hints.hintQuestion3 }</Text>
44-
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion3Ans }</i></Text>
45-
<Text >{ Messages.wizards.policy.hints.hintQuestion4 }</Text>
46-
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion4Ans }</i></Text>
47-
</TextContent>
48-
);
49-
}
50-
}
24+
const TextItemExtension: React.FunctionComponent = () => {
25+
const isLightspeedEnabled = useFeatureFlag('platform.lightspeed-rebrand');
26+
return (
27+
<TextContent className={ padLeftClassName } >
28+
<Text component={ TextVariants.p }>
29+
{ isLightspeedEnabled ? Messages.wizards.policy.hints.hintParagraph1Lightspeed : Messages.wizards.policy.hints.hintParagraph1 }
30+
</Text>
31+
<Text
32+
component={ TextVariants.a }
33+
className={ linkMarginClassName }
34+
href={ Config.pages.factsDocumentation }
35+
target="_blank"
36+
rel='noopener noreferrer'
37+
>
38+
{ Messages.wizards.policy.hints.hintLinkTitle }
39+
</Text>
40+
<Text component={ TextVariants.h5 } className="lg">{ Messages.wizards.policy.hints.hintSyntaxExamplesSection }</Text>
41+
<Text >{ Messages.wizards.policy.hints.hintQuestion1 }</Text>
42+
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion1Ans }</i></Text>
43+
<Text >{ Messages.wizards.policy.hints.hintQuestion2 }</Text>
44+
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion2Ans }</i></Text>
45+
<Text >{ Messages.wizards.policy.hints.hintQuestion3 }</Text>
46+
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion3Ans }</i></Text>
47+
<Text >{ Messages.wizards.policy.hints.hintQuestion4 }</Text>
48+
<Text component={ TextVariants.p } className={ codeClass }><i>{ Messages.wizards.policy.hints.hintQuestion4Ans }</i></Text>
49+
</TextContent>
50+
);
51+
};
52+
5153
const Usage: React.FunctionComponent<OuiaComponentProps> = (props) => {
5254
return (
5355
<>

src/hooks/useFeatureFlag.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { useFlag, useFlagsStatus } from '@unleash/proxy-client-react';
2+
3+
export const useFeatureFlag = (flag: string) => {
4+
const { flagsReady } = useFlagsStatus();
5+
const isFlagEnabled = useFlag(flag);
6+
return flagsReady ? isFlagEnabled : false;
7+
};

src/pages/ListPage/ListPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { PolicyToolbar } from '../../components/Policy/TableToolbar/PolicyTableT
1616
import Config from '../../config/Config';
1717
import { usePolicyFilter, usePolicyPage, usePolicyRows } from '../../hooks';
1818
import { usePolicyToDelete } from '../../hooks/usePolicyToDelete';
19-
import { Messages } from '../../properties/Messages';
19+
import { Messages, useFeatureFlag } from '../../properties/Messages';
2020
import { useGetPoliciesQuery } from '../../services/useGetPolicies';
2121
import { useMassChangePolicyEnabledMutation } from '../../services/useMassChangePolicyEnabled';
2222
import { ActionType, Policy } from '../../types/Policy';
@@ -193,6 +193,7 @@ const ListPage: React.FunctionComponent<unknown> = () => {
193193
getPoliciesQueryReload
194194
]
195195
);
196+
const isLightspeedEnabled = useFeatureFlag('platform.lightspeed-rebrand');
196197

197198
return (
198199
<>
@@ -256,7 +257,7 @@ const ListPage: React.FunctionComponent<unknown> = () => {
256257
<PageSection className={ emailOptinPageClassName }>
257258
<InsightsEmailOptIn
258259
ouiaId="list-email-required"
259-
content={ Messages.pages.listPage.emailOptIn }
260+
content={ isLightspeedEnabled ? Messages.pages.listPage.emailOptInLightspeed : Messages.pages.listPage.emailOptIn }
260261
insights={ getInsights() }
261262
bundle="rhel"
262263
/>

src/properties/Messages.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { DeepReadonly } from 'ts-essentials';
22

3+
import { useFeatureFlag } from '../hooks/useFeatureFlag';
34
import { ActionType } from '../types/Policy/Actions';
45

6+
// Re-export useFeatureFlag for convenience
7+
export { useFeatureFlag };
8+
59
const actionTypeToText: Record<ActionType, string> = {
610
[ActionType.NOTIFICATION]: 'Notification'
711
};
@@ -28,6 +32,9 @@ const MutableMessages = {
2832
emailOptIn: 'One or more of your policies has a notification which may send an email. You can configure these notifications in the ' +
2933
'{0} for your organization. In order to receive emails from Insights, opt in to email notifications in your ' +
3034
'user preferences.',
35+
emailOptInLightspeed: 'One or more of your policies has a notification which may send an email. You can configure ' +
36+
'these notifications in the {0} for your organization. In order to receive emails from Red Hat Lightspeed, ' +
37+
'opt in to email notifications in your user preferences.',
3138
emptyState: {
3239
title: 'No Policies',
3340
text: [
@@ -133,7 +140,9 @@ const MutableMessages = {
133140
actions: {
134141
title: 'Trigger actions',
135142
emailOptIn: 'The notification for this policy sends an email from Red Hat Insights.' +
136-
' To receive emails from Insights, opt in to email notifications in your user preferences.'
143+
' To receive emails from Insights, opt in to email notifications in your user preferences.',
144+
emailOptInLightspeed: 'The notification for this policy sends an email from Red Hat Lightspeed.' +
145+
' To receive emails from Red Hat Lightspeed, opt in to email notifications in your user preferences.'
137146
},
138147
conditions: {
139148
title: 'Conditions',
@@ -146,6 +155,8 @@ const MutableMessages = {
146155
hints: {
147156
hintTitle: 'What conditions can I define?',
148157
hintParagraph1: 'You can write a condition for any combination of system facts that apply to your Insights inventory systems.',
158+
hintParagraph1Lightspeed: 'You can write a condition for any combination of system facts that apply to ' +
159+
'your Red Hat Lightspeed inventory systems.',
149160
hintLinkTitle: 'Review available system facts',
150161
// hintLinkTitleValue: '', // set this later.
151162
hintSyntaxExamplesSection: 'Syntax examples',

yarn.lock

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3524,6 +3524,11 @@
35243524
resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8"
35253525
integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==
35263526

3527+
"@unleash/proxy-client-react@^5.0.1":
3528+
version "5.0.1"
3529+
resolved "https://registry.yarnpkg.com/@unleash/proxy-client-react/-/proxy-client-react-5.0.1.tgz#0fbab3e5ef0a0e6281828617ad590f79f8248406"
3530+
integrity sha512-F/IDo853ghZkGreLWg4fSVSM4NiLg5aZb1Kvr4vG29u5/PB0JLKNgNVdadt+qrlkI1GMzmP7IuFXSnv9A0McRw==
3531+
35273532
"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1":
35283533
version "1.12.1"
35293534
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.12.1.tgz#bb16a0e8b1914f979f45864c23819cc3e3f0d4bb"
@@ -12727,6 +12732,11 @@ thunky@^1.0.2:
1272712732
resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d"
1272812733
integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==
1272912734

12735+
tiny-emitter@^2.1.0:
12736+
version "2.1.0"
12737+
resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423"
12738+
integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==
12739+
1273012740
tiny-warning@^1.0.2:
1273112741
version "1.0.3"
1273212742
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
@@ -13149,6 +13159,14 @@ universalify@^2.0.0:
1314913159
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
1315013160
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
1315113161

13162+
unleash-proxy-client@^3.7.8:
13163+
version "3.7.8"
13164+
resolved "https://registry.yarnpkg.com/unleash-proxy-client/-/unleash-proxy-client-3.7.8.tgz#ab09f56ea1c51c68a97ed013de5abff99bea77d9"
13165+
integrity sha512-VX0jDcOporeVb1nh4+HGpEZIwcwHl/HP/7cyZxQq3umffN0hx44Tw1u4nmdopmm9s7Hb2BES0pFCIntr/lh3vQ==
13166+
dependencies:
13167+
tiny-emitter "^2.1.0"
13168+
uuid "^9.0.1"
13169+
1315213170
unpipe@1.0.0, unpipe@~1.0.0:
1315313171
version "1.0.0"
1315413172
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
@@ -13244,7 +13262,7 @@ uuid@^8.3.2:
1324413262
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
1324513263
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
1324613264

13247-
uuid@^9.0.0:
13265+
uuid@^9.0.0, uuid@^9.0.1:
1324813266
version "9.0.1"
1324913267
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
1325013268
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==

0 commit comments

Comments
 (0)