Skip to content

Commit d898338

Browse files
committed
replace FeatureFlagComponent with direct usage of the store
1 parent 6229cd6 commit d898338

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
import React from 'react'
22
import { EuiLink, EuiTextColor } from '@elastic/eui'
3-
import { FeatureFlags } from 'uiSrc/constants'
3+
import { useSelector } from 'react-redux'
4+
import { FeatureFlags } from 'uiSrc/constants/featureFlags'
45
import { getRouterLinkProps } from 'uiSrc/services'
5-
import FeatureFlagComponent from 'uiSrc/components/feature-flag-component/FeatureFlagComponent'
6+
import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features'
67

78
export interface Props {
8-
path: string
9+
path: string;
910
}
1011

11-
const UsePubSubLink = ({ path }: Props) => (
12-
<FeatureFlagComponent
13-
name={FeatureFlags.envDependent}
14-
otherwise={<div className="cli-output-response-fail" data-testid="user-pub-sub-link-disabled">PubSub not supported in this environment.</div>}
15-
>
12+
const UsePubSubLink = ({ path }: Props) => {
13+
const { [FeatureFlags.envDependent]: envDependentFeature } = useSelector(appFeatureFlagsFeaturesSelector)
14+
if (envDependentFeature?.flag === false) {
15+
return (
16+
<div className="cli-output-response-fail" data-testid="user-pub-sub-link-disabled">PubSub not supported
17+
in this environment.
18+
</div>
19+
)
20+
}
21+
return (
1622
<EuiTextColor color="danger" key={Date.now()} data-testid="user-pub-sub-link">
1723
{'Use '}
1824
<EuiLink {...getRouterLinkProps(path)} color="text" data-test-subj="pubsub-page-btn">
1925
Pub/Sub
2026
</EuiLink>
2127
{' tool to subscribe to channels.'}
2228
</EuiTextColor>
23-
</FeatureFlagComponent>
24-
)
29+
)
30+
}
2531

2632
export default UsePubSubLink

0 commit comments

Comments
 (0)