Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ export const GlobalAppStyle = () => {
return (
<Global
styles={css`
${bannerStyles(euiTheme)} ${chromeStyles(euiTheme)} ${renderingOverrides(euiTheme)}
${bannerStyles(euiTheme)}
${chromeStyles(euiTheme)}
${renderingOverrides(euiTheme)}
`}
/>
);
Expand Down
21 changes: 21 additions & 0 deletions src/core/public/cssUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

// This file replaces scss core/public/_mixins.scss

import { css } from '@emotion/react';

// The `--kbnAppHeadersOffset` CSS variable is automatically updated by
// styles/rendering/_base.scss, based on whether the Kibana chrome has a
// header banner, app menu, and is visible or hidden
export const kibanaFullBodyHeightCss = (additionalOffset = 0) => css`
height: calc(
100vh - var(--kbnAppHeadersOffset, var(--euiFixedHeadersOffset, 0)) - ${additionalOffset}px
);
`;
2 changes: 2 additions & 0 deletions src/core/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,5 @@ export type { CoreSetup, CoreStart, StartServicesAccessor } from '@kbn/core-life
export type { CoreSystem } from '@kbn/core-root-browser-internal';

export { __kbnBootstrap__ } from '@kbn/core-root-browser-internal';

export { kibanaFullBodyHeightCss } from './cssUtils';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
import type { ActionBarProps } from './action_bar';
import { ActionBar } from './action_bar';
import { findTestSubject } from '@elastic/eui/lib/test';
import { EuiThemeProvider } from '@elastic/eui';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../services/constants';
import { SurrDocType } from '../../services/context';

Expand All @@ -27,7 +28,11 @@ describe('Test Discover Context ActionBar for successor | predecessor records',
onChangeCount,
type,
} as ActionBarProps;
const wrapper = mountWithIntl(<ActionBar {...props} />);
const wrapper = mountWithIntl(
<EuiThemeProvider>
<ActionBar {...props} />
</EuiThemeProvider>
);

const input = findTestSubject(wrapper, `${type}CountPicker`);
const btn = findTestSubject(wrapper, `${type}LoadMoreButton`);
Expand Down Expand Up @@ -83,7 +88,11 @@ describe('Test Discover Context ActionBar for successor | predecessor records',
});

test(`${type}: Load button disabled when defaultStepSize is 0`, () => {
const wrapperWhenZeroStep = mountWithIntl(<ActionBar {...props} defaultStepSize={0} />);
const wrapperWhenZeroStep = mountWithIntl(
<EuiThemeProvider>
<ActionBar {...props} defaultStepSize={0} />
</EuiThemeProvider>
);
const inputWhenZeroStep = findTestSubject(wrapperWhenZeroStep, `${type}CountPicker`);
const btnWhenZeroStep = findTestSubject(wrapperWhenZeroStep, `${type}LoadMoreButton`);
expect(btnWhenZeroStep.props().disabled).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import './_action_bar.scss';
import React, { useState, useEffect } from 'react';
import { css } from '@emotion/react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import {
Expand All @@ -18,6 +18,7 @@ import {
EuiFlexItem,
EuiFormRow,
EuiSpacer,
type UseEuiTheme,
} from '@elastic/eui';
import { ActionBarWarning } from './action_bar_warning';
import { SurrDocType } from '../../services/context';
Expand Down Expand Up @@ -121,7 +122,7 @@ export function ActionBar({
})
}
compressed
className="cxtSizePicker"
css={cxtSizePickerCss}
data-test-subj={`${type}CountPicker`}
disabled={isDisabled}
min={MIN_CONTEXT_SIZE}
Expand Down Expand Up @@ -161,3 +162,14 @@ export function ActionBar({
</form>
);
}

const cxtSizePickerCss = ({ euiTheme }: UseEuiTheme) => css`
text-align: center;
width: calc(${euiTheme.size.base} * 5);

&::-webkit-outer-spin-button,
&::-webkit-inner-spin-button {
appearance: none; // Hide increment and decrement buttons for type="number" input.
margin: 0;
}
`;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React from 'react';
import { waitFor } from '@testing-library/react';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import { createFilterManagerMock } from '@kbn/data-plugin/public/query/filter_manager/filter_manager.mock';
import { EuiThemeProvider } from '@elastic/eui';
import { mockTopNavMenu } from './__mocks__/top_nav_menu';
import { ContextAppContent } from './context_app_content';
import { dataViewMock } from '@kbn/discover-utils/src/__mocks__';
Expand Down Expand Up @@ -96,7 +97,9 @@ describe('ContextApp test', () => {
const mountComponent = () => {
return mountWithIntl(
<KibanaContextProvider services={services}>
<ContextApp {...defaultProps} />
<EuiThemeProvider>
<ContextApp {...defaultProps} />
</EuiThemeProvider>
</KibanaContextProvider>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

import React, { Fragment, memo, useEffect, useRef, useMemo, useCallback } from 'react';
import './context_app.scss';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiText, EuiPage, EuiPageBody, EuiSpacer, useEuiPaddingSize } from '@elastic/eui';
import { css } from '@emotion/react';
Expand All @@ -23,6 +22,7 @@ import type { UseColumnsProps } from '@kbn/unified-data-table';
import { popularizeField, useColumns } from '@kbn/unified-data-table';
import type { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';
import type { DiscoverGridSettings } from '@kbn/saved-search-plugin/common';
import { kibanaFullBodyHeightCss } from '@kbn/core/public';
import { ContextErrorMessage } from './components/context_error_message';
import { LoadingStatus } from './services/context_query_state';
import type { AppState, GlobalState } from './services/context_state';
Expand Down Expand Up @@ -257,11 +257,11 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) =>
})}
</h1>
<TopNavMenu {...getNavBarProps()} />
<EuiPage className="dscDocsPage">
<EuiPage css={dscDocsPageCss}>
<EuiPageBody
panelled
paddingSize="none"
className="dscDocsContent"
css={dscDocsContentCss}
panelProps={{ role: 'main' }}
>
<EuiText
Expand Down Expand Up @@ -305,3 +305,13 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) =>
</Fragment>
);
};

