Skip to content

Commit 7ccb0e1

Browse files
amsiglangithub-actions[bot]
authored andcommitted
Improve rules view in detector details (#310)
* updated column widths Signed-off-by: Amardeepsingh Siglani <[email protected]> * improved typography; removed log type filter Signed-off-by: Amardeepsingh Siglani <[email protected]> Signed-off-by: Amardeepsingh Siglani <[email protected]> (cherry picked from commit 9dba6c1)
1 parent f8baf63 commit 7ccb0e1

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

public/pages/CreateDetector/components/DefineDetector/components/DetectionRules/DetectionRulesTable.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React, { useState } from 'react';
88
import { RuleItem } from './types/interfaces';
99
import { getRulesColumns } from './utils/constants';
1010
import { Search } from '@opensearch-project/oui/src/eui_components/basic_table';
11-
import { ruleTypes, ruleSeverity, ruleSource } from '../../../../../Rules/utils/constants';
11+
import { ruleSeverity, ruleSource } from '../../../../../Rules/utils/constants';
1212

1313
export interface DetectionRulesTableProps {
1414
ruleItems: RuleItem[];
@@ -43,15 +43,6 @@ export const DetectionRulesTable: React.FC<DetectionRulesTableProps> = ({
4343
schema: true,
4444
},
4545
filters: [
46-
{
47-
type: 'field_value_selection',
48-
field: 'logType',
49-
name: 'Log Type',
50-
multiSelect: true,
51-
options: ruleTypes.map((type: string) => ({
52-
value: type,
53-
})),
54-
},
5546
{
5647
type: 'field_value_selection',
5748
field: 'severity',
@@ -76,7 +67,7 @@ export const DetectionRulesTable: React.FC<DetectionRulesTableProps> = ({
7667
return (rulePriorityBySeverity[a.severity] || 6) - (rulePriorityBySeverity[b.severity] || 6);
7768
});
7869

79-
const onTableChangeHandler = (pagination: CriteriaWithPagination<T>) => {
70+
const onTableChangeHandler = (pagination: CriteriaWithPagination<RuleItem>) => {
8071
setPagination({ pageIndex: pagination.page.index });
8172
onTableChange && onTableChange(pagination);
8273
};

public/pages/CreateDetector/components/DefineDetector/components/DetectionRules/utils/constants.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { EuiBasicTableColumn, EuiLink, EuiSwitch } from '@elastic/eui';
7+
import { capitalizeFirstLetter } from '../../../../../../../utils/helpers';
78
import React, { ReactNode } from 'react';
89
import { RuleItem } from '../types/interfaces';
910

@@ -35,18 +36,28 @@ export const getRulesColumns = (
3536
</EuiLink>
3637
);
3738
},
39+
width: '30%',
40+
sortable: true,
3841
},
3942
{
4043
field: 'severity',
4144
name: 'Rule severity',
45+
width: '10%',
46+
sortable: true,
47+
render: (severity: string) => capitalizeFirstLetter(severity),
4248
},
4349
{
4450
field: 'logType',
4551
name: 'Log type',
52+
width: '10%',
53+
sortable: true,
54+
render: (logType: string) => capitalizeFirstLetter(logType),
4655
},
4756
{
4857
field: 'library',
4958
name: 'Source',
59+
width: '10%',
60+
render: (library: string) => capitalizeFirstLetter(library),
5061
},
5162
{
5263
field: 'description',

0 commit comments

Comments
 (0)