Skip to content

Commit

Permalink
Merge branch 'master' into alerting/management-feature-privileges
Browse files Browse the repository at this point in the history
* master: (34 commits)
  Adds Role Based Access-Control to the Alerting & Action plugins based on Kibana Feature Controls (elastic#67157)
  [Monitoring] Revert direct shipping code (elastic#72505)
  Use server basepath  when creating reporting jobs (elastic#72722)
  Adding api test for transaction_groups /breakdown and /avg_duration_by_browser (elastic#72623)
  [Task Manager] Addresses flaky test introduced by buffered store (elastic#72815)
  [Observability] filter "hasData" api by processor event (elastic#72810)
  do  not pass title as part of tsvb request (elastic#72619)
  [Lens] Legend config (elastic#70619)
  Stabilize closing toast (elastic#72097)
  stabilize failing test (elastic#72086)
  Stabilize filter bar test (elastic#72032)
  Unskip vislib tests (elastic#71452)
  [ML] Fix layout of anomaly chart tooltip for long field values (elastic#72689)
  fix preAuth/preRouting mocks (elastic#72663)
  [Security Solution] Hide KQL bar (all pages) and alerts filters (Detections) when Resolver is full screen (elastic#72788)
  [Uptime] Rename Whitelist to Allowlist in parse_filter_map (elastic#71584)
  [Security Solution] Fixes exception modal not loading content (elastic#72770)
  [Security Solution][Exceptions] - Require non empty entries and non empty string values in exception list items (elastic#72748)
  [Detections] Add validation for Threshold value field (elastic#72611)
  [SIEM][Detection Engine][Lists] Adds version and immutability data structures (elastic#72730)
  ...
  • Loading branch information
gmmorris committed Jul 22, 2020
2 parents fb1d793 + 4abe864 commit 7c51753
Show file tree
Hide file tree
Showing 299 changed files with 12,132 additions and 3,028 deletions.
6 changes: 6 additions & 0 deletions .ci/Jenkinsfile_baseline_trigger
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ kibanaLibrary.load()

withGithubCredentials {
branches.each { branch ->
if (branch == '6.8') {
// skip 6.8, it is tracked but we don't need snapshots for it and haven't backported
// the baseline capture scripts to it.
return;
}

stage(branch) {
def commits = getCommits(branch, MAXIMUM_COMMITS_TO_CHECK, MAXIMUM_COMMITS_TO_BUILD)

Expand Down
7 changes: 6 additions & 1 deletion src/core/server/http/http_server.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ function createKibanaRequestMock<P = any, Q = any, B = any>({
settings: { tags: routeTags, auth: routeAuthRequired, app: kibanaRouteState },
},
raw: {
req: { socket },
req: {
socket,
// these are needed to avoid an error when consuming KibanaRequest.events
on: jest.fn(),
off: jest.fn(),
},
},
}),
{
Expand Down
10 changes: 8 additions & 2 deletions src/core/server/http/http_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { OnPreRoutingToolkit } from './lifecycle/on_pre_routing';
import { AuthToolkit } from './lifecycle/auth';
import { sessionStorageMock } from './cookie_session_storage.mocks';
import { OnPostAuthToolkit } from './lifecycle/on_post_auth';
import { OnPreAuthToolkit } from './lifecycle/on_pre_auth';
import { OnPreResponseToolkit } from './lifecycle/on_pre_response';

type BasePathMocked = jest.Mocked<InternalHttpServiceSetup['basePath']>;
Expand Down Expand Up @@ -175,15 +176,19 @@ const createHttpServiceMock = () => {
return mocked;
};

const createOnPreAuthToolkitMock = (): jest.Mocked<OnPreRoutingToolkit> => ({
const createOnPreAuthToolkitMock = (): jest.Mocked<OnPreAuthToolkit> => ({
next: jest.fn(),
rewriteUrl: jest.fn(),
});

const createOnPostAuthToolkitMock = (): jest.Mocked<OnPostAuthToolkit> => ({
next: jest.fn(),
});

const createOnPreRoutingToolkitMock = (): jest.Mocked<OnPreRoutingToolkit> => ({
next: jest.fn(),
rewriteUrl: jest.fn(),
});

const createAuthToolkitMock = (): jest.Mocked<AuthToolkit> => ({
authenticated: jest.fn(),
notHandled: jest.fn(),
Expand All @@ -205,6 +210,7 @@ export const httpServiceMock = {
createOnPreAuthToolkit: createOnPreAuthToolkitMock,
createOnPostAuthToolkit: createOnPostAuthToolkitMock,
createOnPreResponseToolkit: createOnPreResponseToolkitMock,
createOnPreRoutingToolkit: createOnPreRoutingToolkitMock,
createAuthToolkit: createAuthToolkitMock,
createRouter: mockRouter.create,
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,31 @@ import { IIndexPattern } from '../..';

describe('SearchSource#normalizeSortRequest', function () {
const scriptedField = {
name: 'script string',
name: 'script number',
type: 'number',
scripted: true,
sortable: true,
script: 'foo',
lang: 'painless',
};
const stringScriptedField = {
...scriptedField,
name: 'script string',
type: 'string',
};
const booleanScriptedField = {
...scriptedField,
name: 'script boolean',
type: 'boolean',
};
const murmurScriptedField = {
...scriptedField,
sortable: false,
name: 'murmur script',
type: 'murmur3',
};
const indexPattern = {
fields: [scriptedField, murmurScriptedField],
fields: [scriptedField, stringScriptedField, booleanScriptedField, murmurScriptedField],
} as IIndexPattern;

it('should return an array', function () {
Expand Down Expand Up @@ -106,6 +116,54 @@ describe('SearchSource#normalizeSortRequest', function () {
]);
});

it('should use script based sorting with string type', function () {
const result = normalizeSortRequest(
[
{
[stringScriptedField.name]: SortDirection.asc,
},
],
indexPattern
);

expect(result).toEqual([
{
_script: {
script: {
source: stringScriptedField.script,
lang: stringScriptedField.lang,
},
type: 'string',
order: SortDirection.asc,
},
},
]);
});

it('should use script based sorting with boolean type as string type', function () {
const result = normalizeSortRequest(
[
{
[booleanScriptedField.name]: SortDirection.asc,
},
],
indexPattern
);

expect(result).toEqual([
{
_script: {
script: {
source: booleanScriptedField.script,
lang: booleanScriptedField.lang,
},
type: 'string',
order: SortDirection.asc,
},
},
]);
});

it('should use script based sorting only on sortable types', function () {
const result = normalizeSortRequest(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function normalize(

// The ES API only supports sort scripts of type 'number' and 'string'
function castSortType(type: string) {
if (['number', 'string'].includes(type)) {
if (['number'].includes(type)) {
return 'number';
} else if (['string', 'boolean'].includes(type)) {
return 'string';
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function ValueAxisOptions({

<LabelOptions
axisLabels={axis.labels}
axisFilterCheckboxName={`yAxisFilterLabelsCheckbox${axis.id}`}
axisFilterCheckboxName={`yAxisFilterLabelsCheckbox-${axis.id}`}
setAxisLabel={setAxisLabel}
/>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/visualizations/public/legacy/build_pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const buildPipelineVisFunction: BuildPipelineVisFunction = {
input_control_vis: (params) => {
return `input_control_vis ${prepareJson('visConfig', params)}`;
},
metrics: (params, schemas, uiState = {}) => {
metrics: ({ title, ...params }, schemas, uiState = {}) => {
const paramsJson = prepareJson('params', params);
const uiStateJson = prepareJson('uiState', uiState);

Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/dashboard/dashboard_filter_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export default function ({ getService, getPageObjects }) {
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']);

// FLAKY: https://github.com/elastic/kibana/issues/71987
describe.skip('dashboard filter bar', () => {
describe('dashboard filter bar', () => {
before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
Expand Down Expand Up @@ -69,6 +68,7 @@ export default function ({ getService, getPageObjects }) {
it('uses default index pattern on an empty dashboard', async () => {
await testSubjects.click('addFilter');
await dashboardExpect.fieldSuggestions(['bytes']);
await filterBar.ensureFieldEditorModalIsClosed();
});

it('shows index pattern of vis when one is added', async () => {
Expand All @@ -77,6 +77,7 @@ export default function ({ getService, getPageObjects }) {
await filterBar.ensureFieldEditorModalIsClosed();
await testSubjects.click('addFilter');
await dashboardExpect.fieldSuggestions(['animal']);
await filterBar.ensureFieldEditorModalIsClosed();
});

it('works when a vis with no index pattern is added', async () => {
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/dashboard/dashboard_snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export default function ({ getService, getPageObjects, updateBaselines }) {
const dashboardPanelActions = getService('dashboardPanelActions');
const dashboardAddPanel = getService('dashboardAddPanel');

// FLAKY: https://github.com/elastic/kibana/issues/52854
describe.skip('dashboard snapshots', function describeIndexTests() {
describe('dashboard snapshots', function describeIndexTests() {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
Expand Down
62 changes: 15 additions & 47 deletions test/functional/apps/visualize/_area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export default function ({ getService, getPageObjects }) {
});
});

describe.skip('switch between Y axis scale types', () => {
describe('switch between Y axis scale types', () => {
before(initAreaChart);
const axisId = 'ValueAxis-1';

Expand All @@ -308,57 +308,25 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visEditor.selectYAxisScaleType(axisId, 'log');
await PageObjects.visEditor.changeYAxisFilterLabelsCheckbox(axisId, false);
await PageObjects.visEditor.clickGo();
const labels = await PageObjects.visChart.getYAxisLabels();
const expectedLabels = [
'2',
'3',
'5',
'7',
'10',
'20',
'30',
'50',
'70',
'100',
'200',
'300',
'500',
'700',
'1,000',
'2,000',
'3,000',
'5,000',
'7,000',
];
expect(labels).to.eql(expectedLabels);
const labels = await PageObjects.visChart.getYAxisLabelsAsNumbers();
const minLabel = 2;
const maxLabel = 5000;
const numberOfLabels = 10;
expect(labels.length).to.be.greaterThan(numberOfLabels);
expect(labels[0]).to.eql(minLabel);
expect(labels[labels.length - 1]).to.be.greaterThan(maxLabel);
});

it('should show filtered ticks on selecting log scale', async () => {
await PageObjects.visEditor.changeYAxisFilterLabelsCheckbox(axisId, true);
await PageObjects.visEditor.clickGo();
const labels = await PageObjects.visChart.getYAxisLabels();
const expectedLabels = [
'2',
'3',
'5',
'7',
'10',
'20',
'30',
'50',
'70',
'100',
'200',
'300',
'500',
'700',
'1,000',
'2,000',
'3,000',
'5,000',
'7,000',
];
expect(labels).to.eql(expectedLabels);
const labels = await PageObjects.visChart.getYAxisLabelsAsNumbers();
const minLabel = 2;
const maxLabel = 5000;
const numberOfLabels = 10;
expect(labels.length).to.be.greaterThan(numberOfLabels);
expect(labels[0]).to.eql(minLabel);
expect(labels[labels.length - 1]).to.be.greaterThan(maxLabel);
});

it('should show ticks on selecting square root scale', async () => {
Expand Down
62 changes: 15 additions & 47 deletions test/functional/apps/visualize/_line_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visChart.waitForVisualization();
});

describe.skip('switch between Y axis scale types', () => {
describe('switch between Y axis scale types', () => {
before(initLineChart);
const axisId = 'ValueAxis-1';

Expand All @@ -191,57 +191,25 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visEditor.selectYAxisScaleType(axisId, 'log');
await PageObjects.visEditor.changeYAxisFilterLabelsCheckbox(axisId, false);
await PageObjects.visEditor.clickGo();
const labels = await PageObjects.visChart.getYAxisLabels();
const expectedLabels = [
'2',
'3',
'5',
'7',
'10',
'20',
'30',
'50',
'70',
'100',
'200',
'300',
'500',
'700',
'1,000',
'2,000',
'3,000',
'5,000',
'7,000',
];
expect(labels).to.eql(expectedLabels);
const labels = await PageObjects.visChart.getYAxisLabelsAsNumbers();
const minLabel = 2;
const maxLabel = 5000;
const numberOfLabels = 10;
expect(labels.length).to.be.greaterThan(numberOfLabels);
expect(labels[0]).to.eql(minLabel);
expect(labels[labels.length - 1]).to.be.greaterThan(maxLabel);
});

it('should show filtered ticks on selecting log scale', async () => {
await PageObjects.visEditor.changeYAxisFilterLabelsCheckbox(axisId, true);
await PageObjects.visEditor.clickGo();
const labels = await PageObjects.visChart.getYAxisLabels();
const expectedLabels = [
'2',
'3',
'5',
'7',
'10',
'20',
'30',
'50',
'70',
'100',
'200',
'300',
'500',
'700',
'1,000',
'2,000',
'3,000',
'5,000',
'7,000',
];
expect(labels).to.eql(expectedLabels);
const labels = await PageObjects.visChart.getYAxisLabelsAsNumbers();
const minLabel = 2;
const maxLabel = 5000;
const numberOfLabels = 10;
expect(labels.length).to.be.greaterThan(numberOfLabels);
expect(labels[0]).to.eql(minLabel);
expect(labels[labels.length - 1]).to.be.greaterThan(maxLabel);
});

it('should show ticks on selecting square root scale', async () => {
Expand Down
Loading

0 comments on commit 7c51753

Please sign in to comment.