Skip to content

Commit

Permalink
[Security solution] Fixing console errors (#163119)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic authored Aug 16, 2023
1 parent bf6aefe commit 2d2975f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const SelectSystemPromptComponent: React.FC<Props> = ({
dropdownDisplay: (
<EuiFlexGroup gutterSize="none" key={ADD_NEW_SYSTEM_PROMPT}>
<EuiFlexItem grow={true}>
<EuiButtonEmpty iconType="plus" size="xs" data-test-subj="addSystemPrompt">
<EuiButtonEmpty href="#" iconType="plus" size="xs" data-test-subj="addSystemPrompt">
{i18n.ADD_NEW_SYSTEM_PROMPT}
</EuiButtonEmpty>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const ConnectorSelector: React.FC<Props> = React.memo(
dropdownDisplay: (
<EuiFlexGroup gutterSize="none" key={ADD_NEW_CONNECTOR}>
<EuiFlexItem grow={true}>
<EuiButtonEmpty iconType="plus" size="xs">
<EuiButtonEmpty href="#" iconType="plus" size="xs">
{i18n.ADD_NEW_CONNECTOR}
</EuiButtonEmpty>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import {
EuiCard,
EuiFlexGroup,
EuiFlexItem,
EuiImage,
EuiText,
EuiTitle,
useEuiTheme,
} from '@elastic/eui';
import { EuiCard, EuiFlexGroup, EuiFlexItem, EuiImage, EuiTitle, useEuiTheme } from '@elastic/eui';
import React from 'react';
import { css } from '@emotion/react';
import { withLink } from '../links';
Expand Down Expand Up @@ -96,11 +88,8 @@ export const LandingLinksImageCards: React.FC<LandingLinksImagesProps> = React.m
{isBeta && <BetaBadge text={betaOptions?.text} />}
</div>
}
description={
<EuiText size="s" color="text" css={styles.description}>
{description}
</EuiText>
}
titleElement="span"
description={<span css={styles.description}>{description}</span>}
/>
</EuiFlexItem>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ export const useTimelineEventsHandler = ({
totalCount: response.totalCount,
updatedAt: Date.now(),
};
setUpdated(newTimelineResponse.updatedAt);
setTotalCount(newTimelineResponse.totalCount);
if (onNextHandler) onNextHandler(newTimelineResponse);
return newTimelineResponse;
});
Expand Down Expand Up @@ -294,19 +292,7 @@ export const useTimelineEventsHandler = ({
asyncSearch();
refetch.current = asyncSearch;
},
[
skip,
data,
setTotalCount,
entityType,
dataViewId,
setUpdated,
addWarning,
startTracking,
dispatch,
id,
prevFilterStatus,
]
[skip, data, entityType, dataViewId, addWarning, startTracking, dispatch, id, prevFilterStatus]
);

useEffect(() => {
Expand Down Expand Up @@ -392,6 +378,13 @@ export const useTimelineEventsHandler = ({
filterStatus,
]);

useEffect(() => {
if (timelineResponse.totalCount > -1) {
setUpdated(timelineResponse.updatedAt);
setTotalCount(timelineResponse.totalCount);
}
}, [setTotalCount, setUpdated, timelineResponse]);

const timelineEventsSearchHandler = useCallback(
(onNextHandler?: OnNextResponseHandler) => {
if (!deepEqual(prevTimelineRequest.current, timelineRequest)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,19 @@ export const useFieldBrowserOptions: UseFieldBrowserOptions = ({
scopeIdSelector(state, sourcererScope)
);
useEffect(() => {
let ignore = false;
const fetchAndSetDataView = async (dataViewId: string) => {
const aDatView = await dataViews.get(dataViewId);
if (ignore) return;
setDataView(aDatView);
};
if (selectedDataViewId != null && !missingPatterns.length) {
fetchAndSetDataView(selectedDataViewId);
}

return () => {
ignore = true;
};
}, [selectedDataViewId, missingPatterns, dataViews]);

const openFieldEditor = useCallback<OpenFieldEditor>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ export const useTimelineEventsHandler = ({
loadPage: wrappedLoadPage,
updatedAt: 0,
});

useEffect(() => {
if (timelineResponse.updatedAt !== 0) {
setUpdated(timelineResponse.updatedAt);
}
}, [setUpdated, timelineResponse.updatedAt]);

const { addWarning } = useAppToasts();

const timelineSearch = useCallback(
Expand Down Expand Up @@ -252,7 +259,6 @@ export const useTimelineEventsHandler = ({
totalCount: response.totalCount,
updatedAt: Date.now(),
};
setUpdated(newTimelineResponse.updatedAt);
if (id === TimelineId.active) {
activeTimeline.setExpandedDetail({});
activeTimeline.setPageName(pageName);
Expand Down Expand Up @@ -336,7 +342,6 @@ export const useTimelineEventsHandler = ({
startTracking,
data.search,
dataViewId,
setUpdated,
addWarning,
refetchGrid,
wrappedLoadPage,
Expand Down

0 comments on commit 2d2975f

Please sign in to comment.