Skip to content

Commit

Permalink
Merge branch 'main' into serverless/header-bar-2-ii
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Aug 9, 2023
2 parents d57714c + 0b95987 commit d0330d2
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 124 deletions.
3 changes: 2 additions & 1 deletion test/functional/apps/visualize/group6/_tsvb_tsdb_basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');

describe('visual builder tsdb check', function describeIndexTests() {
// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/163454
describe.skip('visual builder tsdb check', function describeIndexTests() {
before(async () => {
log.info(`loading sample TSDB index...`);
await esArchiver.load('test/functional/fixtures/es_archiver/kibana_sample_data_logs_tsdb');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe(
);
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_PREVALENCE_TABLE_DOC_COUNT_CELL).should(
'contain.text',
2
0
);
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_PREVALENCE_TABLE_HOST_PREVALENCE_CELL).should(
'contain.text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { EventKind } from '../../shared/hooks/use_fetch_field_value_pair_by_even

interface PrevalenceDetailsTableCell {
highlightedField: { name: string; values: string[] };
scopeId: string;
}

export const PREVALENCE_TAB_ID = 'prevalence-details';
Expand All @@ -60,7 +59,6 @@ const columns: Array<EuiBasicTableColumn<unknown>> = [
render: (data: PrevalenceDetailsTableCell) => (
<PrevalenceDetailsCountCell
highlightedField={data.highlightedField}
scopeId={data.scopeId}
type={{
eventKind: EventKind.signal,
include: true,
Expand All @@ -75,7 +73,6 @@ const columns: Array<EuiBasicTableColumn<unknown>> = [
render: (data: PrevalenceDetailsTableCell) => (
<PrevalenceDetailsCountCell
highlightedField={data.highlightedField}
scopeId={data.scopeId}
type={{
eventKind: EventKind.signal,
exclude: true,
Expand All @@ -90,7 +87,6 @@ const columns: Array<EuiBasicTableColumn<unknown>> = [
render: (data: PrevalenceDetailsTableCell) => (
<PrevalenceDetailsPrevalenceCell
highlightedField={data.highlightedField}
scopeId={data.scopeId}
aggregationField={'host.name'}
/>
),
Expand All @@ -102,7 +98,6 @@ const columns: Array<EuiBasicTableColumn<unknown>> = [
render: (data: PrevalenceDetailsTableCell) => (
<PrevalenceDetailsPrevalenceCell
highlightedField={data.highlightedField}
scopeId={data.scopeId}
aggregationField={'user.name'}
/>
),
Expand All @@ -129,7 +124,6 @@ export const PrevalenceDetails: React.FC = () => {
name: summaryRow.description.data.field,
values: summaryRow.description.values || [],
},
scopeId,
});

return (summaryRows || []).map((summaryRow) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const highlightedField = {
name: 'field',
values: ['values'],
};
const scopeId = 'scopeId';
const type = {
eventKind: EventKind.signal,
include: true,
Expand All @@ -39,11 +38,7 @@ describe('PrevalenceDetailsAlertCountCell', () => {
});

const { getByTestId } = render(
<PrevalenceDetailsCountCell
highlightedField={highlightedField}
scopeId={scopeId}
type={type}
/>
<PrevalenceDetailsCountCell highlightedField={highlightedField} type={type} />
);

expect(getByTestId(PREVALENCE_DETAILS_COUNT_CELL_LOADING_TEST_ID)).toBeInTheDocument();
Expand All @@ -57,11 +52,7 @@ describe('PrevalenceDetailsAlertCountCell', () => {
});

const { getByTestId } = render(
<PrevalenceDetailsCountCell
highlightedField={highlightedField}
scopeId={scopeId}
type={type}
/>
<PrevalenceDetailsCountCell highlightedField={highlightedField} type={type} />
);

expect(getByTestId(PREVALENCE_DETAILS_COUNT_CELL_ERROR_TEST_ID)).toBeInTheDocument();
Expand All @@ -75,11 +66,7 @@ describe('PrevalenceDetailsAlertCountCell', () => {
});

const { getByTestId } = render(
<PrevalenceDetailsCountCell
highlightedField={highlightedField}
scopeId={scopeId}
type={type}
/>
<PrevalenceDetailsCountCell highlightedField={highlightedField} type={type} />
);

expect(getByTestId(PREVALENCE_DETAILS_COUNT_CELL_VALUE_TEST_ID)).toBeInTheDocument();
Expand All @@ -94,11 +81,7 @@ describe('PrevalenceDetailsAlertCountCell', () => {
});

const { getByTestId } = render(
<PrevalenceDetailsCountCell
highlightedField={highlightedField}
scopeId={scopeId}
type={type}
/>
<PrevalenceDetailsCountCell highlightedField={highlightedField} type={type} />
);

expect(getByTestId(PREVALENCE_DETAILS_COUNT_CELL_VALUE_TEST_ID)).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ import {
} from './test_ids';
import type { EventType } from '../../shared/hooks/use_fetch_field_value_pair_by_event_type';
import { useFetchFieldValuePairByEventType } from '../../shared/hooks/use_fetch_field_value_pair_by_event_type';
import { TimelineId } from '../../../../common/types';

export interface PrevalenceDetailsCountCellProps {
/**
* The highlighted field name and values
* */
highlightedField: { name: string; values: string[] };
/**
* The scope id
*/
scopeId: string;
/**
* Limit the search to include or exclude a specific value for the event.kind field
* (alert, asset, enrichment, event, metric, state, pipeline_error, signal)
Expand All @@ -41,12 +36,10 @@ export interface PrevalenceDetailsCountCellProps {
*/
export const PrevalenceDetailsCountCell: VFC<PrevalenceDetailsCountCellProps> = ({
highlightedField,
scopeId,
type,
}) => {
const { loading, error, count } = useFetchFieldValuePairByEventType({
highlightedField,
isActiveTimelines: scopeId === TimelineId.active,
type,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const highlightedField = {
name: 'field',
values: ['values'],
};
const scopeId = 'scopeId';
const aggregationField = 'aggregationField';

describe('PrevalenceDetailsAlertCountCell', () => {
Expand All @@ -42,7 +41,6 @@ describe('PrevalenceDetailsAlertCountCell', () => {
const { getByTestId } = render(
<PrevalenceDetailsPrevalenceCell
highlightedField={highlightedField}
scopeId={scopeId}
aggregationField={aggregationField}
/>
);
Expand All @@ -65,7 +63,6 @@ describe('PrevalenceDetailsAlertCountCell', () => {
const { getByTestId } = render(
<PrevalenceDetailsPrevalenceCell
highlightedField={highlightedField}
scopeId={scopeId}
aggregationField={aggregationField}
/>
);
Expand All @@ -88,7 +85,6 @@ describe('PrevalenceDetailsAlertCountCell', () => {
const { getByTestId } = render(
<PrevalenceDetailsPrevalenceCell
highlightedField={highlightedField}
scopeId={scopeId}
aggregationField={aggregationField}
/>
);
Expand All @@ -111,7 +107,6 @@ describe('PrevalenceDetailsAlertCountCell', () => {
const { getByTestId } = render(
<PrevalenceDetailsPrevalenceCell
highlightedField={highlightedField}
scopeId={scopeId}
aggregationField={aggregationField}
/>
);
Expand All @@ -134,7 +129,6 @@ describe('PrevalenceDetailsAlertCountCell', () => {
const { getByTestId } = render(
<PrevalenceDetailsPrevalenceCell
highlightedField={highlightedField}
scopeId={scopeId}
aggregationField={aggregationField}
/>
);
Expand All @@ -157,7 +151,6 @@ describe('PrevalenceDetailsAlertCountCell', () => {
const { getByTestId } = render(
<PrevalenceDetailsPrevalenceCell
highlightedField={highlightedField}
scopeId={scopeId}
aggregationField={aggregationField}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ import {
PREVALENCE_DETAILS_PREVALENCE_CELL_VALUE_TEST_ID,
} from './test_ids';
import { useFetchFieldValuePairWithAggregation } from '../../shared/hooks/use_fetch_field_value_pair_with_aggregation';
import { TimelineId } from '../../../../common/types';
import { useFetchUniqueByField } from '../../shared/hooks/use_fetch_unique_by_field';

export interface PrevalenceDetailsPrevalenceCellProps {
/**
* The highlighted field name and values
* */
highlightedField: { name: string; values: string[] };
/**
* The scope id
*/
scopeId: string;
/**
* The aggregation field
*/
Expand All @@ -38,7 +33,6 @@ export interface PrevalenceDetailsPrevalenceCellProps {
*/
export const PrevalenceDetailsPrevalenceCell: VFC<PrevalenceDetailsPrevalenceCellProps> = ({
highlightedField,
scopeId,
aggregationField,
}) => {
const {
Expand All @@ -47,7 +41,6 @@ export const PrevalenceDetailsPrevalenceCell: VFC<PrevalenceDetailsPrevalenceCel
count: aggregationCount,
} = useFetchFieldValuePairWithAggregation({
highlightedField,
isActiveTimelines: scopeId === TimelineId.active,
aggregationField,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const highlightedField = {
name: 'field',
values: ['values'],
};
const scopeId = 'scopeId';
const callbackIfNull = jest.fn();

const panelContextValue = {
Expand Down Expand Up @@ -61,7 +60,6 @@ describe('<PrevalenceOverview />', () => {
prevalenceRows: [
<PrevalenceOverviewRow
highlightedField={highlightedField}
scopeId={scopeId}
callbackIfNull={callbackIfNull}
data-test-subj={'test'}
/>,
Expand Down Expand Up @@ -106,7 +104,6 @@ describe('<PrevalenceOverview />', () => {
prevalenceRows: [
<PrevalenceOverviewRow
highlightedField={highlightedField}
scopeId={scopeId}
callbackIfNull={callbackIfNull}
data-test-subj={'test'}
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const highlightedField = {
name: 'field',
values: ['values'],
};
const scopeId = 'scopeId';
const dataTestSubj = 'test';
const iconDataTestSubj = 'testIcon';
const valueDataTestSubj = 'testValue';
Expand All @@ -41,7 +40,6 @@ describe('<PrevalenceOverviewRow />', () => {
const { getByTestId, getAllByText, queryByTestId } = render(
<PrevalenceOverviewRow
highlightedField={highlightedField}
scopeId={scopeId}
callbackIfNull={() => {}}
data-test-subj={dataTestSubj}
/>
Expand Down Expand Up @@ -71,7 +69,6 @@ describe('<PrevalenceOverviewRow />', () => {
const { queryAllByAltText } = render(
<PrevalenceOverviewRow
highlightedField={highlightedField}
scopeId={scopeId}
callbackIfNull={callbackIfNull}
data-test-subj={dataTestSubj}
/>
Expand All @@ -97,7 +94,6 @@ describe('<PrevalenceOverviewRow />', () => {
const { queryAllByAltText } = render(
<PrevalenceOverviewRow
highlightedField={highlightedField}
scopeId={scopeId}
callbackIfNull={callbackIfNull}
data-test-subj={dataTestSubj}
/>
Expand All @@ -122,7 +118,6 @@ describe('<PrevalenceOverviewRow />', () => {
const { getByTestId } = render(
<PrevalenceOverviewRow
highlightedField={highlightedField}
scopeId={scopeId}
callbackIfNull={() => {}}
data-test-subj={dataTestSubj}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { PREVALENCE_ROW_UNCOMMON } from './translations';
import { useFetchFieldValuePairWithAggregation } from '../../shared/hooks/use_fetch_field_value_pair_with_aggregation';
import { useFetchUniqueByField } from '../../shared/hooks/use_fetch_unique_by_field';
import { InsightsSummaryRow } from './insights_summary_row';
import { TimelineId } from '../../../../common/types';

const HOST_FIELD = 'host.name';
const PERCENTAGE_THRESHOLD = 0.1; // we show the prevalence if its value is below 10%
Expand All @@ -21,10 +20,6 @@ export interface PrevalenceOverviewRowProps {
* The highlighted field name and values
* */
highlightedField: { name: string; values: string[] };
/**
* Maintain backwards compatibility // TODO remove when possible
*/
scopeId: string;
/**
* This is a solution to allow the parent component to NOT render if all its row children are null
*/
Expand All @@ -42,19 +37,15 @@ export interface PrevalenceOverviewRowProps {
*/
export const PrevalenceOverviewRow: VFC<PrevalenceOverviewRowProps> = ({
highlightedField,
scopeId,
callbackIfNull,
'data-test-subj': dataTestSubj,
}) => {
const isActiveTimelines = scopeId === TimelineId.active;

const {
loading: hostsLoading,
error: hostsError,
count: hostsCount,
} = useFetchFieldValuePairWithAggregation({
highlightedField,
isActiveTimelines,
aggregationField: HOST_FIELD,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ export const usePrevalence = ({
return (
<PrevalenceOverviewRow
highlightedField={highlightedField}
scopeId={scopeId}
callbackIfNull={() => setCount((prevCount) => prevCount + 1)}
data-test-subj={INSIGHTS_PREVALENCE_TEST_ID}
key={row.description.data.field}
/>
);
}),
[summaryRows, scopeId]
[summaryRows]
);

return {
Expand Down
Loading

0 comments on commit d0330d2

Please sign in to comment.