Skip to content

Commit

Permalink
Merge branch 'main' into lens-serverless-fnt
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula authored Oct 3, 2023
2 parents 4da1af2 + b02f64b commit 80464d0
Show file tree
Hide file tree
Showing 236 changed files with 5,610 additions and 1,185 deletions.
16 changes: 16 additions & 0 deletions packages/kbn-check-mappings-update-cli/current_mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3131,6 +3131,22 @@
}
}
},
"apm-custom-dashboards": {
"properties": {
"dashboardSavedObjectId": {
"type": "keyword"
},
"kuery": {
"type": "text"
},
"serviceEnvironmentFilterEnabled": {
"type": "boolean"
},
"serviceNameFilterEnabled": {
"type": "boolean"
}
}
},
"enterprise_search_telemetry": {
"dynamic": false,
"properties": {}
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
setUpgradeMode: `${ELASTICSEARCH_DOCS}ml-set-upgrade-mode.html`,
trainedModels: `${MACHINE_LEARNING_DOCS}ml-trained-models.html`,
startTrainedModelsDeployment: `${MACHINE_LEARNING_DOCS}ml-nlp-deploy-model.html`,
nlpElser: `${MACHINE_LEARNING_DOCS}ml-nlp-elser.html`,
},
transforms: {
guide: `${ELASTICSEARCH_DOCS}transforms.html`,
Expand Down
7 changes: 7 additions & 0 deletions packages/kbn-journeys/services/page/kibana_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ export class KibanaPage {
});
}

async waitForChartsSuggestions(count: number) {
await this.retry.waitFor(`rendering of ${count} suggestions is completed`, async () => {
const renderingItems = await this.page.$$('button[data-test-subj="lnsSuggestion"]');
return renderingItems.length === count;
});
}