const dscDocsPageCss = css`
${kibanaFullBodyHeightCss(54)}; // 54px is the action bar height
`;

const dscDocsContentCss = css`
display: flex;
flex-direction: column;
height: 100%;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function ContextAppContent({
isDisabled={isAnchorLoading}
/>
</WrapperWithPadding>
<div className="dscDocsGrid">
<div css={dscDocsGridCss}>
<CellActionsProvider getTriggerCompatibleActions={uiActions.getTriggerCompatibleActions}>
<DiscoverGridMemoized
ariaLabelledBy="surDocumentsAriaLabel"
Expand Down Expand Up @@ -266,3 +266,8 @@ const WrapperWithPadding: FC<React.PropsWithChildren<{}>> = ({ children }) => {
</div>
);
};

const dscDocsGridCss = css`
flex: 1 1 100%;
overflow: auto;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ import {
useInternalStateSelector,
} from '../../state_management/redux';

const containerStyles = css`
position: relative;
`;

const progressStyle = css`
z-index: 2;
`;

const DiscoverGridMemoized = React.memo(DiscoverGrid);

// export needs for testing
Expand Down Expand Up @@ -393,7 +385,8 @@ function DiscoverDocumentsComponent({

if (isDataViewLoading || (isEmptyDataResult && isDataLoading)) {
return (
<div className="dscDocuments__loading">
// class is used in tests
<div className="dscDocuments__loading" css={dscDocumentsLoadingCss}>
<EuiText size="xs" color="subdued">
<EuiLoadingSpinner />
<EuiSpacer size="s" />
Expand All @@ -404,6 +397,7 @@ function DiscoverDocumentsComponent({
}

return (
// class is used in tests
<EuiFlexItem className="dscTable" aria-labelledby="documentsAriaLabel" css={containerStyles}>
<EuiScreenReaderOnly>
<h2 id="documentsAriaLabel">
Expand Down Expand Up @@ -477,3 +471,21 @@ function DiscoverDocumentsComponent({
}

export const DiscoverDocuments = memo(DiscoverDocumentsComponent);

const containerStyles = css`
position: relative;
min-height: 0;
`;

const progressStyle = css`
z-index: 2;
`;

const dscDocumentsLoadingCss = css`
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
height: 100%;
width: 100%;
`;

This file was deleted.

Loading