File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
redisinsight/ui/src/components/pub-sub/UsePubSubLink Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
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'
4
5
import { getRouterLinkProps } from 'uiSrc/services'
5
- import FeatureFlagComponent from 'uiSrc/components/feature-flag-component/FeatureFlagComponent '
6
+ import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features '
6
7
7
8
export interface Props {
8
- path : string
9
+ path : string ;
9
10
}
10
11
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 (
16
22
< EuiTextColor color = "danger" key = { Date . now ( ) } data-testid = "user-pub-sub-link" >
17
23
{ 'Use ' }
18
24
< EuiLink { ...getRouterLinkProps ( path ) } color = "text" data-test-subj = "pubsub-page-btn" >
19
25
Pub/Sub
20
26
</ EuiLink >
21
27
{ ' tool to subscribe to channels.' }
22
28
</ EuiTextColor >
23
- </ FeatureFlagComponent >
24
- )
29
+ )
30
+ }
25
31
26
32
export default UsePubSubLink
You can’t perform that action at this time.
0 commit comments