File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
x-pack/legacy/plugins/siem/public/pages/detection_engine/rules
components/all_rules_tables Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,6 @@ export const getColumns = ({
144144 </ LocalizedDateTooltip >
145145 ) ;
146146 } ,
147- sortable : true ,
148147 truncateText : true ,
149148 width : '20%' ,
150149 } ,
@@ -180,7 +179,7 @@ export const getColumns = ({
180179 } ,
181180 {
182181 align : 'center' ,
183- field : 'activate ' ,
182+ field : 'enabled ' ,
184183 name : i18n . COLUMN_ACTIVATE ,
185184 render : ( value : Rule [ 'enabled' ] , item : Rule ) => (
186185 < RuleSwitch
@@ -283,7 +282,6 @@ export const getMonitoringColumns = (): RulesStatusesColumns[] => {
283282 </ LocalizedDateTooltip >
284283 ) ;
285284 } ,
286- sortable : true ,
287285 truncateText : true ,
288286 width : '20%' ,
289287 } ,
Original file line number Diff line number Diff line change @@ -41,11 +41,12 @@ import { showRulesTable } from './helpers';
4141import { allRulesReducer , State } from './reducer' ;
4242import { RulesTableFilters } from './rules_table_filters/rules_table_filters' ;
4343
44+ const SORT_FIELD = 'enabled' ;
4445const initialState : State = {
4546 exportRuleIds : [ ] ,
4647 filterOptions : {
4748 filter : '' ,
48- sortField : 'enabled' ,
49+ sortField : SORT_FIELD ,
4950 sortOrder : 'desc' ,
5051 } ,
5152 loadingRuleIds : [ ] ,
@@ -127,9 +128,7 @@ export const AllRules = React.memo<AllRulesProps>(
127128 } ) ;
128129
129130 const sorting = useMemo (
130- ( ) => ( {
131- sort : { field : 'enabled' , direction : filterOptions . sortOrder } ,
132- } ) ,
131+ ( ) => ( { sort : { field : 'enabled' , direction : filterOptions . sortOrder } } ) ,
133132 [ filterOptions . sortOrder ]
134133 ) ;
135134
@@ -171,7 +170,7 @@ export const AllRules = React.memo<AllRulesProps>(
171170 dispatch ( {
172171 type : 'updateFilterOptions' ,
173172 filterOptions : {
174- sortField : 'enabled' , // Only enabled is supported for sorting currently
173+ sortField : SORT_FIELD , // Only enabled is supported for sorting currently
175174 sortOrder : sort ?. direction ?? 'desc' ,
176175 } ,
177176 pagination : { page : page . index + 1 , perPage : page . size } ,
Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ export const allRulesReducer = (
6666 tableRef . current != null &&
6767 tableRef . current . changeSelection != null
6868 ) {
69- tableRef . current . changeSelection ( [ ] ) ;
69+ // for future devs: eui basic table is not giving us a prop to set the value, so
70+ // we are using the ref in setTimeout to reset on the next loop so that we
71+ // do not get a warning telling us we are trying to update during a render
72+ window . setTimeout ( ( ) => tableRef ?. current ?. changeSelection ( [ ] ) , 0 ) ;
7073 }
7174
7275 return {
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ const AllRulesTablesComponent: React.FC<AllRulesTablesProps> = ({
9797 onChange = { tableOnChangeCallback }
9898 pagination = { paginationMemo }
9999 ref = { tableRef }
100- { ... sorting }
100+ sorting = { sorting }
101101 selection = { hasNoPermissions ? undefined : euiBasicTableSelectionProps }
102102 />
103103 ) }
@@ -111,7 +111,7 @@ const AllRulesTablesComponent: React.FC<AllRulesTablesProps> = ({
111111 noItemsMessage = { emptyPrompt }
112112 onChange = { tableOnChangeCallback }
113113 pagination = { paginationMemo }
114- { ... sorting }
114+ sorting = { sorting }
115115 />
116116 ) }
117117 </ >
You can’t perform that action at this time.
0 commit comments