Skip to content

Commit

Permalink
Merge branch 'main' into eui-ghost/security
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen authored Oct 19, 2023
2 parents 34af75c + feab0c6 commit a032ba7
Show file tree
Hide file tree
Showing 37 changed files with 80 additions and 687 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.9.1-canary.1",
"@elastic/ems-client": "8.5.0",
"@elastic/eui": "89.0.0",
"@elastic/eui": "89.1.0",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions packages/kbn-unified-data-table/src/components/data_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
font-size: $euiFontSizeS;
}

.euiDataGridRowCell__definedHeight {
white-space: pre-wrap;
}

.unifiedDataTable__inner {
display: flex;
flex-direction: column;
Expand All @@ -51,7 +47,7 @@
}

.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover,
.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover .euiDataGridRowCell__contentByHeight + .euiDataGridRowCell__expandActions {
.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover .euiDataGridRowCell__actions--overlay {
background-color: tintOrShade($euiColorLightShade, 50%, 0);
}
}
Expand Down Expand Up @@ -110,14 +106,14 @@
.unifiedDataTable__rowControl {
// fine-tuning the vertical alignment with the text for any row height setting
margin-top: -3px;
.euiDataGridRowCell__truncate & { // "Single line" row height setting
.euiDataGridRowCell__defaultHeight & { // "Single line" row height setting
margin-top: 0;
}
}

.unifiedDataTable__descriptionList {
// force the content truncation when "Single line" row height setting is active
.euiDataGridRowCell__truncate & {
.euiDataGridRowCell__defaultHeight & {
-webkit-line-clamp: 1;
display: -webkit-box;
-webkit-box-orient: vertical;
Expand Down
7 changes: 6 additions & 1 deletion packages/react/kibana_context/root/eui_provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { FC, useMemo } from 'react';
import useObservable from 'react-use/lib/useObservable';
import createCache from '@emotion/cache';

import { EuiProvider, EuiProviderProps } from '@elastic/eui';
import { EuiProvider, EuiProviderProps, euiStylisPrefixer } from '@elastic/eui';
import { EUI_STYLES_GLOBAL, EUI_STYLES_UTILS } from '@kbn/core-base-common';
import { getColorMode, defaultTheme } from '@kbn/react-kibana-context-common';
import { ThemeServiceStart } from '@kbn/react-kibana-context-common';
Expand All @@ -25,18 +25,23 @@ export interface KibanaEuiProviderProps extends Pick<EuiProviderProps<{}>, 'modi

// Set up the caches.
// https://eui.elastic.co/#/utilities/provider#cache-location
const stylisPlugins = [euiStylisPrefixer]; // https://emotion.sh/docs/@emotion/cache#stylisplugins

const emotionCache = createCache({
key: 'css',
stylisPlugins,
container: document.querySelector('meta[name="emotion"]') as HTMLElement,
});

const globalCache = createCache({
key: EUI_STYLES_GLOBAL,
stylisPlugins,
container: document.querySelector(`meta[name="${EUI_STYLES_GLOBAL}"]`) as HTMLElement,
});

const utilitiesCache = createCache({
key: EUI_STYLES_UTILS,
stylisPlugins,
container: document.querySelector(`meta[name="${EUI_STYLES_UTILS}"]`) as HTMLElement,
});

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 @@ -85,7 +85,7 @@ export const LICENSE_OVERRIDES = {
'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/ems-client@8.5.0': ['Elastic License 2.0'],
'@elastic/eui@89.0.0': ['SSPL-1.0 OR Elastic License 2.0'],
'@elastic/eui@89.1.0': ['SSPL-1.0 OR Elastic License 2.0'],
'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
'buffers@0.1.1': ['MIT'], // license in importing module https://www.npmjs.com/package/binary
};
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/expressions/eql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const getEqlFn = ({

return {
type: 'eql_raw_response',
body: response.rawResponse.body,
body: response.rawResponse,
};
} catch (e) {
request.error({ json: e });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const name = 'eql_raw_response';

export interface EqlRawResponse {
type: typeof name;
body: EqlSearchStrategyResponse['rawResponse']['body'];
body: EqlSearchStrategyResponse['rawResponse'];
}

// duplocated from x-pack/timelines plugin
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/search/strategies/eql_search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import type { EqlSearchRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { TransportResult, TransportRequestOptions } from '@elastic/elasticsearch';
import type { TransportRequestOptions } from '@elastic/elasticsearch';

import { IKibanaSearchRequest, IKibanaSearchResponse } from '../../types';

Expand All @@ -22,4 +22,4 @@ export interface EqlSearchStrategyRequest extends IKibanaSearchRequest<EqlReques
options?: TransportRequestOptions;
}

export type EqlSearchStrategyResponse<T = unknown> = IKibanaSearchResponse<TransportResult<T>>;
export type EqlSearchStrategyResponse<T = unknown> = IKibanaSearchResponse<T>;
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/expressions/eql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('eql', () => {
{},
{
search: {
search: jest.fn((params: any) => of({ rawResponse: { body: params } })),
search: jest.fn((params: any) => of({ rawResponse: params })),
},
indexPatterns: {
get: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('EQL search strategy', () => {

expect(response).toEqual(
expect.objectContaining({
rawResponse: expect.objectContaining(getMockEqlResponse()),
rawResponse: expect.objectContaining(getMockEqlResponse().body),
})
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function toEqlKibanaSearchResponse(
): EqlSearchStrategyResponse {
return {
id: response.body.id,
rawResponse: response,
rawResponse: response.body,
isPartial: response.body.is_partial,
isRunning: response.body.is_running,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('DataTable', () => {
wrapper
.find('[data-test-subj="dataGridRowCell"]')
.at(0)
.find('.euiDataGridRowCell__truncate')
.find('.euiDataGridRowCell__content')
.childAt(0)
.text()
).toEqual(mockTimelineData[0].ecs.timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ const EuiDataGridContainer = styled.div<{ hideLastPage: boolean }>`
${({ hideLastPage }) => `${hideLastPage ? 'display:none' : ''}`};
}
}
div .euiDataGridRowCell__contentByHeight {
height: auto;
align-self: center;
div .euiDataGridRowCell__contentWrapper {
display: flex;
align-items: center;
}
div .euiDataGridRowCell--lastColumn .euiDataGridRowCell__contentByHeight {
div .euiDataGridRowCell--lastColumn .euiDataGridRowCell__content {
flex-grow: 0;
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ export const useStyles = () => {
& .euiDataGridRowCell {
font-size: ${euiTheme.size.m};
}
& .euiDataGridRowCell__expandActions > [data-test-subj='euiDataGridCellExpandButton'] {
& .euiDataGridRowCell__actions > [data-test-subj='euiDataGridCellExpandButton'] {
display: none;
}
& .euiDataGridRowCell__contentByHeight + .euiDataGridRowCell__expandActions {
& .euiDataGridRowCell__actions--overlay {
padding: 0;
}
& .euiDataGridRowCell__expandFlex {
& .euiDataGridRowCell__contentWrapper {
display: flex;
align-items: center;
}
& .euiDataGridRowCell.euiDataGridRowCell--numeric {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,6 @@ const VulnerabilitiesDataGrid = ({
isFetching,
]);

const onPaginateFlyout = useCallback(
(nextVulnerabilityIndex: number) => {
// the index of the vulnerability in the current page
const newVulnerabilityIndex = nextVulnerabilityIndex % pageSize;

// if the vulnerability is not in the current page, we need to change the page
const flyoutPageIndex = Math.floor(nextVulnerabilityIndex / pageSize);

setUrlQuery({
pageIndex: flyoutPageIndex,
vulnerabilityIndex: newVulnerabilityIndex,
});
},
[pageSize, setUrlQuery]
);

const showVulnerabilityFlyout = flyoutVulnerabilityIndex > invalidIndex;

if (data?.page.length === 0) {
Expand Down Expand Up @@ -372,7 +356,6 @@ const VulnerabilitiesDataGrid = ({
flyoutIndex={selectedVulnerabilityIndex}
vulnerabilityRecord={selectedVulnerability}
totalVulnerabilitiesCount={limitedTotalItemCount}
onPaginate={onPaginateFlyout}
closeFlyout={onCloseFlyout}
isLoading={isFetching}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const VulnerabilityFindingFlyout = ({
isLoading,
}: {
closeFlyout: () => void;
onPaginate: (pageIndex: number) => void;
onPaginate?: (pageIndex: number) => void;
totalVulnerabilitiesCount: number;
flyoutIndex?: number;
vulnerabilityRecord: CspVulnerabilityFinding;
Expand Down Expand Up @@ -236,15 +236,21 @@ export const VulnerabilityFindingFlyout = ({
</EuiSkeletonText>
</EuiFlyoutBody>
<EuiFlyoutFooter>
<EuiFlexGroup gutterSize="none" alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiPagination
pageCount={totalVulnerabilitiesCount}
activePage={flyoutIndex}
onPageClick={onPaginate}
compressed
/>
</EuiFlexItem>
<EuiFlexGroup
gutterSize="none"
alignItems="center"
justifyContent={onPaginate ? 'spaceBetween' : 'flexEnd'}
>
{onPaginate && (
<EuiFlexItem grow={false}>
<EuiPagination
pageCount={totalVulnerabilitiesCount}
activePage={flyoutIndex}
onPageClick={onPaginate}
compressed
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<TakeAction createRuleFn={createVulnerabilityRuleFn} />
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const mockKibana = () => {
triggersActionsUi: {
getAddRuleFlyout: jest
.fn()
// eslint-disable-next-line @kbn/i18n/strings_should_be_translated_with_i18n, @kbn/i18n/strings_should_be_translated_with_formatted_message
.mockReturnValue(<div data-test-subj="add-rule-flyout">Add Rule Flyout</div>),
},
uiSettings: {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/osquery/cypress/tasks/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
CONFIRM_MODAL_BTN_SEL,
CREATE_PACKAGE_POLICY_SAVE_BTN,
DATA_COLLECTION_SETUP_STEP,
DATE_PICKER_ABSOLUTE_TAB,
DATE_PICKER_ABSOLUTE_TAB_SEL,
TOAST_CLOSE_BTN,
TOAST_CLOSE_BTN_SEL,
Expand Down Expand Up @@ -98,7 +99,7 @@ export function closeModalIfVisible() {
export function closeDateTabIfVisible() {
cy.get('body').then(($body) => {
if ($body.find(DATE_PICKER_ABSOLUTE_TAB_SEL).length) {
cy.getBySel(DATE_PICKER_ABSOLUTE_TAB_SEL).clickOutside();
cy.getBySel(DATE_PICKER_ABSOLUTE_TAB).clickOutside();
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/security/server/prompt_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import 'css.escape'; // Polyfill required to render `EuiPageTemplate` server-side
import { EuiPageTemplate, EuiProvider } from '@elastic/eui';
import { EuiPageTemplate, EuiProvider, euiStylisPrefixer } from '@elastic/eui';
// @ts-expect-error no definitions in component folder
import { icon as EuiIconWarning } from '@elastic/eui/lib/components/icon/assets/warning';
// @ts-expect-error no definitions in component folder
Expand All @@ -32,7 +32,7 @@ appendIconComponentCache({
warning: EuiIconWarning,
});

const emotionCache = createCache({ key: 'eui' });
const emotionCache = createCache({ key: 'eui', stylisPlugins: [euiStylisPrefixer] });

interface Props {
buildNumber: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export const validateEql = async ({
)
);

if (isValidationErrorResponse(response.body)) {
return { valid: false, errors: getValidationErrors(response.body) };
} else if (isErrorResponse(response.body)) {
throw new Error(JSON.stringify(response.body));
if (isValidationErrorResponse(response)) {
return { valid: false, errors: getValidationErrors(response) };
} else if (isErrorResponse(response)) {
throw new Error(JSON.stringify(response));
} else {
return { valid: true, errors: [] };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ const EuiDataGridContainer = styled.div<GridContainerProps>`
}};
}
}
div .euiDataGridRowCell__contentByHeight {
height: auto;
align-self: center;
div .euiDataGridRowCell__contentWrapper {
display: flex;
align-items: center;
}
div .euiDataGridRowCell--lastColumn .euiDataGridRowCell__contentByHeight {
div .euiDataGridRowCell--lastColumn .euiDataGridRowCell__content {
flex-grow: 0;
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ export const GetPingsParamsType = t.intersection([
monitorId: t.string,
sort: t.string,
status: t.string,
finalAttempt: t.boolean,
}),
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useSelectedLocation } from './use_selected_location';
import {
getMonitorRecentPingsAction,
selectMonitorPingsMetadata,
selectShowOnlyFinalAttempts,
selectStatusFilter,
} from '../../../state';

Expand All @@ -34,8 +33,6 @@ export const useMonitorPings = (props?: UseMonitorPingsProps) => {
const monitorId = monitor?.id;
const locationLabel = location?.label;

const showOnlyFinalAttempts = useSelector(selectShowOnlyFinalAttempts);

const statusFilter = useSelector(selectStatusFilter);

useEffect(() => {
Expand All @@ -48,7 +45,6 @@ export const useMonitorPings = (props?: UseMonitorPingsProps) => {
pageIndex: props?.pageIndex,
from: props?.from,
to: props?.to,
finalAttempt: showOnlyFinalAttempts,
statusFilter,
})
);
Expand All @@ -62,7 +58,6 @@ export const useMonitorPings = (props?: UseMonitorPingsProps) => {
props?.pageIndex,
props?.from,
props?.to,
showOnlyFinalAttempts,
statusFilter,
]);

Expand Down
Loading

0 comments on commit a032ba7

Please sign in to comment.