Skip to content
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

[frontend] Fix pagination Options for SDO creation in container #6202

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { emptyFilterGroup } from '../../../../utils/filters/filtersUtils';
import Drawer from '../drawer/Drawer';
import useAttributes from '../../../../utils/hooks/useAttributes';
import { usePaginationLocalStorage } from '../../../../utils/hooks/useLocalStorage';
import { removeEmptyFields } from '../../../../utils/utils';

const useStyles = makeStyles((theme) => ({
createButton: {
Expand Down Expand Up @@ -99,12 +100,12 @@ const ContainerAddStixCoreObjects = (props) => {
const isTypeDomainObject = (types) => {
return !types
|| types.some((r) => stixDomainObjectTypes.indexOf(r) >= 0)
|| (types.length === 1 && types[0] === 'Stix-Domain-Object');
|| types.includes('Stix-Domain-Object');
};
const isTypeObservable = (types) => {
return !types
|| types.some((r) => stixCyberObservableTypes.indexOf(r) >= 0)
|| (types.length === 1 && types[0] === 'Stix-Cyber-Observable');
|| types.includes('Stix-Cyber-Observable');
};

const resolveAvailableTypes = () => {
Expand Down Expand Up @@ -144,10 +145,6 @@ const ContainerAddStixCoreObjects = (props) => {
? targetEntityTypesFilterGroup
: emptyFilterGroup,
types: [resolveAvailableTypes()],
numberOfElements: {
number: 0,
symbol: '',
},
},
true,
);
Expand Down Expand Up @@ -275,6 +272,7 @@ const ContainerAddStixCoreObjects = (props) => {
);
};
const renderEntityCreation = (searchPaginationOptions) => {
console.log(targetStixCoreObjectTypes);
if (
targetStixCoreObjectTypes
&& isTypeDomainObject(targetStixCoreObjectTypes)
Expand Down Expand Up @@ -374,10 +372,12 @@ const ContainerAddStixCoreObjects = (props) => {
</ListLines>
);
};
const searchPaginationOptions = {
...addObjectsPaginationOptions,

const { count: _, ...paginationOptionsNoCount } = addObjectsPaginationOptions;
const searchPaginationOptions = removeEmptyFields({
...paginationOptionsNoCount,
search: keyword,
};
});
const renderButton = () => {
if (knowledgeGraph) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ const useStyles = makeStyles(() => ({
},
}));

const StixCoreObjectsField = ({ name, style, helpertext }) => {
const StixCoreObjectsField = (props) => {
const { name, style, helpertext } = props;
const classes = useStyles();
const { t_i18n } = useFormatter();
const { stixCoreObjectTypes: entityTypes } = useAttributes();
Expand Down