-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cloud Security] Rules Combo Box filters Custom component #175175
Changes from 1 commit
03fdd91
4a03581
11a0180
e220abc
4a144ef
390dfe9
f0aab5c
fad1882
7563a50
05284d1
f704d7b
a41599d
5aaeffe
28fa96d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* 2.0. | ||
*/ | ||
import React, { useEffect, useMemo, useState } from 'react'; | ||
import { css } from '@emotion/react'; | ||
import { | ||
Criteria, | ||
EuiButtonEmpty, | ||
|
@@ -14,6 +15,8 @@ import { | |
useEuiTheme, | ||
EuiSwitch, | ||
EuiCheckbox, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { uniqBy } from 'lodash'; | ||
|
@@ -190,7 +193,7 @@ const getColumns = ({ | |
}} | ||
/> | ||
), | ||
width: '3%', | ||
width: '40px', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 40px seems too much for a 16x16 checkbox, can you add a screen shot? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated the screenshot 👍 |
||
sortable: false, | ||
render: (rules, item: CspBenchmarkRulesWithStates) => { | ||
return ( | ||
|
@@ -219,7 +222,7 @@ const getColumns = ({ | |
name: i18n.translate('xpack.csp.rules.rulesTable.ruleNumberColumnLabel', { | ||
defaultMessage: 'Rule Number', | ||
}), | ||
width: '10%', | ||
width: '15%', | ||
sortable: true, | ||
}, | ||
{ | ||
|
@@ -248,20 +251,20 @@ const getColumns = ({ | |
name: i18n.translate('xpack.csp.rules.rulesTable.cisSectionColumnLabel', { | ||
defaultMessage: 'CIS Section', | ||
}), | ||
width: '15%', | ||
width: '24%', | ||
}, | ||
{ | ||
field: 'metadata.name', | ||
name: i18n.translate('xpack.csp.rules.rulesTable.mutedColumnLabel', { | ||
defaultMessage: 'Enabled', | ||
}), | ||
width: '5%', | ||
width: '65px', | ||
truncateText: true, | ||
render: (name, rule: CspBenchmarkRulesWithStates) => { | ||
const rulesObjectRequest = { | ||
benchmark_id: rule?.metadata.benchmark.id, | ||
benchmark_version: rule?.metadata.benchmark.version, | ||
/* Rule number always exists* from 8.7 */ | ||
/* Rule number always exists from 8.7 */ | ||
rule_number: rule?.metadata.benchmark.rule_number!, | ||
rule_id: rule?.metadata.id, | ||
}; | ||
|
@@ -275,13 +278,21 @@ const getColumns = ({ | |
} | ||
}; | ||
return ( | ||
<EuiSwitch | ||
className="eui-textTruncate" | ||
checked={!isRuleMuted} | ||
onChange={useChangeCspRuleStateFn} | ||
data-test-subj={RULES_ROWS_ENABLE_SWITCH_BUTTON} | ||
label="" | ||
/> | ||
<EuiFlexGroup justifyContent="flexEnd"> | ||
<EuiFlexItem grow={false}> | ||
<EuiSwitch | ||
className="eui-textTruncate" | ||
checked={!isRuleMuted} | ||
onChange={useChangeCspRuleStateFn} | ||
data-test-subj={RULES_ROWS_ENABLE_SWITCH_BUTTON} | ||
label="" | ||
compressed={true} | ||
css={css` | ||
padding-left: 18px; | ||
`} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? can you add a screenshot? i think making the column the same width as the widget will be better |
||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
}, | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you highlight what is new here that requires a new version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just ruleNumber and section, previously its only string because we can only filter using 1 rule number and 1 cis section. now its an array because can filter using multiple rule number and cis section