Skip to content

Commit

Permalink
Merge branch 'main' into fix-node-roles-list
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyghiani committed Oct 3, 2023
2 parents 0099b55 + db009f1 commit 3627fd7
Show file tree
Hide file tree
Showing 128 changed files with 3,786 additions and 348 deletions.
16 changes: 16 additions & 0 deletions packages/kbn-check-mappings-update-cli/current_mappings.json
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
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
4 changes: 3 additions & 1 deletion packages/kbn-shared-svg/index.ts
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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
1 change: 1 addition & 0 deletions test/functional/page_objects/visual_builder_page.ts
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
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';
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
20 changes: 20 additions & 0 deletions x-pack/plugins/apm/common/custom_dashboards.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.
*/

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;
}
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
@@ -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}
/>
)}
</>
);
}
@@ -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>
);
}
@@ -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 };
@@ -0,0 +1,58 @@
/*
* 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 { EuiButton, EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useState } from 'react';
import { MergedServiceDashboard } from '..';
import { SaveDashboardModal } from './save_dashboard_modal';

export function LinkDashboard({
onRefresh,
emptyButton = false,
serviceDashboards,
}: {
onRefresh: () => void;
emptyButton?: boolean;
serviceDashboards?: MergedServiceDashboard[];
}) {
const [isModalVisible, setIsModalVisible] = useState(false);

return (
<>
{emptyButton ? (
<EuiButtonEmpty
color="text"
size="s"
iconType={'plusInCircle'}
data-test-subj="apmLinkServiceDashboardMenu"
onClick={() => setIsModalVisible(true)}
>
{i18n.translate('xpack.apm.serviceDashboards.linkEmptyButtonLabel', {
defaultMessage: 'Link new dashboard',
})}
</EuiButtonEmpty>
) : (
<EuiButton
data-test-subj="apmAddServiceDashboard"
onClick={() => setIsModalVisible(true)}
>
{i18n.translate('xpack.apm.serviceDashboards.linkButtonLabel', {
defaultMessage: 'Link dashboard',
})}
</EuiButton>
)}

{isModalVisible && (
<SaveDashboardModal
onClose={() => setIsModalVisible(false)}
onRefresh={onRefresh}
serviceDashboards={serviceDashboards}
/>
)}
</>
);
}

0 comments on commit 3627fd7

Please sign in to comment.