Skip to content

Commit

Permalink
Merge branch 'main' into create-types-pkg-bazel-rule
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Nov 6, 2021
2 parents c114e5b + 3fc3f36 commit 51f5b9d
Show file tree
Hide file tree
Showing 157 changed files with 1,680 additions and 476 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,8 @@ readonly links: {
readonly rubyOverview: string;
readonly rustGuide: string;
};
readonly endpoints: {
readonly troubleshooting: string;
};
};
```

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ export class DocLinksService {
rubyOverview: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/ruby-api/${DOC_LINK_VERSION}/ruby_client.html`,
rustGuide: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/rust-api/${DOC_LINK_VERSION}/index.html`,
},
endpoints: {
troubleshooting: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/ts-management.html#ts-endpoints`,
},
},
});
}
Expand Down Expand Up @@ -770,5 +773,8 @@ export interface DocLinksStart {
readonly rubyOverview: string;
readonly rustGuide: string;
};
readonly endpoints: {
readonly troubleshooting: string;
};
};
}
3 changes: 3 additions & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@ export interface DocLinksStart {
readonly rubyOverview: string;
readonly rustGuide: string;
};
readonly endpoints: {
readonly troubleshooting: string;
};
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const EditorMenu = ({ dashboardContainer, createNewVisType }: Props) => {
<SolutionToolbarPopover
ownFocus
label={i18n.translate('dashboard.solutionToolbar.editorMenuButtonLabel', {
defaultMessage: 'All types',
defaultMessage: 'Select type',
})}
iconType="arrowDown"
iconSide="right"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'labs:canvas:byValueEmbeddable': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'labs:canvas:useDataService': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface UsageStats {
'banners:textColor': string;
'banners:backgroundColor': string;
'labs:canvas:enable_ui': boolean;
'labs:canvas:byValueEmbeddable': boolean;
'labs:canvas:useDataService': boolean;
'labs:presentation:timeToPresent': boolean;
'labs:dashboard:enable_ui': boolean;
Expand Down
17 changes: 16 additions & 1 deletion src/plugins/presentation_util/common/labs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { i18n } from '@kbn/i18n';
export const LABS_PROJECT_PREFIX = 'labs:';
export const DEFER_BELOW_FOLD = `${LABS_PROJECT_PREFIX}dashboard:deferBelowFold` as const;
export const DASHBOARD_CONTROLS = `${LABS_PROJECT_PREFIX}dashboard:dashboardControls` as const;
export const projectIDs = [DEFER_BELOW_FOLD, DASHBOARD_CONTROLS] as const;
export const BY_VALUE_EMBEDDABLE = `${LABS_PROJECT_PREFIX}canvas:byValueEmbeddable` as const;

export const projectIDs = [DEFER_BELOW_FOLD, DASHBOARD_CONTROLS, BY_VALUE_EMBEDDABLE] as const;
export const environmentNames = ['kibana', 'browser', 'session'] as const;
export const solutionNames = ['canvas', 'dashboard', 'presentation'] as const;

Expand Down Expand Up @@ -48,6 +50,19 @@ export const projects: { [ID in ProjectID]: ProjectConfig & { id: ID } } = {
}),
solutions: ['dashboard'],
},
[BY_VALUE_EMBEDDABLE]: {
id: BY_VALUE_EMBEDDABLE,
isActive: true,
isDisplayed: true,
environments: ['kibana', 'browser', 'session'],
name: i18n.translate('presentationUtil.labs.enableByValueEmbeddableName', {
defaultMessage: 'By-Value Embeddables',
}),
description: i18n.translate('presentationUtil.labs.enableByValueEmbeddableDescription', {
defaultMessage: 'Enables support for by-value embeddables in Canvas',
}),
solutions: ['canvas'],
},
};

