Skip to content

Commit

Permalink
Improve rules view in detector details (#310)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
amsiglan authored and github-actions[bot] committed Jan 10, 2023
1 parent f8baf63 commit 7ccb0e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, { useState } from 'react';
import { RuleItem } from './types/interfaces';
import { getRulesColumns } from './utils/constants';
import { Search } from '@opensearch-project/oui/src/eui_components/basic_table';
import { ruleTypes, ruleSeverity, ruleSource } from '../../../../../Rules/utils/constants';
import { ruleSeverity, ruleSource } from '../../../../../Rules/utils/constants';

export interface DetectionRulesTableProps {
ruleItems: RuleItem[];
Expand Down Expand Up @@ -43,15 +43,6 @@ export const DetectionRulesTable: React.FC<DetectionRulesTableProps> = ({
schema: true,
},
filters: [
{
type: 'field_value_selection',
field: 'logType',
name: 'Log Type',
multiSelect: true,
options: ruleTypes.map((type: string) => ({
value: type,
})),
},
{
type: 'field_value_selection',
field: 'severity',
Expand All @@ -76,7 +67,7 @@ export const DetectionRulesTable: React.FC<DetectionRulesTableProps> = ({
return (rulePriorityBySeverity[a.severity] || 6) - (rulePriorityBySeverity[b.severity] || 6);
});

const onTableChangeHandler = (pagination: CriteriaWithPagination<T>) => {
const onTableChangeHandler = (pagination: CriteriaWithPagination<RuleItem>) => {
setPagination({ pageIndex: pagination.page.index });
onTableChange && onTableChange(pagination);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

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

Expand Down Expand Up @@ -35,18 +36,28 @@ export const getRulesColumns = (
</EuiLink>
);
},
width: '30%',
sortable: true,
},
{
field: 'severity',
name: 'Rule severity',
width: '10%',
sortable: true,
render: (severity: string) => capitalizeFirstLetter(severity),
},
{
field: 'logType',
name: 'Log type',
width: '10%',
sortable: true,
render: (logType: string) => capitalizeFirstLetter(logType),
},
{
field: 'library',
name: 'Source',
width: '10%',
render: (library: string) => capitalizeFirstLetter(library),
},
{
field: 'description',
Expand Down

0 comments on commit 7ccb0e1

Please sign in to comment.