Skip to content

Commit

Permalink
Event analytics jest tests (#651)
Browse files Browse the repository at this point in the history
* Bump prismjs from 1.25.0 to 1.27.0 in /dashboards-observability (#508) (#574)

Bumps [prismjs](https://github.com/PrismJS/prism) from 1.25.0 to 1.27.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](PrismJS/prism@v1.25.0...v1.27.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit b4f491a)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* change to support java 8 in compile and runtime (#575) (#576)

Signed-off-by: Zhongnan Su <[email protected]>
(cherry picked from commit 5c43e9d)

Co-authored-by: Zhongnan Su <[email protected]>

* Add 1.3.0 release notes (#580) (#582)

Signed-off-by: Eugene Lee <[email protected]>

* restructure event analytics folders

Signed-off-by: Eric Wei <[email protected]>

* jest tests

Signed-off-by: Eric Wei <[email protected]>

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Zhongnan Su <[email protected]>
  • Loading branch information
4 people authored Apr 14, 2022
1 parent 4561077 commit 6b30bee
Show file tree
Hide file tree
Showing 185 changed files with 8,992 additions and 18,998 deletions.
2 changes: 1 addition & 1 deletion dashboards-observability/public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import store from '../framework/redux/store';
import { AppPluginStartDependencies } from '../types';
import { Home as ApplicationAnalyticsHome } from './application_analytics/home';
import { Home as CustomPanelsHome } from './custom_panels/home';
import { EventAnalytics } from './explorer/event_analytics';
import { EventAnalytics } from './event_analytics';
import { Main as NotebooksHome } from './notebooks/components/main';
import { Home as TraceAnalyticsHome } from './trace_analytics/home';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
PanelTitle,
} from '../../../../public/components/trace_analytics/components/common/helper_functions';
import { SpanDetailTable } from '../../../../public/components/trace_analytics/components/traces/span_detail_table';
import { Explorer } from '../../explorer/explorer';
import { Explorer } from '../../event_analytics/explorer/explorer';
import { Configuration } from './configuration';
import {
TAB_CONFIG_ID_TXT_PFX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ import { VisualizationType } from '../../../../common/types/custom_panels';
import { NEW_SELECTED_QUERY_TAB, TAB_CREATED_TYPE } from '../../../../common/constants/explorer';
import { APP_ANALYTICS_API_PREFIX } from '../../../../common/constants/application_analytics';
import { HttpSetup } from '../../../../../../src/core/public';
import { init as initFields, remove as removefields } from '../../explorer/slices/field_slice';
import { init as initFields, remove as removefields } from '../../event_analytics/redux/slices/field_slice';
import {
init as initVisualizationConfig,
reset as resetVisualizationConfig,
} from '../../explorer/slices/viualization_config_slice';
} from '../../event_analytics/redux/slices/viualization_config_slice';
import {
init as initQuery,
remove as removeQuery,
changeQuery,
} from '../../explorer/slices/query_slice';
} from '../../event_analytics/redux/slices/query_slice';
import {
init as initQueryResult,
remove as removeQueryResult,
} from '../../explorer/slices/query_result_slice';
import { addTab, removeTab } from '../../explorer/slices/query_tab_slice';
} from '../../event_analytics/redux/slices/query_result_slice';
import { addTab, removeTab } from '../../event_analytics/redux/slices/query_tab_slice';

// Name validation
export const isNameValid = (name: string, existingNames: string[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import _ from 'lodash';
import { DatePicker } from './date_picker';
import '@algolia/autocomplete-theme-classic';
import { Autocomplete } from './autocomplete';
import { SavePanel } from '../../explorer/save_panel';
import { SavePanel } from '../../event_analytics/explorer/save_panel';
import { PPLReferenceFlyout } from '../helpers';
import { uiSettingsService } from '../../../../common/utils';
import { APP_ANALYTICS_TAB_ID_REGEX } from '../../../../common/constants/explorer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { waitFor } from '@testing-library/react';
import { NoResults } from '../no_results';
import { NoResults } from '../explorer/no_results';

describe('No result component', () => {
configure({ adapter: new Adapter() });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { waitFor } from '@testing-library/react';
import { DataGrid } from '../data_grid';
import { DataGrid } from '../events_views/data_grid';
import {
SELECTED_FIELDS,
AVAILABLE_FIELDS,
UNSELECTED_FIELDS,
QUERIED_FIELDS
} from '../../../../common/constants/explorer';
} from '../../../../../common/constants/explorer';
import {
AVAILABLE_FIELDS as SIDEBAR_AVAILABLE_FIELDS,
QUERY_FIELDS,
DATA_GRID_ROWS
} from '../../../../test/event_analytics_constants';
} from '../../../../../test/event_analytics_constants';

describe('Datagrid component', () => {
configure({ adapter: new Adapter() });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import './data_grid.scss';

import React, { useMemo, useState, useEffect, useRef, RefObject } from 'react';
import { IExplorerFields } from '../../../common/types/explorer';
import { DEFAULT_COLUMNS, PAGE_SIZE } from '../../../common/constants/explorer';
import { getHeaders, getTrs, populateDataGrid } from './utils';
import { HttpSetup } from '../../../../../src/core/public';
import PPLService from '../../services/requests/ppl';
import { IExplorerFields } from '../../../../../common/types/explorer';
import { DEFAULT_COLUMNS, PAGE_SIZE } from '../../../../../common/constants/explorer';
import { getHeaders, getTrs, populateDataGrid } from '../../utils';
import { HttpSetup } from '../../../../../../../src/core/public';
import PPLService from '../../../../services/requests/ppl';

interface DataGridProps {
http: HttpSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@

import classNames from 'classnames';
import React, { ReactNode } from 'react';
// import { FieldMapping, DocViewFilterFn } from '../../doc_views/doc_views_types';
import { DocViewTableRowBtnFilterAdd } from './table_row_btn_filter_add';
import { DocViewTableRowBtnFilterRemove } from './table_row_btn_filter_remove';
import { DocViewTableRowBtnToggleColumn } from './table_row_btn_toggle_column';
import { DocViewTableRowBtnCollapse } from './table_row_btn_collapse';
import { DocViewTableRowBtnFilterExists } from './table_row_btn_filter_exists';
import { DocViewTableRowIconNoMapping } from './table_row_icon_no_mapping';
import { DocViewTableRowIconUnderscore } from './table_row_icon_underscore';
import { FieldName } from '../../../common/field_name/field_name';
import { FieldName } from '../../../../common/field_name/field_name';

export interface FieldMapping {
filterable?: boolean;
Expand Down Expand Up @@ -53,12 +48,8 @@ export function DocViewTableRow({
displayUnderscoreWarning,
isCollapsible,
isCollapsed,
isColumnActive,
onFilter,
onToggleCollapse,
onToggleColumn,
value,
valueRaw,
}: Props) {
const valueClassName = classNames({
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand All @@ -68,31 +59,10 @@ export function DocViewTableRow({

return (
<tr key={field} data-test-subj={`tableDocViewRow-${field}`}>
{typeof onFilter === 'function' && (<></>
// <td className="osdDocViewer__buttons">
// <DocViewTableRowBtnFilterAdd
// disabled={!fieldMapping || !fieldMapping.filterable}
// onClick={() => onFilter(fieldMapping, valueRaw, '+')}
// />
// <DocViewTableRowBtnFilterRemove
// disabled={!fieldMapping || !fieldMapping.filterable}
// onClick={() => onFilter(fieldMapping, valueRaw, '-')}
// />
// {typeof onToggleColumn === 'function' && (
// <DocViewTableRowBtnToggleColumn active={isColumnActive} onClick={onToggleColumn} />
// )}
// <DocViewTableRowBtnFilterExists
// disabled={!fieldMapping || !fieldMapping.filterable}
// onClick={() => onFilter('_exists_', field, '+')}
// scripted={fieldMapping && fieldMapping.scripted}
// />
// </td>
)}
<td className="osdDocViewer__field">
<FieldName
fieldName={field}
fieldType={fieldType}
// fieldIconProps={{ fill: 'none', color: 'gray' }}
scripted={Boolean(fieldMapping?.scripted)}
/>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import React, { forwardRef, useImperativeHandle, useMemo, useState } from 'react
import { toPairs, uniqueId, has, forEach, isEqual } from 'lodash';
import { EuiButtonEmpty, EuiButtonIcon, EuiIcon, EuiLink } from '@elastic/eui';
import { useEffect } from 'react';
import { IExplorerFields, IField } from '../../../../common/types/explorer';
import { IExplorerFields, IField } from '../../../../../common/types/explorer';
import { DocFlyout } from './doc_flyout';
import { HttpStart } from '../../../../../../src/core/public';
import { OTEL_TRACE_ID, DATE_PICKER_FORMAT } from '../../../../common/constants/explorer';
import { HttpStart } from '../../../../../../../src/core/public';
import { OTEL_TRACE_ID, DATE_PICKER_FORMAT } from '../../../../../common/constants/explorer';
import { SurroundingFlyout } from './surrounding_flyout';
import PPLService from '../../../services/requests/ppl';
import { isValidTraceId } from '../utils';
import PPLService from '../../../../services/requests/ppl';
import { isValidTraceId } from '../../utils';

export interface IDocType {
[key: string]: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
EuiTabbedContent,
EuiTabbedContentTab,
} from '@elastic/eui';
import { DocViewTable } from './detailTable/docDetailTable';
import { DocViewTable } from './detail_table/doc_detail_table';
import { JsonCodeBlock } from './json_code_block/json_code_block';
import { IDocType } from './docViewRow';
import { HttpSetup } from '../../../../../../src/core/public';
import { HttpSetup } from '../../../../../../../src/core/public';
import { TraceBlock } from './trace_block/trace_block';
import { OTEL_TRACE_ID } from '../../../../common/constants/explorer';
import { isValidTraceId } from '../utils';
import { OTEL_TRACE_ID } from '../../../../../common/constants/explorer';
import { isValidTraceId } from '../../utils';

interface IDocViewerProps {
http: HttpSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import {
EuiToolTip,
} from '@elastic/eui';
import moment from 'moment';
import { FlyoutContainers } from '../../common/flyout_containers';
import { FlyoutContainers } from '../../../common/flyout_containers';
import { IDocType } from './docViewRow';
import { DocViewer } from './docViewer';
import { uiSettingsService } from '../../../../common/utils';
import { IExplorerFields } from '../../../../common/types/explorer';
import { getHeaders, populateDataGrid } from '../utils';
import { DEFAULT_COLUMNS } from '../../../../common/constants/explorer';
import { HttpSetup } from '../../../../../../src/core/public';
import { PPL_STATS_REGEX } from '../../../../common/constants/shared';
import { uiSettingsService } from '../../../../../common/utils';
import { IExplorerFields } from '../../../../../common/types/explorer';
import { getHeaders, populateDataGrid } from '../../utils';
import { DEFAULT_COLUMNS } from '../../../../../common/constants/explorer';
import { HttpSetup } from '../../../../../../../src/core/public';
import { PPL_STATS_REGEX } from '../../../../../common/constants/shared';

interface Props {
http: HttpSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import {
EuiTitle,
EuiToolTip,
} from '@elastic/eui';
import { FlyoutContainers } from '../../common/flyout_containers';
import { FlyoutContainers } from '../../../common/flyout_containers';
import { IDocType } from './docViewRow';
import { IExplorerFields, IField } from '../../../../common/types/explorer';
import { getHeaders, fetchSurroundingData, rangeNumDocs, populateDataGrid } from '../utils';
import { DEFAULT_COLUMNS } from '../../../../common/constants/explorer';
import { HttpSetup } from '../../../../../../src/core/public';
import PPLService from '../../../services/requests/ppl';
import { IExplorerFields, IField } from '../../../../../common/types/explorer';
import { getHeaders, fetchSurroundingData, rangeNumDocs, populateDataGrid } from '../../utils';
import { DEFAULT_COLUMNS } from '../../../../../common/constants/explorer';
import { HttpSetup } from '../../../../../../../src/core/public';
import PPLService from '../../../../services/requests/ppl';

interface Props {
http: HttpSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { TraceDetailRender } from '../../../application_analytics/components/flyout_components/trace_detail_render';
import { TraceDetailRender } from '../../../../application_analytics/components/flyout_components/trace_detail_render';
import React, { useEffect } from 'react';
import { HttpSetup } from '../../../../../../../src/core/public';
import { HttpSetup } from '../../../../../../../../src/core/public';
import { EuiCallOut, EuiLink } from '@elastic/eui';
import { TRACE_ANALYTICS_DOCUMENTATION_LINK } from '../../../../../common/constants/trace_analytics';
import { TRACE_ANALYTICS_DOCUMENTATION_LINK } from '../../../../../../common/constants/trace_analytics';
import {
OPEN_TELEMETRY_LOG_CORRELATION_LINK,
OTEL_TRACE_ID,
} from '../../../../../common/constants/explorer';
} from '../../../../../../common/constants/explorer';
import { IDocType } from '../docViewRow';
import { isValidTraceId } from '../../utils';
import { isValidTraceId } from '../../../utils';

interface props {
http: HttpSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import {
} from '@elastic/eui';
import dateMath from '@elastic/datemath';
import classNames from 'classnames';
import { Search } from '../common/search/search';
import { Search } from '../../common/search/search';
import { CountDistribution } from './visualizations/count_distribution';
import { DataGrid } from './data_grid';
import { DataGrid } from './events_views/data_grid';
import { Sidebar } from './sidebar';
import { NoResults } from './no_results';
import { HitsCounter } from './hits_counter/hits_counter';
import { TimechartHeader } from './timechart_header';
import { ExplorerVisualizations } from './visualizations';
import { IField, IQueryTab, IDefaultTimestampState } from '../../../common/types/explorer';
import { IField, IQueryTab, IDefaultTimestampState } from '../../../../common/types/explorer';
import {
TAB_CHART_TITLE,
TAB_EVENT_TITLE,
Expand All @@ -54,29 +54,29 @@ import {
INDEX,
FINAL_QUERY,
DATE_PICKER_FORMAT,
} from '../../../common/constants/explorer';
import { PPL_STATS_REGEX, PPL_NEWLINE_REGEX } from '../../../common/constants/shared';
import { getIndexPatternFromRawQuery, preprocessQuery, buildQuery } from '../../../common/utils';
import { useFetchEvents, useFetchVisualizations } from './hooks';
import { changeQuery, changeDateRange, selectQueries } from './slices/query_slice';
import { selectQueryResult } from './slices/query_result_slice';
import { selectFields, updateFields, sortFields } from './slices/field_slice';
import { updateTabName } from './slices/query_tab_slice';
import { selectCountDistribution } from './slices/count_distribution_slice';
import { selectExplorerVisualization } from './slices/visualization_slice';
} from '../../../../common/constants/explorer';
import { PPL_STATS_REGEX, PPL_NEWLINE_REGEX } from '../../../../common/constants/shared';
import { getIndexPatternFromRawQuery, preprocessQuery, buildQuery } from '../../../../common/utils';
import { useFetchEvents, useFetchVisualizations } from '../hooks';
import { changeQuery, changeDateRange, selectQueries } from '../redux/slices/query_slice';
import { selectQueryResult } from '../redux/slices/query_result_slice';
import { selectFields, updateFields, sortFields } from '../redux/slices/field_slice';
import { updateTabName } from '../redux/slices/query_tab_slice';
import { selectCountDistribution } from '../redux/slices/count_distribution_slice';
import { selectExplorerVisualization } from '../redux/slices/visualization_slice';
import {
selectVisualizationConfig,
change as changeVisualizationConfig,
} from './slices/viualization_config_slice';
import { change as updateVizConfig } from './slices/viualization_config_slice';
import { IExplorerProps, IVisualizationContainerProps } from '../../../common/types/explorer';
import { TabContext } from './hooks';
import { getVizContainerProps } from '../visualizations/charts/helpers';
} from '../redux/slices/viualization_config_slice';
import { change as updateVizConfig } from '../redux/slices/viualization_config_slice';
import { IExplorerProps, IVisualizationContainerProps } from '../../../../common/types/explorer';
import { TabContext } from '../hooks';
import { getVizContainerProps } from '../../visualizations/charts/helpers';
import {
parseGetSuggestions,
onItemSelect,
} from '../common/search/autocomplete_logic';
import { formatError } from './utils';
} from '../../common/search/autocomplete_logic';
import { formatError } from '../utils';

const TYPE_TAB_MAPPING = {
[SAVED_QUERY]: TAB_EVENT_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React from 'react';
import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import { FormattedMessage, I18nProvider } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';
import { formatNumWithCommas } from '../../common/helpers';
import { formatNumWithCommas } from '../../../common/helpers';

export interface HitsCounterProps {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { uniqueId, map, isEmpty } from 'lodash';
import $ from 'jquery';
import { EuiIcon, EuiText, EuiTabbedContentTab, EuiTabbedContent } from '@elastic/eui';
import { Explorer } from './explorer';
import { ILogExplorerProps } from '../../../common/types/explorer';
import { ILogExplorerProps } from '../../../../common/types/explorer';
import {
TAB_TITLE,
TAB_ID_TXT_PFX,
Expand All @@ -21,11 +21,11 @@ import {
TAB_EVENT_ID,
TAB_CHART_ID,
APP_ANALYTICS_TAB_ID_REGEX,
} from '../../../common/constants/explorer';
import { selectQueryTabs, setSelectedQueryTab } from './slices/query_tab_slice';
import { selectQueries } from './slices/query_slice';
import { selectQueryResult } from './slices/query_result_slice';
import { initializeTabData, removeTabData } from '../application_analytics/helpers/utils';
} from '../../../../common/constants/explorer';
import { selectQueryTabs, setSelectedQueryTab } from '../redux/slices/query_tab_slice';
import { selectQueries } from '../redux/slices/query_slice';
import { selectQueryResult } from '../redux/slices/query_result_slice';
import { initializeTabData, removeTabData } from '../../application_analytics/helpers/utils';

const searchBarConfigs = {
[TAB_EVENT_ID]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { waitFor } from '@testing-library/react';
import { SavePanel } from '../save_panel';
import { SELECTED_PANELS_OPTIONS } from '../../../../../test/event_analytics_constants';
import SavedObjects from '../../../../services/saved_objects/event_analytics/saved_objects';
import httpClientMock from '../../../../../test/__mocks__/httpClientMock';
import { SELECTED_PANELS_OPTIONS } from '../../../../../../test/event_analytics_constants';
import SavedObjects from '../../../../../services/saved_objects/event_analytics/saved_objects';
import httpClientMock from '../../../../../../test/__mocks__/httpClientMock';

describe('Saved query table component', () => {
configure({ adapter: new Adapter() });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { EuiTitle, EuiComboBox, EuiFormRow, EuiSpacer, EuiFieldText } from '@elastic/eui';
import { useEffect } from 'react';
import { isEmpty } from 'lodash';
import SavedObjects from '../../../services/saved_objects/event_analytics/saved_objects';
import SavedObjects from '../../../../services/saved_objects/event_analytics/saved_objects';

interface ISavedPanelProps {
selectedOptions: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { waitFor } from '@testing-library/react';
import { Field } from '../field';
import { AGENT_FIELD } from '../../../../../test/event_analytics_constants';
import { AGENT_FIELD } from '../../../../../../test/event_analytics_constants';

describe('Field component', () => {
configure({ adapter: new Adapter() });
Expand Down
Loading

0 comments on commit 6b30bee

Please sign in to comment.