export type ProjectID = typeof projectIDs[number];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
.quickButtonGroup {
.quickButtonGroup__button {
background-color: $euiColorEmptyShade;
// sass-lint:disable-block no-important
border-width: $euiBorderWidthThin !important;
border-style: solid !important;
border-color: $euiBorderColor !important;
.euiButtonGroup__buttons {
border-radius: $euiBorderRadius;

.quickButtonGroup__button {
background-color: $euiColorEmptyShade;
// sass-lint:disable-block no-important
border-width: $euiBorderWidthThin !important;
border-style: solid !important;
border-color: $euiBorderColor !important;
}

.quickButtonGroup__button:first-of-type {
// sass-lint:disable-block no-important
border-top-left-radius: $euiBorderRadius !important;
border-bottom-left-radius: $euiBorderRadius !important;
}

.quickButtonGroup__button:last-of-type {
// sass-lint:disable-block no-important
border-top-right-radius: $euiBorderRadius !important;
border-bottom-right-radius: $euiBorderRadius !important;
}
}
}
6 changes: 6 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7683,6 +7683,12 @@
"description": "Non-default value of setting."
}
},
"labs:canvas:byValueEmbeddable": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"labs:canvas:useDataService": {
"type": "boolean",
"_meta": {
Expand Down
10 changes: 9 additions & 1 deletion test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class DiscoverPageObject extends FtrService {
await fieldSearch.clearValue();
}

public async saveSearch(searchName: string) {
public async saveSearch(searchName: string, saveAsNew?: boolean) {
await this.clickSaveSearchButton();
// preventing an occasional flakiness when the saved object wasn't set and the form can't be submitted
await this.retry.waitFor(
Expand All @@ -59,6 +59,14 @@ export class DiscoverPageObject extends FtrService {
return (await saveButton.getAttribute('disabled')) !== 'true';
}
);

if (saveAsNew !== undefined) {
await this.retry.waitFor(`save as new switch is set`, async () => {
await this.testSubjects.setEuiSwitch('saveAsNewCheckbox', saveAsNew ? 'check' : 'uncheck');
return (await this.testSubjects.isEuiSwitchChecked('saveAsNewCheckbox')) === saveAsNew;
});
}

await this.testSubjects.click('confirmSaveSavedObjectButton');
await this.header.waitUntilLoadingHasFinished();
// LeeDr - this additional checking for the saved search name was an attempt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
const INITIAL_STATE = {
currentPeriod: [],
previousPeriod: [],
throughputUnit: 'minute' as const,
};

export function ServiceOverviewThroughputChart({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { ProcessorEvent } from '../../../common/processor_event';
import { Setup } from '../helpers/setup_request';
import { getOffsetInMs } from '../../../common/utils/get_offset_in_ms';
import { getBucketSize } from '../helpers/get_bucket_size';
import { calculateThroughputWithInterval } from '../helpers/calculate_throughput';

export async function getThroughputChartsForBackend({
backendName,
Expand All @@ -42,7 +41,7 @@ export async function getThroughputChartsForBackend({
offset,
});

const { intervalString, bucketSize } = getBucketSize({
const { intervalString } = getBucketSize({
start: startWithOffset,
end: endWithOffset,
minBucketSize: 60,
Expand Down Expand Up @@ -73,9 +72,10 @@ export async function getThroughputChartsForBackend({
extended_bounds: { min: startWithOffset, max: endWithOffset },
},
aggs: {
spanDestinationLatencySum: {
sum: {
throughput: {
rate: {
field: SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT,
unit: 'minute',
},
},
},
Expand All @@ -88,10 +88,7 @@ export async function getThroughputChartsForBackend({
response.aggregations?.timeseries.buckets.map((bucket) => {
return {
x: bucket.key + offsetInMs,
y: calculateThroughputWithInterval({
bucketSize,
value: bucket.spanDestinationLatencySum.value || 0,
}),
y: bucket.throughput.value,
};
}) ?? []
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import {
getDocumentTypeFilterForTransactions,
getProcessorEventForTransactions,
} from '../helpers/transactions';
import {
calculateThroughputWithInterval,
calculateThroughputWithRange,
} from '../helpers/calculate_throughput';
import { calculateThroughputWithRange } from '../helpers/calculate_throughput';

export async function getTransactionsPerMinute({
setup,
Expand Down Expand Up @@ -70,6 +67,9 @@ export async function getTransactionsPerMinute({
fixed_interval: intervalString,
min_doc_count: 0,
},
aggs: {
throughput: { rate: { unit: 'minute' as const } },
},
},
},
},
Expand Down Expand Up @@ -98,10 +98,7 @@ export async function getTransactionsPerMinute({
timeseries:
topTransactionTypeBucket?.timeseries.buckets.map((bucket) => ({
x: bucket.key,
y: calculateThroughputWithInterval({
bucketSize,
value: bucket.doc_count,
}),
y: bucket.throughput.value,
})) || [],
};
}
12 changes: 7 additions & 5 deletions x-pack/plugins/apm/server/lib/services/get_throughput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { AggregationsDateInterval } from '@elastic/elasticsearch/lib/api/types';
import { ESFilter } from '../../../../../../src/core/types/elasticsearch';
import {
SERVICE_NAME,
Expand All @@ -18,7 +19,6 @@ import {
getProcessorEventForTransactions,
} from '../helpers/transactions';
import { Setup } from '../helpers/setup_request';
import { calculateThroughputWithInterval } from '../helpers/calculate_throughput';

interface Options {
environment: string;
Expand Down Expand Up @@ -81,6 +81,11 @@ export async function getThroughput({
min_doc_count: 0,
extended_bounds: { min: start, max: end },
},
aggs: {
throughput: {
rate: { unit: 'minute' as AggregationsDateInterval },
},
},
},
},
},
Expand All @@ -95,10 +100,7 @@ export async function getThroughput({
response.aggregations?.timeseries.buckets.map((bucket) => {
return {
x: bucket.key,
y: calculateThroughputWithInterval({
bucketSize,
value: bucket.doc_count,
}),
y: bucket.throughput.value,
};
}) ?? []
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { ExpressionTypeDefinition } from '../../../../../src/plugins/expressions';
import { EmbeddableInput } from '../../../../../src/plugins/embeddable/common/';
import { EmbeddableInput } from '../../types';
import { EmbeddableTypes } from './embeddable_types';

export const EmbeddableExpressionType = 'embeddable';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@
*/

import { functions as commonFunctions } from '../common';
import { functions as externalFunctions } from '../external';
import { location } from './location';
import { markdown } from './markdown';
import { urlparam } from './urlparam';
import { escount } from './escount';
import { esdocs } from './esdocs';
import { essql } from './essql';

export const functions = [
location,
markdown,
urlparam,
escount,
esdocs,
essql,
...commonFunctions,
...externalFunctions,
];
export const functions = [location, markdown, urlparam, escount, esdocs, essql, ...commonFunctions];
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 { embeddableFunctionFactory } from './embeddable';
import { getQueryFilters } from '../../../common/lib/build_embeddable_filters';
import { ExpressionValueFilter } from '../../../types';
import { encode } from '../../../common/lib/embeddable_dataurl';
import { InitializeArguments } from '.';

const filterContext: ExpressionValueFilter = {
type: 'filter',
and: [
{
type: 'filter',
and: [],
value: 'filter-value',
column: 'filter-column',
filterType: 'exactly',
},
{
type: 'filter',
and: [],
column: 'time-column',
filterType: 'time',
from: '2019-06-04T04:00:00.000Z',
to: '2019-06-05T04:00:00.000Z',
},
],
};

describe('embeddable', () => {
const fn = embeddableFunctionFactory({} as InitializeArguments)().fn;
const config = {
id: 'some-id',
timerange: { from: '15m', to: 'now' },
title: 'test embeddable',
};

const args = {
config: encode(config),
type: 'visualization',
};

it('accepts null context', () => {
const expression = fn(null, args, {} as any);

expect(expression.input.filters).toEqual([]);
});

it('accepts filter context', () => {
const expression = fn(filterContext, args, {} as any);
const embeddableFilters = getQueryFilters(filterContext.and);

expect(expression.input.filters).toEqual(embeddableFilters);
});
});
Loading

0 comments on commit 51f5b9d

Please sign in to comment.