Skip to content

Commit

Permalink
Merge branch 'main' into 154725-create-saved-views-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyghiani committed May 2, 2023
2 parents bcd0eb3 + 2ff49bf commit bf3718c
Show file tree
Hide file tree
Showing 60 changed files with 1,943 additions and 888 deletions.
1 change: 1 addition & 0 deletions .buildkite/scripts/steps/storybooks/build_and_upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const STORYBOOKS = [
'ui_actions_enhanced',
'language_documentation_popover',
'unified_search',
'random_sampling',
];

const GITHUB_CONTEXT = 'Build and Publish Storybooks';
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ examples/portable_dashboards_example @elastic/kibana-presentation
examples/preboot_example @elastic/kibana-security @elastic/kibana-core
src/plugins/presentation_util @elastic/kibana-presentation
x-pack/plugins/profiling @elastic/profiling-ui
x-pack/packages/kbn-random-sampling @elastic/kibana-visualizations
packages/kbn-react-field @elastic/kibana-data-discovery
x-pack/plugins/remote_clusters @elastic/platform-deployment-management
test/plugin_functional/plugins/rendering_plugin @elastic/kibana-core
Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"navigation": "src/plugins/navigation",
"newsfeed": "src/plugins/newsfeed",
"presentationUtil": "src/plugins/presentation_util",
"randomSampling": "x-pack/packages/kbn-random-sampling",
"reporting": "packages/kbn-reporting/common",
"savedObjects": "src/plugins/saved_objects",
"savedObjectsFinder": "src/plugins/saved_objects_finder",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@
"@kbn/preboot-example-plugin": "link:examples/preboot_example",
"@kbn/presentation-util-plugin": "link:src/plugins/presentation_util",
"@kbn/profiling-plugin": "link:x-pack/plugins/profiling",
"@kbn/random-sampling": "link:x-pack/packages/kbn-random-sampling",
"@kbn/react-field": "link:packages/kbn-react-field",
"@kbn/remote-clusters-plugin": "link:x-pack/plugins/remote_clusters",
"@kbn/rendering-plugin": "link:test/plugin_functional/plugins/rendering_plugin",
Expand Down
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const storybookAliases = {
lists: 'x-pack/plugins/lists/.storybook',
observability: 'x-pack/plugins/observability/.storybook',
presentation: 'src/plugins/presentation_util/storybook',
random_sampling: 'x-pack/packages/kbn-random-sampling/.storybook',
security_solution: 'x-pack/plugins/security_solution/.storybook',
security_solution_packages: 'x-pack/packages/security-solution/storybook/config',
serverless: 'packages/serverless/storybook/config',
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/discover/public/application/context/context_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import React, { Fragment, memo, useEffect, useRef, useMemo, useCallback } from '
import './context_app.scss';
import classNames from 'classnames';
import { FormattedMessage } from '@kbn/i18n-react';
import {
EuiText,
EuiPageContent_Deprecated as EuiPageContent,
EuiPage,
EuiSpacer,
} from '@elastic/eui';
import { EuiText, EuiPage, EuiPageBody, EuiSpacer } from '@elastic/eui';
import { cloneDeep } from 'lodash';
import { DataView, DataViewField } from '@kbn/data-views-plugin/public';
import { useExecutionContext } from '@kbn/kibana-react-plugin/public';
Expand Down Expand Up @@ -199,7 +194,12 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) =>
</h1>
<TopNavMenu {...getNavBarProps()} />
<EuiPage className={classNames({ dscDocsPage: !isLegacy })}>
<EuiPageContent paddingSize="s" className="dscDocsContent">
<EuiPageBody
panelled
paddingSize="s"
className="dscDocsContent"
panelProps={{ role: 'main' }}
>
<EuiSpacer size="s" />
<EuiText data-test-subj="contextDocumentSurroundingHeader">
<strong>
Expand Down Expand Up @@ -230,7 +230,7 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) =>
predecessorsStatus={fetchedState.predecessorsStatus.value}
successorsStatus={fetchedState.successorsStatus.value}
/>
</EuiPageContent>
</EuiPageBody>
</EuiPage>
</Fragment>
)}
Expand Down
12 changes: 3 additions & 9 deletions src/plugins/discover/public/application/doc/components/doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@

import React, { useEffect, useRef } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import {
EuiCallOut,
EuiLink,
EuiLoadingSpinner,
EuiPageContent_Deprecated as EuiPageContent,
EuiPage,
} from '@elastic/eui';
import { EuiCallOut, EuiLink, EuiLoadingSpinner, EuiPage, EuiPageBody } from '@elastic/eui';
import type { DataView } from '@kbn/data-views-plugin/public';
import { i18n } from '@kbn/i18n';
import { getRootBreadcrumbs } from '../../../utils/breadcrumbs';
Expand Down Expand Up @@ -78,7 +72,7 @@ export function Doc(props: DocProps) {
values: { id: props.id },
})}
</h1>
<EuiPageContent>
<EuiPageBody panelled paddingSize="l" panelProps={{ role: 'main' }}>
{reqState === ElasticRequestState.NotFoundDataView && (
<EuiCallOut
color="danger"
Expand Down Expand Up @@ -150,7 +144,7 @@ export function Doc(props: DocProps) {
<DocViewer hit={hit} dataView={dataView} />
</div>
)}
</EuiPageContent>
</EuiPageBody>
</EuiPage>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,5 @@ export const SingleDocRoute = () => {
);
}