async clearInput(locator: string) {
const textArea = this.page.locator(locator);
await textArea.clear();
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-shared-svg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@

import noResultsIllustrationDark from './src/assets/no_results_dark.svg';
import noResultsIllustrationLight from './src/assets/no_results_light.svg';
import dashboardsLight from './src/assets/dashboards_light.svg';
import dashboardsDark from './src/assets/dashboards_dark.svg';

export { noResultsIllustrationDark, noResultsIllustrationLight };
export { noResultsIllustrationDark, noResultsIllustrationLight, dashboardsLight, dashboardsDark };
1 change: 1 addition & 0 deletions packages/kbn-shared-svg/src/assets/dashboards_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/kbn-shared-svg/src/assets/dashboards_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"action_task_params": "96e27e7f4e8273ffcd87060221e2b75e81912dd5",
"alert": "dc710bc17dfc98a9a703d388569abccce5f8bf07",
"api_key_pending_invalidation": "1399e87ca37b3d3a65d269c924eda70726cfe886",
"apm-custom-dashboards": "b67128f78160c288bd7efe25b2da6e2afd5e82fc",
"apm-indices": "8a2d68d415a4b542b26b0d292034a28ffac6fed4",
"apm-server-schema": "58a8c6468edae3d1dc520f0134f59cf3f4fd7eff",
"apm-service-group": "66dfc1ddd40bad8f693c873bf6002ca30079a4ae",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const previouslyRegisteredTypes = [
'action_task_params',
'alert',
'api_key_pending_invalidation',
'apm-custom-dashboards',
'apm-indices',
'apm-server-schema',
'apm-service-group',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ describe('split .kibana index into multiple system indices', () => {
"action_task_params",
"alert",
"api_key_pending_invalidation",
"apm-custom-dashboards",
"apm-indices",
"apm-server-schema",
"apm-service-group",
Expand Down
3 changes: 2 additions & 1 deletion test/api_integration/apis/ui_counters/ui_counters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default function ({ getService }: FtrProviderContext) {
return savedObject;
};

describe('UI Counters API', () => {
// FLAKY: https://github.com/elastic/kibana/issues/98240
describe.skip('UI Counters API', () => {
const dayDate = moment().format('DDMMYYYY');
before(async () => await esArchiver.emptyKibanaIndex());

Expand Down
1 change: 1 addition & 0 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ export class VisualBuilderPageObject extends FtrService {
* @memberof VisualBuilderPage
*/
public async setFieldForAggregation(field: string, aggNth: number = 0): Promise<void> {
await this.visChart.waitForVisualizationRenderingStabilized();
const fieldEl = await this.getFieldForAggregation(aggNth);

await this.comboBox.setElement(fieldEl, field);
Expand Down
5 changes: 5 additions & 0 deletions x-pack/packages/ml/trained_models_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ export {
type ModelDefinitionResponse,
type ElserVersion,
type GetElserOptions,
ELSER_ID_V1,
ELASTIC_MODEL_TAG,
ELASTIC_MODEL_TYPE,
MODEL_STATE,
type ModelState,
} from './src/constants/trained_models';
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ export const BUILT_IN_MODEL_TAG = 'prepackaged';

export const ELASTIC_MODEL_TAG = 'elastic';

export const ELSER_ID_V1 = '.elser_model_1' as const;

export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object.freeze({
'.elser_model_1': {
modelName: 'elser',
hidden: true,
version: 1,
config: {
input: {
Expand All @@ -59,6 +63,7 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object
}),
},
'.elser_model_2_SNAPSHOT': {
modelName: 'elser',
version: 2,
default: true,
config: {
Expand All @@ -71,6 +76,7 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object
}),
},
'.elser_model_2_linux-x86_64_SNAPSHOT': {
modelName: 'elser',
version: 2,
os: 'Linux',
arch: 'amd64',
Expand All @@ -87,16 +93,18 @@ export const ELASTIC_MODEL_DEFINITIONS: Record<string, ModelDefinition> = Object
} as const);

export interface ModelDefinition {
modelName: string;
version: number;
config: object;
description: string;
os?: string;
arch?: string;
default?: boolean;
recommended?: boolean;
hidden?: boolean;
}

export type ModelDefinitionResponse = ModelDefinition & {
export type ModelDefinitionResponse = Omit<ModelDefinition, 'modelName'> & {
name: string;
};

Expand All @@ -106,6 +114,7 @@ export const MODEL_STATE = {
...DEPLOYMENT_STATE,
DOWNLOADING: 'downloading',
DOWNLOADED: 'downloaded',
NOT_DOWNLOADED: 'notDownloaded',
} as const;

export type ModelState = typeof MODEL_STATE[keyof typeof MODEL_STATE] | null;
Expand Down
4 changes: 3 additions & 1 deletion x-pack/performance/journeys/many_fields_lens_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const journey = new Journey({
})
.step('Open existing Lens visualization', async ({ page, kibanaPage }) => {
await page.click(subj('visListingTitleLink-Lens-Stress-Test'));

await page.waitForSelector(subj('lnsChartSwitchPopover'));
await kibanaPage.waitForCharts({ count: 6, timeout: 60000 });
await kibanaPage.waitForCharts({ count: 1, timeout: 60000 });
await kibanaPage.waitForChartsSuggestions(6);
});
13 changes: 5 additions & 8 deletions x-pack/plugins/aiops/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { Subscription } from 'rxjs';
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from '@kbn/core/server';
import type { DataRequestHandlerContext } from '@kbn/data-plugin/server';
import type { UsageCounter } from '@kbn/usage-collection-plugin/server';

import { CASES_ATTACHMENT_CHANGE_POINT_CHART } from '../common/constants';
import { PLUGIN_ID } from '../common';
import { isActiveLicense } from './lib/license';
import {
Expand All @@ -24,6 +22,7 @@ import {

import { defineLogRateAnalysisRoute } from './routes';
import { defineLogCategorizationRoutes } from './routes/log_categorization';
import { registerCasesPersistableState } from './register_cases';

export class AiopsPlugin
implements Plugin<AiopsPluginSetup, AiopsPluginStart, AiopsPluginSetupDeps, AiopsPluginStartDeps>
Expand All @@ -49,6 +48,10 @@ export class AiopsPlugin
const aiopsLicense: AiopsLicense = { isActivePlatinumLicense: false };
this.licenseSubscription = plugins.licensing.license$.subscribe(async (license) => {
aiopsLicense.isActivePlatinumLicense = isActiveLicense('platinum', license);

if (aiopsLicense.isActivePlatinumLicense) {
registerCasesPersistableState(plugins.cases, this.logger);
}
});

const router = core.http.createRouter<DataRequestHandlerContext>();
Expand All @@ -59,12 +62,6 @@ export class AiopsPlugin
defineLogCategorizationRoutes(router, aiopsLicense, this.usageCounter);
});

if (plugins.cases) {
plugins.cases.attachmentFramework.registerPersistableState({
id: CASES_ATTACHMENT_CHANGE_POINT_CHART,
});
}

return {};
}

Expand Down
24 changes: 24 additions & 0 deletions x-pack/plugins/aiops/server/register_cases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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 type { Logger } from '@kbn/core/server';
import type { CasesSetup } from '@kbn/cases-plugin/server';
import { CASES_ATTACHMENT_CHANGE_POINT_CHART } from '../common/constants';

export function registerCasesPersistableState(cases: CasesSetup | undefined, logger: Logger) {
if (cases) {
try {
cases.attachmentFramework.registerPersistableState({
id: CASES_ATTACHMENT_CHANGE_POINT_CHART,
});
} catch (error) {
logger.warn(
`AIOPs failed to register cases persistable state for ${CASES_ATTACHMENT_CHANGE_POINT_CHART}`
);
}
}
}
4 changes: 2 additions & 2 deletions x-pack/plugins/aiops/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/

import type { PluginSetup, PluginStart } from '@kbn/data-plugin/server';
import type { LicensingPluginStart } from '@kbn/licensing-plugin/server';
import type { LicensingPluginSetup } from '@kbn/licensing-plugin/server';
import type { CasesSetup } from '@kbn/cases-plugin/server';
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';

export interface AiopsPluginSetupDeps {
data: PluginSetup;
licensing: LicensingPluginStart;
licensing: LicensingPluginSetup;
cases?: CasesSetup;
usageCollection?: UsageCollectionSetup;
}
Expand Down
20 changes: 20 additions & 0 deletions x-pack/plugins/apm/common/custom_dashboards.ts
Original file line number Diff line number Diff line change
@@ -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.
*/

export const APM_CUSTOM_DASHBOARDS_SAVED_OBJECT_TYPE = 'apm-custom-dashboards';

export interface ApmCustomDashboard {
dashboardSavedObjectId: string;
serviceNameFilterEnabled: boolean;
serviceEnvironmentFilterEnabled: boolean;
kuery?: string;
}

export interface SavedApmCustomDashboard extends ApmCustomDashboard {
id: string;
updatedAt: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async function getCreationOptions(
}
}

function getFilters(
export function getFilters(
serviceName: string,
environment: string,
dataView: DataView
Expand Down Expand Up @@ -139,7 +139,7 @@ function getFilters(
} else {
const environmentFilter = buildPhraseFilter(
environmentField,
serviceName,
environment,
dataView
);
filters.push(environmentFilter);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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 { EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useState } from 'react';
import { SaveDashboardModal } from './save_dashboard_modal';
import { MergedServiceDashboard } from '..';

export function EditDashboard({
onRefresh,
currentDashboard,
}: {
onRefresh: () => void;
currentDashboard: MergedServiceDashboard;
}) {
const [isModalVisible, setIsModalVisible] = useState(false);
return (
<>
<EuiButtonEmpty
color="text"
size="s"
iconType={'pencil'}
data-test-subj="apmEditServiceDashboardMenu"
onClick={() => setIsModalVisible(!isModalVisible)}
>
{i18n.translate('xpack.apm.serviceDashboards.editEmptyButtonLabel', {
defaultMessage: 'Edit dashboard link',
})}
</EuiButtonEmpty>

{isModalVisible && (
<SaveDashboardModal
onClose={() => setIsModalVisible(!isModalVisible)}
onRefresh={onRefresh}
currentDashboard={currentDashboard}
/>
)}
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 { EuiButtonEmpty } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { ApmPluginStartDeps } from '../../../../plugin';
import { SavedApmCustomDashboard } from '../../../../../common/custom_dashboards';

export function GotoDashboard({
currentDashboard,
}: {
currentDashboard: SavedApmCustomDashboard;
}) {
const {
services: {
dashboard: { locator: dashboardLocator },
},
} = useKibana<ApmPluginStartDeps>();

const url = dashboardLocator?.getRedirectUrl({
dashboardId: currentDashboard?.dashboardSavedObjectId,
});
return (
<EuiButtonEmpty
data-test-subj="apmGotoDashboardGoToDashboardButton"
color="text"
size="s"
iconType={'visGauge'}
href={url}
>
{i18n.translate('xpack.apm.serviceDashboards.contextMenu.goToDashboard', {
defaultMessage: 'Go to dashboard',
})}
</EuiButtonEmpty>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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 { LinkDashboard } from './link_dashboard';
import { GotoDashboard } from './goto_dashboard';
import { EditDashboard } from './edit_dashboard';

export { LinkDashboard, GotoDashboard, EditDashboard };
Loading

0 comments on commit 80464d0

Please sign in to comment.