Skip to content

Commit be9a2cd

Browse files
[frontend] Enable the ordering in Observables / nested objects panel (#9280)
1 parent 8997343 commit be9a2cd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

opencti-platform/opencti-front/src/private/components/common/stix_nested_ref_relationships/StixNestedRefRelationshipCreationFromEntity.jsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef, useState } from 'react';
1+
import React, { useEffect, useRef, useState } from 'react';
22
import { Field, Form, Formik } from 'formik';
33
import { v4 as uuid } from 'uuid';
44
import { graphql } from 'react-relay';
@@ -503,12 +503,17 @@ const StixNestedRefRelationshipCreationFromEntity = ({
503503
}
504504
};
505505

506+
useEffect(() => {
507+
setSortBy('created_at');
508+
setOrderAsc(false);
509+
}, [searchTerm]);
510+
506511
const renderSelectEntity = () => {
507512
const searchPaginationOptions = {
508513
search: searchTerm,
509514
filters: removeIdFromFilterGroupObject(filters),
510-
orderBy: searchTerm.length > 0 ? null : 'created_at',
511-
orderMode: searchTerm.length > 0 ? null : 'desc',
515+
orderBy: sortBy,
516+
orderMode: orderAsc ? 'asc' : 'desc',
512517
types: targetStixCoreObjectTypes,
513518
};
514519
const dataColumns = {

0 commit comments

Comments
 (0)