`${Number(d).toFixed(0)} ms`}
- domain={{
- max: 3371,
- min: 0,
- }}
- barStyleAccessor={(datum) => {
- return datum.datum.config.colour;
- }}
- renderSidebarItem={renderSidebarItem}
- renderLegendItem={renderLegendItem}
- fullHeight={true}
- />
+
+ `${Number(d).toFixed(0)} ms`}
+ domain={{
+ max: 3371,
+ min: 0,
+ }}
+ barStyleAccessor={(datum) => {
+ return datum.datum.config.colour;
+ }}
+ renderSidebarItem={undefined}
+ renderLegendItem={renderLegendItem}
+ fullHeight={true}
+ />
+
);
};
- const component = mountWithRouter(
-
-
-
-
-
-
-
- );
+ const { getByTestId } = render();
- const chartWrapper = component.find(WaterfallChartOuterContainer);
+ const chartWrapper = getByTestId('waterfallOuterContainer');
- expect(chartWrapper.get(0).props.height).toBe('calc(100vh - 0px)');
+ expect(chartWrapper).toHaveStyleRule('height', 'calc(100vh - 62px)');
});
});
-
-const mockCore: () => any = () => {
- return {
- application: {
- getUrlForApp: () => '/app/uptime',
- navigateToUrl: jest.fn(),
- },
- uiSettings: {
- get: (key: string) => 'MMM D, YYYY @ HH:mm:ss.SSS',
- get$: (key: string) => of('MMM D, YYYY @ HH:mm:ss.SSS'),
- },
- };
-};
diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx
new file mode 100644
index 00000000000000..df00df147fc6c5
--- /dev/null
+++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx
@@ -0,0 +1,112 @@
+/*
+ * 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 React from 'react';
+import {
+ Axis,
+ BarSeries,
+ BarStyleAccessor,
+ Chart,
+ DomainRange,
+ Position,
+ ScaleType,
+ Settings,
+ TickFormatter,
+ TooltipInfo,
+} from '@elastic/charts';
+import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
+import { BAR_HEIGHT } from './constants';
+import { useChartTheme } from '../../../../../hooks/use_chart_theme';
+import { WaterfallChartChartContainer, WaterfallChartTooltip } from './styles';
+import { useWaterfallContext, WaterfallData } from '..';
+
+const getChartHeight = (data: WaterfallData): number => {
+ // We get the last item x(number of bars) and adds 1 to cater for 0 index
+ const noOfXBars = new Set(data.map((item) => item.x)).size;
+
+ return noOfXBars * BAR_HEIGHT;
+};
+
+const Tooltip = (tooltipInfo: TooltipInfo) => {
+ const { data, renderTooltipItem } = useWaterfallContext();
+ const relevantItems = data.filter((item) => {
+ return (
+ item.x === tooltipInfo.header?.value && item.config.showTooltip && item.config.tooltipProps
+ );
+ });
+ return relevantItems.length ? (
+
+
+ {relevantItems.map((item, index) => {
+ return (
+ {renderTooltipItem(item.config.tooltipProps)}
+ );
+ })}
+
+
+ ) : null;
+};
+
+interface Props {
+ index: number;
+ chartData: WaterfallData;
+ tickFormat: TickFormatter;
+ domain: DomainRange;
+ barStyleAccessor: BarStyleAccessor;
+}
+
+export const WaterfallBarChart = ({
+ chartData,
+ tickFormat,
+ domain,
+ barStyleAccessor,
+ index,
+}: Props) => {
+ const theme = useChartTheme();
+
+ return (
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx
index 8f831d0629b25c..e0e5165b41e498 100644
--- a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx
@@ -5,62 +5,30 @@
* 2.0.
*/
-import React, { useEffect, useMemo, useRef, useState } from 'react';
+import React, { useEffect, useRef, useState } from 'react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
-import {
- Axis,
- BarSeries,
- Chart,
- Position,
- ScaleType,
- Settings,
- TickFormatter,
- DomainRange,
- BarStyleAccessor,
- TooltipInfo,
- TooltipType,
-} from '@elastic/charts';
-import { EUI_CHARTS_THEME_DARK, EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme';
-// NOTE: The WaterfallChart has a hard requirement that consumers / solutions are making use of KibanaReactContext, and useKibana etc
-// can therefore be accessed.
-import { useUiSetting$ } from '../../../../../../../../../src/plugins/kibana_react/public';
+import { TickFormatter, DomainRange, BarStyleAccessor } from '@elastic/charts';
+
import { useWaterfallContext } from '../context/waterfall_chart';
import {
WaterfallChartOuterContainer,
WaterfallChartFixedTopContainer,
WaterfallChartFixedTopContainerSidebarCover,
- WaterfallChartFixedAxisContainer,
- WaterfallChartChartContainer,
- WaterfallChartTooltip,
+ WaterfallChartTopContainer,
+ RelativeContainer,
+ WaterfallChartFilterContainer,
+ WaterfallChartAxisOnlyContainer,
} from './styles';
-import { WaterfallData } from '../types';
-import { BAR_HEIGHT, CANVAS_MAX_ITEMS, MAIN_GROW_SIZE, SIDEBAR_GROW_SIZE } from './constants';
+import { CHART_LEGEND_PADDING, MAIN_GROW_SIZE, SIDEBAR_GROW_SIZE } from './constants';
import { Sidebar } from './sidebar';
import { Legend } from './legend';
import { useBarCharts } from './use_bar_charts';
+import { WaterfallBarChart } from './waterfall_bar_chart';
+import { WaterfallChartFixedAxis } from './waterfall_chart_fixed_axis';
import { NetworkRequestsTotal } from './network_requests_total';
-const Tooltip = (tooltipInfo: TooltipInfo) => {
- const { data, renderTooltipItem } = useWaterfallContext();
- const relevantItems = data.filter((item) => {
- return (
- item.x === tooltipInfo.header?.value && item.config.showTooltip && item.config.tooltipProps
- );
- });
- return relevantItems.length ? (
-
-
- {relevantItems.map((item, index) => {
- return (
- {renderTooltipItem(item.config.tooltipProps)}
- );
- })}
-
-
- ) : null;
-};
-
-export type RenderItem = (item: I, index: number) => JSX.Element;
+export type RenderItem = (item: I, index?: number) => JSX.Element;
+export type RenderFilter = () => JSX.Element;
export interface WaterfallChartProps {
tickFormat: TickFormatter;
@@ -68,159 +36,100 @@ export interface WaterfallChartProps {
barStyleAccessor: BarStyleAccessor;
renderSidebarItem?: RenderItem;
renderLegendItem?: RenderItem;
+ renderFilter?: RenderFilter;
maxHeight?: string;
fullHeight?: boolean;
}
-const getChartHeight = (data: WaterfallData, ind: number): number => {
- // We get the last item x(number of bars) and adds 1 to cater for 0 index
- return (data[data.length - 1]?.x + 1 - ind * CANVAS_MAX_ITEMS) * BAR_HEIGHT;
-};
-
export const WaterfallChart = ({
tickFormat,
domain,
barStyleAccessor,
renderSidebarItem,
renderLegendItem,
+ renderFilter,
maxHeight = '800px',
fullHeight = false,
}: WaterfallChartProps) => {
const {
data,
+ showOnlyHighlightedNetworkRequests,
sidebarItems,
legendItems,
totalNetworkRequests,
+ highlightedNetworkRequests,
fetchedNetworkRequests,
} = useWaterfallContext();
- const [darkMode] = useUiSetting$('theme:darkMode');
-
- const theme = useMemo(() => {
- return darkMode ? EUI_CHARTS_THEME_DARK.theme : EUI_CHARTS_THEME_LIGHT.theme;
- }, [darkMode]);
-
const chartWrapperDivRef = useRef(null);
const [height, setHeight] = useState(maxHeight);
- const shouldRenderSidebar = !!(sidebarItems && sidebarItems.length > 0 && renderSidebarItem);
+ const shouldRenderSidebar = !!(sidebarItems && renderSidebarItem);
const shouldRenderLegend = !!(legendItems && legendItems.length > 0 && renderLegendItem);
useEffect(() => {
if (fullHeight && chartWrapperDivRef.current) {
const chartOffset = chartWrapperDivRef.current.getBoundingClientRect().top;
- setHeight(`calc(100vh - ${chartOffset}px)`);
+ setHeight(`calc(100vh - ${chartOffset + CHART_LEGEND_PADDING}px)`);
}
}, [chartWrapperDivRef, fullHeight]);
const chartsToDisplay = useBarCharts({ data });
return (
-
- <>
-
-
- {shouldRenderSidebar && (
-
-
-
-
-
- )}
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {shouldRenderSidebar && (
+
+
+
+ {renderFilter && (
+ {renderFilter()}
+ )}
-
-
-
+ )}
+
+
+
+
+
+
+
+
{shouldRenderSidebar && }
-
+
+
{chartsToDisplay.map((chartData, ind) => (
-
-
-
-
-
-
-
-
-
+ chartData={chartData}
+ domain={domain}
+ barStyleAccessor={barStyleAccessor}
+ tickFormat={tickFormat}
+ />
))}
-
+
- {shouldRenderLegend && }
- >
-
+
+ {shouldRenderLegend && }
+
);
};
diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx
new file mode 100644
index 00000000000000..3a7ab421b6277b
--- /dev/null
+++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx
@@ -0,0 +1,65 @@
+/*
+ * 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 React from 'react';
+import {
+ Axis,
+ BarSeries,
+ BarStyleAccessor,
+ Chart,
+ DomainRange,
+ Position,
+ ScaleType,
+ Settings,
+ TickFormatter,
+ TooltipType,
+} from '@elastic/charts';
+import { useChartTheme } from '../../../../../hooks/use_chart_theme';
+import { WaterfallChartFixedAxisContainer } from './styles';
+
+interface Props {
+ tickFormat: TickFormatter;
+ domain: DomainRange;
+ barStyleAccessor: BarStyleAccessor;
+}
+
+export const WaterfallChartFixedAxis = ({ tickFormat, domain, barStyleAccessor }: Props) => {
+ const theme = useChartTheme();
+
+ return (
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx
index 68d24514a37d3e..9e87d69ce38a82 100644
--- a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx
@@ -7,12 +7,15 @@
import React, { createContext, useContext, Context } from 'react';
import { WaterfallData, WaterfallDataEntry } from '../types';
+import { SidebarItems } from '../../step_detail/waterfall/types';
export interface IWaterfallContext {
totalNetworkRequests: number;
+ highlightedNetworkRequests: number;
fetchedNetworkRequests: number;
data: WaterfallData;
- sidebarItems?: unknown[];
+ showOnlyHighlightedNetworkRequests: boolean;
+ sidebarItems?: SidebarItems;
legendItems?: unknown[];
renderTooltipItem: (
item: WaterfallDataEntry['config']['tooltipProps'],
@@ -24,8 +27,10 @@ export const WaterfallContext = createContext>({});
interface ProviderProps {
totalNetworkRequests: number;
+ highlightedNetworkRequests: number;
fetchedNetworkRequests: number;
data: IWaterfallContext['data'];
+ showOnlyHighlightedNetworkRequests: IWaterfallContext['showOnlyHighlightedNetworkRequests'];
sidebarItems?: IWaterfallContext['sidebarItems'];
legendItems?: IWaterfallContext['legendItems'];
renderTooltipItem: IWaterfallContext['renderTooltipItem'];
@@ -34,20 +39,24 @@ interface ProviderProps {
export const WaterfallProvider: React.FC = ({
children,
data,
+ showOnlyHighlightedNetworkRequests,
sidebarItems,
legendItems,
renderTooltipItem,
totalNetworkRequests,
+ highlightedNetworkRequests,
fetchedNetworkRequests,
}) => {
return (
diff --git a/x-pack/plugins/uptime/public/hooks/use_chart_theme.ts b/x-pack/plugins/uptime/public/hooks/use_chart_theme.ts
new file mode 100644
index 00000000000000..f9231abaa75a80
--- /dev/null
+++ b/x-pack/plugins/uptime/public/hooks/use_chart_theme.ts
@@ -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.
+ */
+
+import { EUI_CHARTS_THEME_DARK, EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme';
+import { useMemo } from 'react';
+import { useUiSetting$ } from '../../../../../src/plugins/kibana_react/public';
+
+export const useChartTheme = () => {
+ const [darkMode] = useUiSetting$('theme:darkMode');
+
+ const theme = useMemo(() => {
+ return darkMode ? EUI_CHARTS_THEME_DARK.theme : EUI_CHARTS_THEME_LIGHT.theme;
+ }, [darkMode]);
+
+ return theme;
+};
diff --git a/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx b/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx
index 9656c63274a13e..4c81247fb2cf16 100644
--- a/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx
+++ b/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx
@@ -8,10 +8,17 @@
import React, { ReactElement } from 'react';
import { Router } from 'react-router-dom';
import { MemoryHistory } from 'history/createMemoryHistory';
-import { createMemoryHistory } from 'history';
+import { createMemoryHistory, History } from 'history';
import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test/jest';
import { MountWithReduxProvider } from './helper_with_redux';
import { AppState } from '../../state';
+import { mockState } from '../__mocks__/uptime_store.mock';
+import { KibanaProviderOptions, MockRouter } from './rtl_helpers';
+
+interface RenderRouterOptions extends KibanaProviderOptions {
+ history?: History;
+ state?: Partial;
+}
const helperWithRouter: (
helper: (node: ReactElement) => R,
@@ -67,3 +74,39 @@ export const mountWithRouterRedux = (
options?.storeState
);
};
+
+/* Custom enzyme render */
+export function render(
+ ui: ReactElement,
+ { history, core, kibanaProps, state }: RenderRouterOptions = {}
+) {
+ const testState: AppState = {
+ ...mockState,
+ ...state,
+ };
+ return renderWithIntl(
+
+
+ {ui}
+
+
+ );
+}
+
+/* Custom enzyme render */
+export function mount(
+ ui: ReactElement,
+ { history, core, kibanaProps, state }: RenderRouterOptions = {}
+) {
+ const testState: AppState = {
+ ...mockState,
+ ...state,
+ };
+ return mountWithIntl(
+
+
+ {ui}
+
+
+ );
+}
diff --git a/x-pack/plugins/uptime/public/lib/helper/rtl_helpers.tsx b/x-pack/plugins/uptime/public/lib/helper/rtl_helpers.tsx
index abc0451bf8efad..e02a2c6f9832f6 100644
--- a/x-pack/plugins/uptime/public/lib/helper/rtl_helpers.tsx
+++ b/x-pack/plugins/uptime/public/lib/helper/rtl_helpers.tsx
@@ -6,6 +6,7 @@
*/
import React, { ReactElement } from 'react';
+import { of } from 'rxjs';
import { render as reactTestLibRender, RenderOptions } from '@testing-library/react';
import { Router } from 'react-router-dom';
import { createMemoryHistory, History } from 'history';
@@ -26,7 +27,7 @@ interface KibanaProps {
services?: KibanaServices;
}
-interface KibanaProviderOptions {
+export interface KibanaProviderOptions {
core?: Partial & ExtraCore;
kibanaProps?: KibanaProps;
}
@@ -54,6 +55,11 @@ const mockCore: () => any = () => {
getUrlForApp: () => '/app/uptime',
navigateToUrl: jest.fn(),
},
+ uiSettings: {
+ get: (key: string) => 'MMM D, YYYY @ HH:mm:ss.SSS',
+ get$: (key: string) => of('MMM D, YYYY @ HH:mm:ss.SSS'),
+ },
+ usageCollection: { reportUiCounter: () => {} },
};
return core;
diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts
index 6cc5e2eaefb94a..8bd0b8a790d402 100644
--- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts
+++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts
@@ -375,6 +375,34 @@ export default function jiraTest({ getService }: FtrProviderContext) {
});
});
});
+
+ it('should handle failing with a simulated success when labels containing a space', async () => {
+ await supertest
+ .post(`/api/actions/action/${simulatedActionId}/_execute`)
+ .set('kbn-xsrf', 'foo')
+ .send({
+ params: {
+ ...mockJira.params,
+ subActionParams: {
+ incident: {
+ ...mockJira.params.subActionParams.incident,
+ issueType: '10006',
+ labels: ['label with spaces'],
+ },
+ comments: [],
+ },
+ },
+ })
+ .then((resp: any) => {
+ expect(resp.body).to.eql({
+ actionId: simulatedActionId,
+ status: 'error',
+ retry: false,
+ message:
+ 'error validating action params: types that failed validation:\n- [0.subAction]: expected value to equal [getFields]\n- [1.subAction]: expected value to equal [getIncident]\n- [2.subAction]: expected value to equal [handshake]\n- [3.subActionParams.incident.labels]: types that failed validation:\n - [subActionParams.incident.labels.0.0]: The label label with spaces cannot contain spaces\n - [subActionParams.incident.labels.1]: expected value to equal [null]\n- [4.subAction]: expected value to equal [issueTypes]\n- [5.subAction]: expected value to equal [fieldsByIssueType]\n- [6.subAction]: expected value to equal [issues]\n- [7.subAction]: expected value to equal [issue]',
+ });
+ });
+ });
});
describe('Execution', () => {
diff --git a/x-pack/test/api_integration/apis/security_solution/timeline_details.ts b/x-pack/test/api_integration/apis/security_solution/timeline_details.ts
index 2705406009062d..39b343a3619457 100644
--- a/x-pack/test/api_integration/apis/security_solution/timeline_details.ts
+++ b/x-pack/test/api_integration/apis/security_solution/timeline_details.ts
@@ -19,97 +19,97 @@ const EXPECTED_DATA = [
category: 'base',
field: '@timestamp',
values: ['2019-02-10T02:39:44.107Z'],
- originalValue: '2019-02-10T02:39:44.107Z',
+ originalValue: ['2019-02-10T02:39:44.107Z'],
},
{
category: '@version',
field: '@version',
values: ['1'],
- originalValue: '1',
+ originalValue: ['1'],
},
{
category: 'agent',
field: 'agent.ephemeral_id',
values: ['909cd6a1-527d-41a5-9585-a7fb5386f851'],
- originalValue: '909cd6a1-527d-41a5-9585-a7fb5386f851',
+ originalValue: ['909cd6a1-527d-41a5-9585-a7fb5386f851'],
},
{
category: 'agent',
field: 'agent.hostname',
values: ['raspberrypi'],
- originalValue: 'raspberrypi',
+ originalValue: ['raspberrypi'],
},
{
category: 'agent',
field: 'agent.id',
values: ['4d3ea604-27e5-4ec7-ab64-44f82285d776'],
- originalValue: '4d3ea604-27e5-4ec7-ab64-44f82285d776',
+ originalValue: ['4d3ea604-27e5-4ec7-ab64-44f82285d776'],
},
{
category: 'agent',
field: 'agent.type',
values: ['filebeat'],
- originalValue: 'filebeat',
+ originalValue: ['filebeat'],
},
{
category: 'agent',
field: 'agent.version',
values: ['7.0.0'],
- originalValue: '7.0.0',
+ originalValue: ['7.0.0'],
},
{
category: 'destination',
field: 'destination.domain',
values: ['s3-iad-2.cf.dash.row.aiv-cdn.net'],
- originalValue: 's3-iad-2.cf.dash.row.aiv-cdn.net',
+ originalValue: ['s3-iad-2.cf.dash.row.aiv-cdn.net'],
},
{
category: 'destination',
field: 'destination.ip',
values: ['10.100.7.196'],
- originalValue: '10.100.7.196',
+ originalValue: ['10.100.7.196'],
},
{
category: 'destination',
field: 'destination.port',
- values: [40684],
- originalValue: 40684,
+ values: ['40684'],
+ originalValue: ['40684'],
},
{
category: 'ecs',
field: 'ecs.version',
values: ['1.0.0-beta2'],
- originalValue: '1.0.0-beta2',
+ originalValue: ['1.0.0-beta2'],
},
{
category: 'event',
field: 'event.dataset',
values: ['suricata.eve'],
- originalValue: 'suricata.eve',
+ originalValue: ['suricata.eve'],
},
{
category: 'event',
field: 'event.end',
values: ['2019-02-10T02:39:44.107Z'],
- originalValue: '2019-02-10T02:39:44.107Z',
+ originalValue: ['2019-02-10T02:39:44.107Z'],
},
{
category: 'event',
field: 'event.kind',
values: ['event'],
- originalValue: 'event',
+ originalValue: ['event'],
},
{
category: 'event',
field: 'event.module',
values: ['suricata'],
- originalValue: 'suricata',
+ originalValue: ['suricata'],
},
{
category: 'event',
field: 'event.type',
values: ['fileinfo'],
- originalValue: 'fileinfo',
+ originalValue: ['fileinfo'],
},
{
category: 'file',
@@ -117,260 +117,261 @@ const EXPECTED_DATA = [
values: [
'/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/0a9a/bf72/e1da/4c20-919e-0cbabcf7bfe8/75f50c57-d25f-4e97-9e37-01b9f5caa293_audio_13.mp4',
],
- originalValue:
+ originalValue: [
'/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/0a9a/bf72/e1da/4c20-919e-0cbabcf7bfe8/75f50c57-d25f-4e97-9e37-01b9f5caa293_audio_13.mp4',
+ ],
},
{
category: 'file',
field: 'file.size',
- values: [48277],
- originalValue: 48277,
+ values: ['48277'],
+ originalValue: ['48277'],
},
{
category: 'fileset',
field: 'fileset.name',
values: ['eve'],
- originalValue: 'eve',
+ originalValue: ['eve'],
},
{
category: 'flow',
field: 'flow.locality',
values: ['public'],
- originalValue: 'public',
+ originalValue: ['public'],
},
{
category: 'host',
field: 'host.architecture',
values: ['armv7l'],
- originalValue: 'armv7l',
+ originalValue: ['armv7l'],
},
{
category: 'host',
field: 'host.hostname',
values: ['raspberrypi'],
- originalValue: 'raspberrypi',
+ originalValue: ['raspberrypi'],
},
{
category: 'host',
field: 'host.id',
values: ['b19a781f683541a7a25ee345133aa399'],
- originalValue: 'b19a781f683541a7a25ee345133aa399',
+ originalValue: ['b19a781f683541a7a25ee345133aa399'],
},
{
category: 'host',
field: 'host.name',
values: ['raspberrypi'],
- originalValue: 'raspberrypi',
+ originalValue: ['raspberrypi'],
},
{
category: 'host',
field: 'host.os.codename',
values: ['stretch'],
- originalValue: 'stretch',
+ originalValue: ['stretch'],
},
{
category: 'host',
field: 'host.os.family',
values: [''],
- originalValue: '',
+ originalValue: [''],
},
{
category: 'host',
field: 'host.os.kernel',
values: ['4.14.50-v7+'],
- originalValue: '4.14.50-v7+',
+ originalValue: ['4.14.50-v7+'],
},
{
category: 'host',
field: 'host.os.name',
values: ['Raspbian GNU/Linux'],
- originalValue: 'Raspbian GNU/Linux',
+ originalValue: ['Raspbian GNU/Linux'],
},
{
category: 'host',
field: 'host.os.platform',
values: ['raspbian'],
- originalValue: 'raspbian',
+ originalValue: ['raspbian'],
},
{
category: 'host',
field: 'host.os.version',
values: ['9 (stretch)'],
- originalValue: '9 (stretch)',
+ originalValue: ['9 (stretch)'],
},
{
category: 'http',
field: 'http.request.method',
values: ['get'],
- originalValue: 'get',
+ originalValue: ['get'],
},
{
category: 'http',
field: 'http.response.body.bytes',
- values: [48277],
- originalValue: 48277,
+ values: ['48277'],
+ originalValue: ['48277'],
},
{
category: 'http',
field: 'http.response.status_code',
- values: [206],
- originalValue: 206,
+ values: ['206'],
+ originalValue: ['206'],
},
{
category: 'input',
field: 'input.type',
values: ['log'],
- originalValue: 'log',
+ originalValue: ['log'],
},
{
category: 'base',
field: 'labels.pipeline',
values: ['filebeat-7.0.0-suricata-eve-pipeline'],
- originalValue: 'filebeat-7.0.0-suricata-eve-pipeline',
+ originalValue: ['filebeat-7.0.0-suricata-eve-pipeline'],
},
{
category: 'log',
field: 'log.file.path',
values: ['/var/log/suricata/eve.json'],
- originalValue: '/var/log/suricata/eve.json',
+ originalValue: ['/var/log/suricata/eve.json'],
},
{
category: 'log',
field: 'log.offset',
- values: [1856288115],
- originalValue: 1856288115,
+ values: ['1856288115'],
+ originalValue: ['1856288115'],
},
{
category: 'network',
field: 'network.name',
values: ['iot'],
- originalValue: 'iot',
+ originalValue: ['iot'],
},
{
category: 'network',
field: 'network.protocol',
values: ['http'],
- originalValue: 'http',
+ originalValue: ['http'],
},
{
category: 'network',
field: 'network.transport',
values: ['tcp'],
- originalValue: 'tcp',
+ originalValue: ['tcp'],
},
{
category: 'service',
field: 'service.type',
values: ['suricata'],
- originalValue: 'suricata',
+ originalValue: ['suricata'],
},
{
category: 'source',
field: 'source.as.num',
- values: [16509],
- originalValue: 16509,
+ values: ['16509'],
+ originalValue: ['16509'],
},
{
category: 'source',
field: 'source.as.org',
values: ['Amazon.com, Inc.'],
- originalValue: 'Amazon.com, Inc.',
+ originalValue: ['Amazon.com, Inc.'],
},
{
category: 'source',
field: 'source.domain',
values: ['server-54-239-219-210.jfk51.r.cloudfront.net'],
- originalValue: 'server-54-239-219-210.jfk51.r.cloudfront.net',
+ originalValue: ['server-54-239-219-210.jfk51.r.cloudfront.net'],
},
{
category: 'source',
field: 'source.geo.city_name',
values: ['Seattle'],
- originalValue: 'Seattle',
+ originalValue: ['Seattle'],
},
{
category: 'source',
field: 'source.geo.continent_name',
values: ['North America'],
- originalValue: 'North America',
+ originalValue: ['North America'],
},
{
category: 'source',
field: 'source.geo.country_iso_code',
values: ['US'],
- originalValue: 'US',
+ originalValue: ['US'],
},
{
category: 'source',
field: 'source.geo.location.lat',
- values: [47.6103],
- originalValue: 47.6103,
+ values: ['47.6103'],
+ originalValue: ['47.6103'],
},
{
category: 'source',
field: 'source.geo.location.lon',
- values: [-122.3341],
- originalValue: -122.3341,
+ values: ['-122.3341'],
+ originalValue: ['-122.3341'],
},
{
category: 'source',
field: 'source.geo.region_iso_code',
values: ['US-WA'],
- originalValue: 'US-WA',
+ originalValue: ['US-WA'],
},
{
category: 'source',
field: 'source.geo.region_name',
values: ['Washington'],
- originalValue: 'Washington',
+ originalValue: ['Washington'],
},
{
category: 'source',
field: 'source.ip',
values: ['54.239.219.210'],
- originalValue: '54.239.219.210',
+ originalValue: ['54.239.219.210'],
},
{
category: 'source',
field: 'source.port',
- values: [80],
- originalValue: 80,
+ values: ['80'],
+ originalValue: ['80'],
},
{
category: 'suricata',
field: 'suricata.eve.fileinfo.state',
values: ['CLOSED'],
- originalValue: 'CLOSED',
+ originalValue: ['CLOSED'],
},
{
category: 'suricata',
field: 'suricata.eve.fileinfo.tx_id',
- values: [301],
- originalValue: 301,
+ values: ['301'],
+ originalValue: ['301'],
},
{
category: 'suricata',
field: 'suricata.eve.flow_id',
- values: [196625917175466],
- originalValue: 196625917175466,
+ values: ['196625917175466'],
+ originalValue: ['196625917175466'],
},
{
category: 'suricata',
field: 'suricata.eve.http.http_content_type',
values: ['video/mp4'],
- originalValue: 'video/mp4',
+ originalValue: ['video/mp4'],
},
{
category: 'suricata',
field: 'suricata.eve.http.protocol',
values: ['HTTP/1.1'],
- originalValue: 'HTTP/1.1',
+ originalValue: ['HTTP/1.1'],
},
{
category: 'suricata',
field: 'suricata.eve.in_iface',
values: ['eth0'],
- originalValue: 'eth0',
+ originalValue: ['eth0'],
},
{
category: 'base',
@@ -382,7 +383,7 @@ const EXPECTED_DATA = [
category: 'url',
field: 'url.domain',
values: ['s3-iad-2.cf.dash.row.aiv-cdn.net'],
- originalValue: 's3-iad-2.cf.dash.row.aiv-cdn.net',
+ originalValue: ['s3-iad-2.cf.dash.row.aiv-cdn.net'],
},
{
category: 'url',
@@ -390,8 +391,9 @@ const EXPECTED_DATA = [
values: [
'/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/0a9a/bf72/e1da/4c20-919e-0cbabcf7bfe8/75f50c57-d25f-4e97-9e37-01b9f5caa293_audio_13.mp4',
],
- originalValue:
+ originalValue: [
'/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/0a9a/bf72/e1da/4c20-919e-0cbabcf7bfe8/75f50c57-d25f-4e97-9e37-01b9f5caa293_audio_13.mp4',
+ ],
},
{
category: 'url',
@@ -399,26 +401,27 @@ const EXPECTED_DATA = [
values: [
'/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/0a9a/bf72/e1da/4c20-919e-0cbabcf7bfe8/75f50c57-d25f-4e97-9e37-01b9f5caa293_audio_13.mp4',
],
- originalValue:
+ originalValue: [
'/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/0a9a/bf72/e1da/4c20-919e-0cbabcf7bfe8/75f50c57-d25f-4e97-9e37-01b9f5caa293_audio_13.mp4',
+ ],
},
{
category: '_index',
field: '_index',
values: ['filebeat-7.0.0-iot-2019.06'],
- originalValue: 'filebeat-7.0.0-iot-2019.06',
+ originalValue: ['filebeat-7.0.0-iot-2019.06'],
},
{
category: '_id',
field: '_id',
values: ['QRhG1WgBqd-n62SwZYDT'],
- originalValue: 'QRhG1WgBqd-n62SwZYDT',
+ originalValue: ['QRhG1WgBqd-n62SwZYDT'],
},
{
category: '_score',
field: '_score',
- values: [1],
- originalValue: 1,
+ values: ['1'],
+ originalValue: ['1'],
},
];
@@ -452,7 +455,6 @@ export default function ({ getService }: FtrProviderContext) {
eventId: ID,
})
.expect(200);
-
expect(sortBy(detailsData, 'name')).to.eql(sortBy(EXPECTED_DATA, 'name'));
});
diff --git a/x-pack/test/fleet_api_integration/apis/epm/index.js b/x-pack/test/fleet_api_integration/apis/epm/index.js
index 23b7464a317e90..0020e6bdf1bb01 100644
--- a/x-pack/test/fleet_api_integration/apis/epm/index.js
+++ b/x-pack/test/fleet_api_integration/apis/epm/index.js
@@ -11,7 +11,7 @@ export default function loadTests({ loadTestFile }) {
loadTestFile(require.resolve('./setup'));
loadTestFile(require.resolve('./get'));
loadTestFile(require.resolve('./file'));
- //loadTestFile(require.resolve('./template'));
+ loadTestFile(require.resolve('./template'));
loadTestFile(require.resolve('./ilm'));
loadTestFile(require.resolve('./install_by_upload'));
loadTestFile(require.resolve('./install_overrides'));
diff --git a/x-pack/test/fleet_api_integration/apis/epm/template.ts b/x-pack/test/fleet_api_integration/apis/epm/template.ts
index c7e9e211552578..d79452ca0eb6f2 100644
--- a/x-pack/test/fleet_api_integration/apis/epm/template.ts
+++ b/x-pack/test/fleet_api_integration/apis/epm/template.ts
@@ -10,8 +10,8 @@ import { FtrProviderContext } from '../../../api_integration/ftr_provider_contex
import { getTemplate } from '../../../../plugins/fleet/server/services/epm/elasticsearch/template/template';
export default function ({ getService }: FtrProviderContext) {
- const indexPattern = 'foo';
const templateName = 'bar';
+ const templateIndexPattern = 'bar-*';
const es = getService('es');
const mappings = {
properties: {
@@ -25,27 +25,36 @@ export default function ({ getService }: FtrProviderContext) {
it('can be loaded', async () => {
const template = getTemplate({
type: 'logs',
- templateName,
+ templateIndexPattern,
mappings,
packageName: 'system',
composedOfTemplates: [],
+ templatePriority: 200,
});
// This test is not an API integration test with Kibana
// We want to test here if the template is valid and for this we need a running ES instance.
// If the ES instance takes the template, we assume it is a valid template.
- const { body: response1 } = await es.indices.putTemplate({
- name: templateName,
+ const { body: response1 } = await es.transport.request({
+ method: 'PUT',
+ path: `/_index_template/${templateName}`,
body: template,
});
+
// Checks if template loading worked as expected
expect(response1).to.eql({ acknowledged: true });
- const { body: response2 } = await es.indices.getTemplate({ name: templateName });
+ const { body: response2 } = await es.transport.request({
+ method: 'GET',
+ path: `/_index_template/${templateName}`,
+ });
+
// Checks if the content of the template that was loaded is as expected
// We already know based on the above test that the template was valid
// but we check here also if we wrote the index pattern inside the template as expected
- expect(response2[templateName].index_patterns).to.eql([`${indexPattern}-*`]);
+ expect(response2.index_templates[0].index_template.index_patterns).to.eql([
+ templateIndexPattern,
+ ]);
});
});
}
diff --git a/x-pack/test/functional/apps/lens/dashboard.ts b/x-pack/test/functional/apps/lens/dashboard.ts
index 738e45c1cbcf1d..5cbd5dff45e1e0 100644
--- a/x-pack/test/functional/apps/lens/dashboard.ts
+++ b/x-pack/test/functional/apps/lens/dashboard.ts
@@ -156,5 +156,43 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await panelActions.clickContextMenuMoreItem();
await testSubjects.existOrFail(ACTION_TEST_SUBJ);
});
+
+ it('unlink lens panel from embeddable library', async () => {
+ await PageObjects.common.navigateToApp('dashboard');
+ await PageObjects.dashboard.clickNewDashboard();
+ await dashboardAddPanel.clickOpenAddPanel();
+ await dashboardAddPanel.filterEmbeddableNames('lnsPieVis');
+ await find.clickByButtonText('lnsPieVis');
+ await dashboardAddPanel.closeAddPanel();
+
+ const originalPanel = await testSubjects.find('embeddablePanelHeading-lnsPieVis');
+ await panelActions.unlinkFromLibary(originalPanel);
+ await testSubjects.existOrFail('unlinkPanelSuccess');
+
+ const updatedPanel = await testSubjects.find('embeddablePanelHeading-lnsPieVis');
+ const libraryActionExists = await testSubjects.descendantExists(
+ 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION',
+ updatedPanel
+ );
+ expect(libraryActionExists).to.be(false);
+ });
+
+ it('save lens panel to embeddable library', async () => {
+ const originalPanel = await testSubjects.find('embeddablePanelHeading-lnsPieVis');
+ await panelActions.saveToLibrary('lnsPieVis - copy', originalPanel);
+ await testSubjects.click('confirmSaveSavedObjectButton');
+ await testSubjects.existOrFail('addPanelToLibrarySuccess');
+
+ const updatedPanel = await testSubjects.find('embeddablePanelHeading-lnsPieVis-copy');
+ const libraryActionExists = await testSubjects.descendantExists(
+ 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION',
+ updatedPanel
+ );
+ expect(libraryActionExists).to.be(true);
+
+ await dashboardAddPanel.clickOpenAddPanel();
+ await dashboardAddPanel.filterEmbeddableNames('lnsPieVis');
+ await find.existsByLinkText('lnsPieVis');
+ });
});
}
diff --git a/x-pack/test/functional/apps/maps/embeddable/embeddable_library.js b/x-pack/test/functional/apps/maps/embeddable/embeddable_library.js
new file mode 100644
index 00000000000000..40e73f0d8a7632
--- /dev/null
+++ b/x-pack/test/functional/apps/maps/embeddable/embeddable_library.js
@@ -0,0 +1,80 @@
+/*
+ * 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 expect from '@kbn/expect';
+
+export default function ({ getPageObjects, getService }) {
+ const find = getService('find');
+ const testSubjects = getService('testSubjects');
+ const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'maps', 'visualize']);
+ const kibanaServer = getService('kibanaServer');
+ const security = getService('security');
+ const dashboardAddPanel = getService('dashboardAddPanel');
+ const dashboardPanelActions = getService('dashboardPanelActions');
+ const dashboardVisualizations = getService('dashboardVisualizations');
+
+ describe('maps in embeddable library', () => {
+ before(async () => {
+ await security.testUser.setRoles(
+ [
+ 'test_logstash_reader',
+ 'global_maps_all',
+ 'geoshape_data_reader',
+ 'global_dashboard_all',
+ 'meta_for_geoshape_data_reader',
+ ],
+ false
+ );
+ await kibanaServer.uiSettings.replace({
+ defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a',
+ });
+ await PageObjects.common.navigateToApp('dashboard');
+ await PageObjects.dashboard.clickNewDashboard();
+ await dashboardAddPanel.clickCreateNewLink();
+ await dashboardVisualizations.ensureNewVisualizationDialogIsShowing();
+ await PageObjects.visualize.clickMapsApp();
+ await PageObjects.header.waitUntilLoadingHasFinished();
+ await PageObjects.maps.waitForLayersToLoad();
+ await PageObjects.maps.clickSaveAndReturnButton();
+ await PageObjects.dashboard.waitForRenderComplete();
+ });
+
+ after(async () => {
+ await security.testUser.restoreDefaults();
+ });
+
+ it('save map panel to embeddable library', async () => {
+ await dashboardPanelActions.saveToLibrary('embeddable library map');
+ await testSubjects.existOrFail('addPanelToLibrarySuccess');
+
+ const mapPanel = await testSubjects.find('embeddablePanelHeading-embeddablelibrarymap');
+ const libraryActionExists = await testSubjects.descendantExists(
+ 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION',
+ mapPanel
+ );
+ expect(libraryActionExists).to.be(true);
+ });
+
+ it('unlink map panel from embeddable library', async () => {
+ const originalPanel = await testSubjects.find('embeddablePanelHeading-embeddablelibrarymap');
+ await dashboardPanelActions.unlinkFromLibary(originalPanel);
+ await testSubjects.existOrFail('unlinkPanelSuccess');
+
+ const updatedPanel = await testSubjects.find('embeddablePanelHeading-embeddablelibrarymap');
+ const libraryActionExists = await testSubjects.descendantExists(
+ 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION',
+ updatedPanel
+ );
+ expect(libraryActionExists).to.be(false);
+
+ await dashboardAddPanel.clickOpenAddPanel();
+ await dashboardAddPanel.filterEmbeddableNames('embeddable library map');
+ await find.existsByLinkText('embeddable library map');
+ await dashboardAddPanel.closeAddPanel();
+ });
+ });
+}
diff --git a/x-pack/test/functional/apps/maps/embeddable/index.js b/x-pack/test/functional/apps/maps/embeddable/index.js
index 815de2e0813097..9fd4c9db703db9 100644
--- a/x-pack/test/functional/apps/maps/embeddable/index.js
+++ b/x-pack/test/functional/apps/maps/embeddable/index.js
@@ -9,6 +9,7 @@ export default function ({ loadTestFile }) {
describe('embeddable', function () {
loadTestFile(require.resolve('./save_and_return'));
loadTestFile(require.resolve('./dashboard'));
+ loadTestFile(require.resolve('./embeddable_library'));
loadTestFile(require.resolve('./embeddable_state'));
loadTestFile(require.resolve('./tooltip_filter_actions'));
});
diff --git a/x-pack/test/functional/apps/maps/index.js b/x-pack/test/functional/apps/maps/index.js
index d76afb7ebdc249..dd20ed58afbc67 100644
--- a/x-pack/test/functional/apps/maps/index.js
+++ b/x-pack/test/functional/apps/maps/index.js
@@ -47,6 +47,7 @@ export default function ({ loadTestFile, getService }) {
loadTestFile(require.resolve('./es_geo_grid_source'));
loadTestFile(require.resolve('./es_pew_pew_source'));
loadTestFile(require.resolve('./joins'));
+ loadTestFile(require.resolve('./mapbox_styles'));
loadTestFile(require.resolve('./mvt_scaling'));
loadTestFile(require.resolve('./mvt_super_fine'));
loadTestFile(require.resolve('./add_layer_panel'));
diff --git a/x-pack/test/functional/apps/maps/joins.js b/x-pack/test/functional/apps/maps/joins.js
index 094f5335cd05ff..49717016f9c607 100644
--- a/x-pack/test/functional/apps/maps/joins.js
+++ b/x-pack/test/functional/apps/maps/joins.js
@@ -7,8 +7,6 @@
import expect from '@kbn/expect';
-import { MAPBOX_STYLES } from './mapbox_styles';
-
const JOIN_PROPERTY_NAME = '__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1';
const EXPECTED_JOIN_VALUES = {
alpha: 10,
@@ -18,10 +16,6 @@ const EXPECTED_JOIN_VALUES = {
};
const VECTOR_SOURCE_ID = 'n1t6f';
-const CIRCLE_STYLE_LAYER_INDEX = 0;
-const FILL_STYLE_LAYER_INDEX = 2;
-const LINE_STYLE_LAYER_INDEX = 3;
-const TOO_MANY_FEATURES_LAYER_INDEX = 4;
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['maps']);
@@ -95,34 +89,6 @@ export default function ({ getPageObjects, getService }) {
});
});
- it('should style fills, points, lines, and bounding-boxes independently', async () => {
- const mapboxStyle = await PageObjects.maps.getMapboxStyle();
- const layersForVectorSource = mapboxStyle.layers.filter((mbLayer) => {
- return mbLayer.id.startsWith(VECTOR_SOURCE_ID);
- });
-
- //circle layer for points
- expect(layersForVectorSource[CIRCLE_STYLE_LAYER_INDEX]).to.eql(MAPBOX_STYLES.POINT_LAYER);
-
- //fill layer
- expect(layersForVectorSource[FILL_STYLE_LAYER_INDEX]).to.eql(MAPBOX_STYLES.FILL_LAYER);
-
- //line layer for borders
- expect(layersForVectorSource[LINE_STYLE_LAYER_INDEX]).to.eql(MAPBOX_STYLES.LINE_LAYER);
-
- //Too many features layer (this is a static style config)
- expect(layersForVectorSource[TOO_MANY_FEATURES_LAYER_INDEX]).to.eql({
- id: 'n1t6f_toomanyfeatures',
- type: 'fill',
- source: 'n1t6f',
- minzoom: 0,
- maxzoom: 24,
- filter: ['==', ['get', '__kbn_too_many_features__'], true],
- layout: { visibility: 'visible' },
- paint: { 'fill-pattern': '__kbn_too_many_features_image_id__', 'fill-opacity': 0.75 },
- });
- });
-
it('should flag only the joined features as visible', async () => {
const mapboxStyle = await PageObjects.maps.getMapboxStyle();
const vectorSource = mapboxStyle.sources[VECTOR_SOURCE_ID];
diff --git a/x-pack/test/functional/apps/maps/mapbox_styles.js b/x-pack/test/functional/apps/maps/mapbox_styles.js
index d4496f13b8bef4..b483b95e0ca1fc 100644
--- a/x-pack/test/functional/apps/maps/mapbox_styles.js
+++ b/x-pack/test/functional/apps/maps/mapbox_styles.js
@@ -5,176 +5,242 @@
* 2.0.
*/
-export const MAPBOX_STYLES = {
- POINT_LAYER: {
- id: 'n1t6f_circle',
- type: 'circle',
- source: 'n1t6f',
- minzoom: 0,
- maxzoom: 24,
- filter: [
- 'all',
- ['==', ['get', '__kbn_isvisibleduetojoin__'], true],
- [
- 'all',
- ['!=', ['get', '__kbn_too_many_features__'], true],
- ['!=', ['get', '__kbn_is_centroid_feature__'], true],
- ['any', ['==', ['geometry-type'], 'Point'], ['==', ['geometry-type'], 'MultiPoint']],
- ],
- ],
- layout: { visibility: 'visible' },
- paint: {
- 'circle-color': [
- 'interpolate',
- ['linear'],
- [
- 'coalesce',
+import expect from '@kbn/expect';
+
+export default function ({ getPageObjects, getService }) {
+ const PageObjects = getPageObjects(['maps']);
+ const inspector = getService('inspector');
+ const security = getService('security');
+
+ describe('mapbox styles', () => {
+ let mapboxStyle;
+ before(async () => {
+ await security.testUser.setRoles(
+ ['global_maps_all', 'geoshape_data_reader', 'meta_for_geoshape_data_reader'],
+ false
+ );
+ await PageObjects.maps.loadSavedMap('join example');
+ mapboxStyle = await PageObjects.maps.getMapboxStyle();
+ });
+
+ after(async () => {
+ await inspector.close();
+ await security.testUser.restoreDefaults();
+ });
+
+ it('should style circle layer as expected', async () => {
+ const layer = mapboxStyle.layers.find((mbLayer) => {
+ return mbLayer.id === 'n1t6f_circle';
+ });
+ expect(layer).to.eql({
+ id: 'n1t6f_circle',
+ type: 'circle',
+ source: 'n1t6f',
+ minzoom: 0,
+ maxzoom: 24,
+ filter: [
+ 'all',
+ ['==', ['get', '__kbn_isvisibleduetojoin__'], true],
[
- 'case',
- [
- '==',
- ['feature-state', '__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1'],
- null,
- ],
- 2,
+ 'all',
+ ['!=', ['get', '__kbn_too_many_features__'], true],
+ ['!=', ['get', '__kbn_is_centroid_feature__'], true],
+ ['any', ['==', ['geometry-type'], 'Point'], ['==', ['geometry-type'], 'MultiPoint']],
+ ],
+ ],
+ layout: { visibility: 'visible' },
+ paint: {
+ 'circle-color': [
+ 'interpolate',
+ ['linear'],
[
- 'max',
+ 'coalesce',
[
- 'min',
+ 'case',
[
- 'to-number',
+ '==',
[
'feature-state',
'__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1',
],
+ null,
+ ],
+ 2,
+ [
+ 'max',
+ [
+ 'min',
+ [
+ 'to-number',
+ [
+ 'feature-state',
+ '__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1',
+ ],
+ ],
+ 12,
+ ],
+ 3,
],
- 12,
],
- 3,
+ 2,
],
+ 2,
+ 'rgba(0,0,0,0)',
+ 3,
+ '#ecf1f7',
+ 4.125,
+ '#d9e3ef',
+ 5.25,
+ '#c5d5e7',
+ 6.375,
+ '#b2c7df',
+ 7.5,
+ '#9eb9d8',
+ 8.625,
+ '#8bacd0',
+ 9.75,
+ '#769fc8',
+ 10.875,
+ '#6092c0',
],
- 2,
- ],
- 2,
- 'rgba(0,0,0,0)',
- 3,
- '#ecf1f7',
- 4.125,
- '#d9e3ef',
- 5.25,
- '#c5d5e7',
- 6.375,
- '#b2c7df',
- 7.5,
- '#9eb9d8',
- 8.625,
- '#8bacd0',
- 9.75,
- '#769fc8',
- 10.875,
- '#6092c0',
- ],
- 'circle-opacity': 0.75,
- 'circle-stroke-color': '#41937c',
- 'circle-stroke-opacity': 0.75,
- 'circle-stroke-width': 1,
- 'circle-radius': 10,
- },
- },
- FILL_LAYER: {
- id: 'n1t6f_fill',
- type: 'fill',
- source: 'n1t6f',
- minzoom: 0,
- maxzoom: 24,
- filter: [
- 'all',
- ['==', ['get', '__kbn_isvisibleduetojoin__'], true],
- [
- 'all',
- ['!=', ['get', '__kbn_too_many_features__'], true],
- ['!=', ['get', '__kbn_is_centroid_feature__'], true],
- ['any', ['==', ['geometry-type'], 'Polygon'], ['==', ['geometry-type'], 'MultiPolygon']],
- ],
- ],
- layout: { visibility: 'visible' },
- paint: {
- 'fill-color': [
- 'interpolate',
- ['linear'],
- [
- 'coalesce',
+ 'circle-opacity': 0.75,
+ 'circle-stroke-color': '#41937c',
+ 'circle-stroke-opacity': 0.75,
+ 'circle-stroke-width': 1,
+ 'circle-radius': 10,
+ },
+ });
+ });
+
+ it('should style fill layer as expected', async () => {
+ const layer = mapboxStyle.layers.find((mbLayer) => {
+ return mbLayer.id === 'n1t6f_fill';
+ });
+ expect(layer).to.eql({
+ id: 'n1t6f_fill',
+ type: 'fill',
+ source: 'n1t6f',
+ minzoom: 0,
+ maxzoom: 24,
+ filter: [
+ 'all',
+ ['==', ['get', '__kbn_isvisibleduetojoin__'], true],
[
- 'case',
+ 'all',
+ ['!=', ['get', '__kbn_too_many_features__'], true],
+ ['!=', ['get', '__kbn_is_centroid_feature__'], true],
[
- '==',
- ['feature-state', '__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1'],
- null,
+ 'any',
+ ['==', ['geometry-type'], 'Polygon'],
+ ['==', ['geometry-type'], 'MultiPolygon'],
],
- 2,
+ ],
+ ],
+ layout: { visibility: 'visible' },
+ paint: {
+ 'fill-color': [
+ 'interpolate',
+ ['linear'],
[
- 'max',
+ 'coalesce',
[
- 'min',
+ 'case',
[
- 'to-number',
+ '==',
[
'feature-state',
'__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1',
],
+ null,
+ ],
+ 2,
+ [
+ 'max',
+ [
+ 'min',
+ [
+ 'to-number',
+ [
+ 'feature-state',
+ '__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1',
+ ],
+ ],
+ 12,
+ ],
+ 3,
],
- 12,
],
- 3,
+ 2,
+ ],
+ 2,
+ 'rgba(0,0,0,0)',
+ 3,
+ '#ecf1f7',
+ 4.125,
+ '#d9e3ef',
+ 5.25,
+ '#c5d5e7',
+ 6.375,
+ '#b2c7df',
+ 7.5,
+ '#9eb9d8',
+ 8.625,
+ '#8bacd0',
+ 9.75,
+ '#769fc8',
+ 10.875,
+ '#6092c0',
+ ],
+ 'fill-opacity': 0.75,
+ },
+ });
+ });
+
+ it('should style fill layer as expected', async () => {
+ const layer = mapboxStyle.layers.find((mbLayer) => {
+ return mbLayer.id === 'n1t6f_line';
+ });
+ expect(layer).to.eql({
+ id: 'n1t6f_line',
+ type: 'line',
+ source: 'n1t6f',
+ minzoom: 0,
+ maxzoom: 24,
+ filter: [
+ 'all',
+ ['==', ['get', '__kbn_isvisibleduetojoin__'], true],
+ [
+ 'all',
+ ['!=', ['get', '__kbn_too_many_features__'], true],
+ ['!=', ['get', '__kbn_is_centroid_feature__'], true],
+ [
+ 'any',
+ ['==', ['geometry-type'], 'Polygon'],
+ ['==', ['geometry-type'], 'MultiPolygon'],
+ ['==', ['geometry-type'], 'LineString'],
+ ['==', ['geometry-type'], 'MultiLineString'],
],
],
- 2,
- ],
- 2,
- 'rgba(0,0,0,0)',
- 3,
- '#ecf1f7',
- 4.125,
- '#d9e3ef',
- 5.25,
- '#c5d5e7',
- 6.375,
- '#b2c7df',
- 7.5,
- '#9eb9d8',
- 8.625,
- '#8bacd0',
- 9.75,
- '#769fc8',
- 10.875,
- '#6092c0',
- ],
- 'fill-opacity': 0.75,
- },
- },
- LINE_LAYER: {
- id: 'n1t6f_line',
- type: 'line',
- source: 'n1t6f',
- minzoom: 0,
- maxzoom: 24,
- filter: [
- 'all',
- ['==', ['get', '__kbn_isvisibleduetojoin__'], true],
- [
- 'all',
- ['!=', ['get', '__kbn_too_many_features__'], true],
- ['!=', ['get', '__kbn_is_centroid_feature__'], true],
- [
- 'any',
- ['==', ['geometry-type'], 'Polygon'],
- ['==', ['geometry-type'], 'MultiPolygon'],
- ['==', ['geometry-type'], 'LineString'],
- ['==', ['geometry-type'], 'MultiLineString'],
],
- ],
- ],
- layout: { visibility: 'visible' },
- paint: { 'line-color': '#41937c', 'line-opacity': 0.75, 'line-width': 1 },
- },
-};
+ layout: { visibility: 'visible' },
+ paint: { 'line-color': '#41937c', 'line-opacity': 0.75, 'line-width': 1 },
+ });
+ });
+
+ it('should style incomplete data layer as expected', async () => {
+ const layer = mapboxStyle.layers.find((mbLayer) => {
+ return mbLayer.id === 'n1t6f_toomanyfeatures';
+ });
+ expect(layer).to.eql({
+ id: 'n1t6f_toomanyfeatures',
+ type: 'fill',
+ source: 'n1t6f',
+ minzoom: 0,
+ maxzoom: 24,
+ filter: ['==', ['get', '__kbn_too_many_features__'], true],
+ layout: { visibility: 'visible' },
+ paint: { 'fill-pattern': '__kbn_too_many_features_image_id__', 'fill-opacity': 0.75 },
+ });
+ });
+ });
+}
diff --git a/yarn.lock b/yarn.lock
index 6df258e9715b78..ec6cf338a43da2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6803,7 +6803,7 @@
dependencies:
"@types/webpack" "*"
-"@types/webpack-sources@*":
+"@types/webpack-sources@*", "@types/webpack-sources@^0.1.4":
version "0.1.5"
resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-0.1.5.tgz#be47c10f783d3d6efe1471ff7f042611bd464a92"
integrity sha512-zfvjpp7jiafSmrzJ2/i3LqOyTYTuJ7u1KOXlKgDlvsj9Rr0x7ZiYu5lZbXwobL7lmsRNtPXlBfmaUD8eU2Hu8w==