1
1
import React , { FunctionComponent } from "react" ;
2
2
import "./RuleList.css" ;
3
- import { Button , Flex , FlexItem , Grid , GridItem , Tooltip } from "@patternfly/react-core" ;
3
+ import { Button , Flex , FlexItem , Grid , GridItem , TextContent , Tooltip } from "@patternfly/react-core" ;
4
4
import { CheckIcon , CodeBranchIcon , OkIcon , TrashIcon } from "@patternfly/react-icons" ;
5
- import { CompatibilitySelect , IfAuth , IfFeature , IntegritySelect , ValiditySelect } from "@app/components" ;
5
+ import {
6
+ CompatibilityLabel ,
7
+ CompatibilitySelect ,
8
+ IntegrityLabel ,
9
+ IntegritySelect ,
10
+ RuleValue ,
11
+ ValidityLabel ,
12
+ ValiditySelect
13
+ } from "@app/components" ;
6
14
import { Rule } from "@models/rule.model.ts" ;
7
15
8
16
@@ -11,6 +19,7 @@ export type RuleListProps = {
11
19
onDisableRule : ( ruleType : string ) => void ;
12
20
onConfigureRule : ( ruleType : string , config : string ) => void ;
13
21
rules : Rule [ ] ;
22
+ isGlobalRules : boolean ;
14
23
} ;
15
24
16
25
const NAME_COLUMN_WIDTH : string = "250px" ;
@@ -63,6 +72,12 @@ export const RuleList: FunctionComponent<RuleListProps> = (props: RuleListProps)
63
72
} ;
64
73
} ;
65
74
75
+ const validityRuleLabel : React . ReactElement = (
76
+ < TextContent >
77
+ < ValidityLabel value = { getRuleConfig ( "VALIDITY" ) } />
78
+ </ TextContent >
79
+ ) ;
80
+
66
81
let validityRuleActions : React . ReactElement = (
67
82
< Button variant = "secondary"
68
83
key = "enable-action"
@@ -82,6 +97,13 @@ export const RuleList: FunctionComponent<RuleListProps> = (props: RuleListProps)
82
97
</ React . Fragment >
83
98
) ;
84
99
}
100
+
101
+ const compatibilityRuleLabel : React . ReactElement = (
102
+ < TextContent >
103
+ < CompatibilityLabel value = { getRuleConfig ( "COMPATIBILITY" ) } />
104
+ </ TextContent >
105
+ ) ;
106
+
85
107
let compatibilityRuleActions : React . ReactElement = (
86
108
< Button variant = "secondary"
87
109
key = "enable-action"
@@ -101,6 +123,13 @@ export const RuleList: FunctionComponent<RuleListProps> = (props: RuleListProps)
101
123
</ React . Fragment >
102
124
) ;
103
125
}
126
+
127
+ const integrityRuleLabel : React . ReactElement = (
128
+ < TextContent >
129
+ < IntegrityLabel value = { getRuleConfig ( "INTEGRITY" ) } />
130
+ </ TextContent >
131
+ ) ;
132
+
104
133
let integrityRuleActions : React . ReactElement = (
105
134
< Button variant = "secondary"
106
135
key = "enable-action"
@@ -147,11 +176,7 @@ export const RuleList: FunctionComponent<RuleListProps> = (props: RuleListProps)
147
176
</ Tooltip >
148
177
</ FlexItem >
149
178
< FlexItem className = "rule-actions" >
150
- < IfAuth isDeveloper = { true } >
151
- < IfFeature feature = "readOnly" isNot = { true } >
152
- { validityRuleActions }
153
- </ IfFeature >
154
- </ IfAuth >
179
+ < RuleValue isGlobalRule = { props . isGlobalRules } actions = { validityRuleActions } label = { validityRuleLabel } />
155
180
</ FlexItem >
156
181
</ Flex >
157
182
</ GridItem >
@@ -169,11 +194,7 @@ export const RuleList: FunctionComponent<RuleListProps> = (props: RuleListProps)
169
194
</ Tooltip >
170
195
</ FlexItem >
171
196
< FlexItem className = "rule-actions" >
172
- < IfAuth isDeveloper = { true } >
173
- < IfFeature feature = "readOnly" isNot = { true } >
174
- { compatibilityRuleActions }
175
- </ IfFeature >
176
- </ IfAuth >
197
+ < RuleValue isGlobalRule = { props . isGlobalRules } actions = { compatibilityRuleActions } label = { compatibilityRuleLabel } />
177
198
</ FlexItem >
178
199
</ Flex >
179
200
</ GridItem >
@@ -191,11 +212,7 @@ export const RuleList: FunctionComponent<RuleListProps> = (props: RuleListProps)
191
212
</ Tooltip >
192
213
</ FlexItem >
193
214
< FlexItem className = "rule-actions" >
194
- < IfAuth isDeveloper = { true } >
195
- < IfFeature feature = "readOnly" isNot = { true } >
196
- { integrityRuleActions }
197
- </ IfFeature >
198
- </ IfAuth >
215
+ < RuleValue isGlobalRule = { props . isGlobalRules } actions = { integrityRuleActions } label = { integrityRuleLabel } />
199
216
</ FlexItem >
200
217
</ Flex >
201
218
</ GridItem >
0 commit comments