Skip to content

Commit

Permalink
Merge branch 'main' into ml-package-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Jan 4, 2023
2 parents 6c50789 + 41f184d commit 469fa97
Show file tree
Hide file tree
Showing 15 changed files with 341 additions and 64 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/[email protected]",
"@elastic/ems-client": "8.3.3",
"@elastic/eui": "72.0.0",
"@elastic/eui": "72.1.0",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down
2 changes: 1 addition & 1 deletion src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ export const LICENSE_OVERRIDES = {
'[email protected]': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/[email protected]': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/[email protected]': ['Elastic License 2.0'],
'@elastic/eui@72.0.0': ['SSPL-1.0 OR Elastic License 2.0'],
'@elastic/eui@72.1.0': ['SSPL-1.0 OR Elastic License 2.0'],
'[email protected]': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { SavedSearch } from '@kbn/discover-plugin/public';

import { useUrlState, usePageUrlState } from '@kbn/ml-url-state';
import { useCss } from '../../hooks/use_css';
import { useAiopsAppContext } from '../../hooks/use_aiops_app_context';
import { SearchQueryLanguage, SavedSearchSavedObject } from '../../application/utils/search_utils';
import { useData } from '../../hooks/use_data';
Expand All @@ -41,9 +42,6 @@ import { ExplainLogRateSpikesAnalysis } from './explain_log_rate_spikes_analysis
import type { GroupTableItem } from '../spike_analysis_table/types';
import { useSpikeAnalysisTableRowContext } from '../spike_analysis_table/spike_analysis_table_row_provider';

// TODO port to `@emotion/react` once `useEuiBreakpoint` is available https://github.com/elastic/eui/pull/6057
import './explain_log_rate_spikes_page.scss';

function getDocumentCountStatsSplitLabel(changePoint?: ChangePoint, group?: GroupTableItem) {
if (changePoint) {
return `${changePoint?.fieldName}:${changePoint?.fieldValue}`;
Expand All @@ -68,6 +66,7 @@ export const ExplainLogRateSpikesPage: FC<ExplainLogRateSpikesPageProps> = ({
dataView,
savedSearch,
}) => {
const { aiopsPageHeader, dataViewTitleHeader } = useCss();
const { data: dataService } = useAiopsAppContext();

const {
Expand Down Expand Up @@ -189,9 +188,9 @@ export const ExplainLogRateSpikesPage: FC<ExplainLogRateSpikesPageProps> = ({
<EuiPageBody data-test-subj="aiopsExplainLogRateSpikesPage" paddingSize="none" panelled={false}>
<EuiFlexGroup gutterSize="none">
<EuiFlexItem>
<EuiPageContentHeader className="aiopsPageHeader">
<EuiPageContentHeader css={aiopsPageHeader}>
<EuiPageContentHeaderSection>
<div className="dataViewTitleHeader">
<div css={dataViewTitleHeader}>
<EuiTitle size={'s'}>
<h2>{dataView.getName()}</h2>
</EuiTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { useUrlState } from '@kbn/ml-url-state';
import { FullTimeRangeSelector } from '../full_time_range_selector';
import { DatePickerWrapper } from '../date_picker_wrapper';
import { useCss } from '../../hooks/use_css';
import { useData } from '../../hooks/use_data';
import { SearchPanel } from '../search_panel';
import type {
Expand All @@ -53,6 +54,7 @@ export const LogCategorizationPage: FC<LogCategorizationPageProps> = ({
dataView,
savedSearch,
}) => {
const { aiopsPageHeader, dataViewTitleHeader } = useCss();
const {
notifications: { toasts },
} = useAiopsAppContext();
Expand Down Expand Up @@ -220,9 +222,9 @@ export const LogCategorizationPage: FC<LogCategorizationPageProps> = ({
<EuiPageBody data-test-subj="aiopsExplainLogRateSpikesPage" paddingSize="none" panelled={false}>
<EuiFlexGroup gutterSize="none">
<EuiFlexItem>
<EuiPageContentHeader className="aiopsPageHeader">
<EuiPageContentHeader css={aiopsPageHeader}>
<EuiPageContentHeaderSection>
<div className="dataViewTitleHeader">
<div css={dataViewTitleHeader}>
<EuiTitle size="s">
<h2>{dataView.getName()}</h2>
</EuiTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ import {
} from '@elastic/eui';
import { useUrlState } from '@kbn/ml-url-state';
import { FullTimeRangeSelectorProps } from '../full_time_range_selector/full_time_range_selector';
import { useCss } from '../../hooks/use_css';
import { useDataSource } from '../../hooks/use_data_source';
import { useTimefilter } from '../../hooks/use_time_filter';
import { FullTimeRangeSelector } from '../full_time_range_selector';
import { DatePickerWrapper } from '../date_picker_wrapper';

export const PageHeader: FC = () => {
const { aiopsPageHeader, dataViewTitleHeader } = useCss();
const [, setGlobalState] = useUrlState('_g');
const { dataView } = useDataSource();

Expand All @@ -41,9 +43,9 @@ export const PageHeader: FC = () => {
<>
<EuiFlexGroup gutterSize="none">
<EuiFlexItem>
<EuiPageContentHeader className="aiopsPageHeader">
<EuiPageContentHeader css={aiopsPageHeader}>
<EuiPageContentHeaderSection>
<div className="dataViewTitleHeader">
<div css={dataViewTitleHeader}>
<EuiTitle size="s">
<h2>{dataView.getName()}</h2>
</EuiTitle>
Expand Down
31 changes: 31 additions & 0 deletions x-pack/plugins/aiops/public/hooks/use_css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { css } from '@emotion/react';
import { useEuiBreakpoint } from '@elastic/eui';
import { euiThemeVars } from '@kbn/ui-theme';

// Define fully static CSS outside hook.
const dataViewTitleHeader = css({
minWidth: '300px',
padding: `${euiThemeVars.euiSizeS} 0`,
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
});

export const useCss = () => {
// Define CSS referencing inline dependencies within hook.
const aiopsPageHeader = css({
[useEuiBreakpoint(['xs', 's', 'm', 'l'])]: {
flexDirection: 'column',
alignItems: 'flex-start',
},
});

return { dataViewTitleHeader, aiopsPageHeader };
};

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
*/

import React, { FC, useEffect, useState } from 'react';
import { EuiFlexItem, EuiFlexGroup, EuiSpacer } from '@elastic/eui';
import { css } from '@emotion/react';
import { useEuiBreakpoint, EuiFlexItem, EuiFlexGroup, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { Query, Filter } from '@kbn/es-query';
import type { TimeRange } from '@kbn/es-query';
Expand All @@ -17,9 +18,9 @@ import { DataVisualizerFieldTypeFilter } from './field_type_filter';
import { SupportedFieldType } from '../../../../../common/types';
import { SearchQueryLanguage } from '../../types/combined_query';
import { useDataVisualizerKibana } from '../../../kibana_context';
import './_index.scss';
import { createMergedEsQuery } from '../../utils/saved_search_utils';
import { OverallStats } from '../../types/overall_stats';

interface Props {
dataView: DataView;
searchString: Query['query'];
Expand Down Expand Up @@ -115,14 +116,37 @@ export const SearchPanel: FC<Props> = ({
}
};

const dvSearchPanelControls = css({
marginLeft: '0px !important',
paddingLeft: '0px !important',
paddingRight: '0px !important',
flexDirection: 'row',
[useEuiBreakpoint(['xs', 's', 'm', 'l'])]: {
padding: 0,
},
});

const dvSearchPanelContainer = css({
alignItems: 'baseline',
[useEuiBreakpoint(['xs', 's', 'm', 'l'])]: {
flexDirection: 'column',
},
});

const dvSearchBar = css({
[useEuiBreakpoint(['xs', 's', 'm', 'l'])]: {
minWidth: `max(100%, 300px)`,
},
});

return (
<EuiFlexGroup
gutterSize="none"
data-test-subj="dataVisualizerSearchPanel"
className={'dvSearchPanel__container'}
css={dvSearchPanelContainer}
responsive={false}
>
<EuiFlexItem grow={9} className={'dvSearchBar'}>
<EuiFlexItem grow={9} css={dvSearchBar}>
<SearchBar
dataTestSubj="dataVisualizerQueryInput"
appName={'dataVisualizer'}
Expand All @@ -145,15 +169,7 @@ export const SearchPanel: FC<Props> = ({
</EuiFlexItem>

{compact ? <EuiSpacer size="s" /> : null}
<EuiFlexItem
grow={2}
className={'dvSearchPanel__controls'}
css={{
marginLeft: '0px !important',
paddingLeft: '0px !important',
paddingRight: '0px !important',
}}
>
<EuiFlexItem grow={2} css={dvSearchPanelControls}>
<DataVisualizerFieldNamesFilter
overallStats={overallStats}
setVisibleFieldNames={setVisibleFieldNames}
Expand Down
20 changes: 20 additions & 0 deletions x-pack/plugins/enterprise_search/common/types/engines.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export interface EnterpriseSearchEnginesResponse {
meta: {
from: number;
size: number;
total: number;
};
results: EnterpriseSearchEngine[];
}

export interface EnterpriseSearchEngine {
name: string;
indices: string[];
}
Loading

0 comments on commit 469fa97

Please sign in to comment.