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

[SIEM] [Detections] Fix open close signal on detail page #56757

Merged
merged 1 commit into from
Feb 4, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ const SignalsTableComponent: React.FC<SignalsTableComponentProps> = ({
dataProviders: [],
indexPattern: indexPatterns,
browserFields,
filters: globalFilters,
filters: isEmpty(defaultFilters)
? globalFilters
: [...(defaultFilters ?? []), ...globalFilters],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Doesn't isEmpty catch the null and undefined, do you need the ?? []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but typescript is still yelling at me

kqlQuery: globalQuery,
kqlMode: globalQuery.language,
start: from,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const typicalSetStatusSignalByIdsPayload = (): Partial<SignalsStatusRestP
});

export const typicalSetStatusSignalByQueryPayload = (): Partial<SignalsStatusRestParams> => ({
query: { range: { '@timestamp': { gte: 'now-2M', lte: 'now/M' } } },
query: { bool: { filter: { range: { '@timestamp': { gte: 'now-2M', lte: 'now/M' } } } } },
status: 'closed',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export const setSignalsStatusRouteDef = (server: ServerFacade): Hapi.ServerRoute
queryObject = { ids: { values: signalIds } };
}
if (query) {
queryObject = query;
queryObject = {
bool: {
filter: query,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised you are locking down the backend to only work with a filter query? This does make the backend more limited with this change where every query is now a filter?

If @dhurley14 is ok with the API change then this is good. Just pointing out I typically would try to keep the API as flexible as we can and push the logic more front end when it does the query.

But...Like I said if @dhurley14 sees this as the correct path I am ok because sometimes things like this is a bit of an "art form" where you do want to lock things down more compared to keeping them "loose".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I thought the same thing. The query for open / close is copied across a couple different areas of the frontend so this was the "quicker" fix but long term we definitely should keep this more flexible. There might be a larger discussion around exposing crud operations on the signals index itself. Just a thought.

But yes I agree I would like to keep the API flexible. Quick fix for now though. I'll open an issue to come back to this in the near future.

},
};
}
try {
return callWithRequest(request, 'updateByQuery', {
Expand Down