return (
<div className="app-container">
<Doc id={id} index={index} dataView={dataView} referrer={locationState?.referrer} />
</div>
);
return <Doc id={id} index={index} dataView={dataView} referrer={locationState?.referrer} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ discover-app {
}

.dscPageContent--centered {
width: auto;
height: auto;
align-self: center;
margin-top: auto;
margin-bottom: auto;
flex-grow: 0;
}

.dscTable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
EuiHideFor,
EuiPage,
EuiPageBody,
EuiPageContent_Deprecated as EuiPageContent,
EuiPanel,
EuiSpacer,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -374,19 +374,17 @@ export function DiscoverLayout({
data-test-subj="discoverNoResultsError"
/>
) : (
<EuiPageContent
<EuiPanel
role="main"
panelRef={resizeRef}
verticalPosition={contentCentered ? 'center' : undefined}
horizontalPosition={contentCentered ? 'center' : undefined}
paddingSize="none"
hasShadow={false}
className={classNames('dscPageContent', {
'dscPageContent--centered': contentCentered,
'dscPageContent--emptyPrompt': resultState === 'none',
})}
>
{mainDisplay}
</EuiPageContent>
</EuiPanel>
)}
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
import './discover_sidebar.scss';
import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import {
EuiButton,
EuiFlexGroup,
EuiFlexItem,
EuiPageSideBar_Deprecated as EuiPageSideBar,
} from '@elastic/eui';
import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiPageSidebar } from '@elastic/eui';
import { DataViewPicker } from '@kbn/unified-search-plugin/public';
import { type DataViewField, getFieldSubtypeMulti } from '@kbn/data-views-plugin/public';
import {
Expand Down Expand Up @@ -266,7 +261,7 @@ export function DiscoverSidebarComponent({
}

return (
<EuiPageSideBar
<EuiPageSidebar
className="dscSidebar"
aria-label={i18n.translate('discover.fieldChooser.filter.indexAndFieldsSectionAriaLabel', {
defaultMessage: 'Index and fields',
Expand Down Expand Up @@ -327,7 +322,7 @@ export function DiscoverSidebarComponent({
</FieldList>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPageSideBar>
</EuiPageSidebar>
);
}

Expand Down
75 changes: 75 additions & 0 deletions test/functional/apps/visualize/group6/_tsvb_tsdb_basic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import expect from '@kbn/expect';

import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const { visualBuilder } = getPageObjects(['visualBuilder']);
const log = getService('log');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');

describe('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');
log.info(`creating the TSDB data view...`);
await kibanaServer.importExport.load(
'test/functional/fixtures/kbn_archiver/kibana_sample_data_logs_tsdb'
);
log.info(`setting the TSDB dataView as default...`);
await kibanaServer.uiSettings.replace({
defaultIndex: '90943e30-9a47-11e8-b64d-95841ca0c247',
});
});

after(async () => {
log.info(`removing the TSDB index...`);
await esArchiver.unload('test/functional/fixtures/es_archiver/kibana_sample_data_logs_tsdb');
log.info(`removing the TSDB dataView...`);
await kibanaServer.importExport.unload(
'test/functional/fixtures/kbn_archiver/kibana_sample_data_logs_tsdb'
);
log.info(`unsetting the TSDB dataView default...`);
await kibanaServer.uiSettings.unset('defaultIndex');
});

beforeEach(async () => {
await visualBuilder.resetPage();
});

it('should render from a tsdb dataView regular fields with no issues', async () => {
await visualBuilder.selectAggType('Average');
await visualBuilder.setFieldForAggregation('bytes');
const isFieldForAggregationValid = await visualBuilder.checkFieldForAggregationValidity();
expect(isFieldForAggregationValid).to.be(true);
expect(await testSubjects.exists('visualization-error-text')).to.be(false);
});

it('should render from a tsdb dataView supported tsdb field type', async () => {
await visualBuilder.selectAggType('Average');
await visualBuilder.setFieldForAggregation('bytes_gauge');
const isFieldForAggregationValid = await visualBuilder.checkFieldForAggregationValidity();
expect(isFieldForAggregationValid).to.be(true);
expect(await testSubjects.exists('visualization-error-text')).to.be(false);
});

it('should show an error when using an unsupported tsdb field type', async () => {
await visualBuilder.selectAggType('Average');
await visualBuilder.setFieldForAggregation('bytes_counter');
// this is still returning true
const isFieldForAggregationValid = await visualBuilder.checkFieldForAggregationValidity();
expect(isFieldForAggregationValid).to.be(true);
// but an error should appear in visualization
expect(await testSubjects.exists('visualization-error-text')).to.be(true);
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/visualize/group6/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./_tag_cloud'));
loadTestFile(require.resolve('./_tsvb_markdown'));
loadTestFile(require.resolve('./_tsvb_table'));
loadTestFile(require.resolve('./_tsvb_tsdb_basic'));
loadTestFile(require.resolve('./_vega_chart'));
});
}
Binary file not shown.
Loading

0 comments on commit bf3718c

Please sign in to comment.