Skip to content

Commit 4e06e48

Browse files
Merge branch '7.5' into backport/7.5/pr-49965
2 parents 5a68da3 + ddeee7e commit 4e06e48

10 files changed

Lines changed: 117 additions & 80 deletions

File tree

src/legacy/core_plugins/kibana/server/lib/__tests__/manage_uuid.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import { createTestServers } from '../../../../../../test_utils/kbn_server';
2323
import manageUuid from '../manage_uuid';
2424

2525
describe('legacy/core_plugins/kibana/server/lib', function () {
26-
describe('manage_uuid', function () {
26+
// failing test, see #48426 and #48427
27+
describe.skip('manage_uuid', function () {
2728
const testUuid = 'c4add484-0cba-4e05-86fe-4baa112d9e53';
2829
let kbn;
2930
let kbnServer;

x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/node_available_warning/index.js renamed to x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/node_available_warning/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
87
export { NodeAvailableWarning } from './node_available_warning';

x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/node_available_warning/node_available_warning.js

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import React, { Fragment, FC } from 'react';
8+
9+
import { EuiCallOut, EuiLink, EuiSpacer } from '@elastic/eui';
10+
import { FormattedMessage } from '@kbn/i18n/react';
11+
import { mlNodesAvailable, permissionToViewMlNodeCount } from '../../../../ml_nodes_check';
12+
import { cloudDeploymentId, isCloud } from '../../../../jobs/new_job_new/utils/new_job_defaults';
13+
14+
export const NodeAvailableWarning: FC = () => {
15+
if (mlNodesAvailable() === true || permissionToViewMlNodeCount() === false) {
16+
return null;
17+
} else {
18+
const id = cloudDeploymentId();
19+
return (
20+
<Fragment>
21+
<EuiCallOut
22+
title={
23+
<FormattedMessage
24+
id="xpack.ml.jobsList.nodeAvailableWarning.noMLNodesAvailableTitle"
25+
defaultMessage="No ML nodes available"
26+
/>
27+
}
28+
color="warning"
29+
iconType="alert"
30+
>
31+
<p>
32+
<FormattedMessage
33+
id="xpack.ml.jobsList.nodeAvailableWarning.noMLNodesAvailableDescription"
34+
defaultMessage="There are no ML nodes available."
35+
/>
36+
<br />
37+
<FormattedMessage
38+
id="xpack.ml.jobsList.nodeAvailableWarning.unavailableCreateOrRunJobsDescription"
39+
defaultMessage="You will not be able to create or run jobs."
40+
/>
41+
{isCloud && id !== null && (
42+
<Fragment>
43+
<br />
44+
<FormattedMessage
45+
id="xpack.ml.jobsList.nodeAvailableWarning.linkToCloudDescription"
46+
defaultMessage="Please edit your {link}. You may enable a free 1GB machine learning node or expand your existing ML configuration."
47+
values={{
48+
link: (
49+
<EuiLink href={`https://cloud.elastic.co/deployments?q=${id}`}>
50+
<FormattedMessage
51+
id="xpack.ml.jobsList.nodeAvailableWarning.linkToCloud.hereLinkText"
52+
defaultMessage="Elastic Cloud deployment"
53+
/>
54+
</EuiLink>
55+
),
56+
}}
57+
/>
58+
</Fragment>
59+
)}
60+
</p>
61+
</EuiCallOut>
62+
<EuiSpacer size="m" />
63+
</Fragment>
64+
);
65+
}
66+
};

x-pack/legacy/plugins/ml/public/jobs/new_job_new/utils/new_job_defaults.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,32 @@ export interface MlServerLimits {
1919
max_model_memory_limit?: string;
2020
}
2121

22+
export interface CloudInfo {
23+
cloudId: string | null;
24+
isCloud: boolean;
25+
}
26+
2227
let defaults: MlServerDefaults = {
2328
anomaly_detectors: {},
2429
datafeeds: {},
2530
};
2631
let limits: MlServerLimits = {};
2732

33+
const cloudInfo: CloudInfo = {
34+
cloudId: null,
35+
isCloud: false,
36+
};
37+
2838
export async function loadNewJobDefaults() {
2939
try {
3040
const resp = await ml.mlInfo();
3141
defaults = resp.defaults;
3242
limits = resp.limits;
33-
return { defaults, limits };
43+
cloudInfo.cloudId = resp.cloudId || null;
44+
cloudInfo.isCloud = resp.cloudId !== undefined;
45+
return { defaults, limits, cloudId: cloudInfo };
3446
} catch (error) {
35-
return { defaults, limits };
47+
return { defaults, limits, cloudId: cloudInfo };
3648
}
3749
}
3850

@@ -43,3 +55,24 @@ export function newJobDefaults(): MlServerDefaults {
4355
export function newJobLimits(): MlServerLimits {
4456
return limits;
4557
}
58+
59+
export function cloudId(): string | null {
60+
return cloudInfo.cloudId;
61+
}
62+
63+
export function isCloud(): boolean {
64+
return cloudInfo.isCloud;
65+
}
66+
67+
export function cloudDeploymentId(): string | null {
68+
if (cloudInfo.cloudId === null) {
69+
return null;
70+
}
71+
const tempCloudId = cloudInfo.cloudId.replace(/^.+:/, '');
72+
try {
73+
const matches = atob(tempCloudId).match(/^.+\$(.+)(?=\$)/);
74+
return matches !== null && matches.length === 2 ? matches[1] : null;
75+
} catch (error) {
76+
return null;
77+
}
78+
}

x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export interface MlInfoResponse {
5454
version: string;
5555
};
5656
upgrade_mode: boolean;
57+
cloudId?: string;
5758
}
5859

5960
declare interface Ml {

x-pack/legacy/plugins/ml/server/routes/system.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { isSecurityDisabled } from '../lib/security_utils';
2121
export function systemRoutes({
2222
commonRouteConfig,
2323
elasticsearchPlugin,
24+
config,
2425
route,
2526
xpackMainPlugin,
2627
spacesPlugin
@@ -168,10 +169,17 @@ export function systemRoutes({
168169
route({
169170
method: 'GET',
170171
path: '/api/ml/info',
171-
handler(request) {
172+
async handler(request) {
172173
const callWithRequest = callWithRequestFactory(elasticsearchPlugin, request);
173-
return callWithRequest('ml.info')
174-
.catch(resp => wrapError(resp));
174+
175+
try {
176+
const info = await callWithRequest('ml.info');
177+
const cloudIdKey = 'xpack.cloud.id';
178+
const cloudId = config.has(cloudIdKey) && config.get(cloudIdKey);
179+
return { ...info, cloudId };
180+
} catch (error) {
181+
return wrapError(error);
182+
}
175183
},
176184
config: {
177185
...commonRouteConfig

x-pack/legacy/plugins/uptime/common/constants/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
export const PLUGIN = {
88
APP_ROOT_ID: 'react-uptime-root',
99
ID: 'uptime',
10-
ROUTER_BASE_NAME: '/app/uptime',
10+
ROUTER_BASE_NAME: '/app/uptime#',
1111
LOCAL_STORAGE_KEY: 'xpack.uptime',
1212
};

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7438,10 +7438,8 @@
74387438
"xpack.ml.jobsList.multiJobsActions.startDatafeedsLabel": "{jobsCount, plural, one {データフィード} other {データフィード}}を開始",
74397439
"xpack.ml.jobsList.multiJobsActions.stopDatafeedsLabel": "{jobsCount, plural, one {データフィード} other {データフィード}}を停止",
74407440
"xpack.ml.jobsList.nodeAvailableWarning.linkToCloud.hereLinkText": "こちら",
7441-
"xpack.ml.jobsList.nodeAvailableWarning.linkToCloudDescription": "これはクラウド {hereCloudLink} で構成できます。",
74427441
"xpack.ml.jobsList.nodeAvailableWarning.noMLNodesAvailableDescription": "利用可能な ML ノードがありません。",
74437442
"xpack.ml.jobsList.nodeAvailableWarning.noMLNodesAvailableTitle": "利用可能な ML ノードがありません",
7444-
"xpack.ml.jobsList.nodeAvailableWarning.unavailableCreateOrRunJobsDescription": "ジョブの作成または実行はできません. {cloudConfigLink}",
74457443
"xpack.ml.jobsList.noJobsFoundLabel": "ジョブが見つかりません",
74467444
"xpack.ml.jobsList.processedRecordsLabel": "処理済みレコード",
74477445
"xpack.ml.jobsList.refreshButtonLabel": "更新",

x-pack/plugins/translations/translations/zh-CN.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7440,10 +7440,8 @@
74407440
"xpack.ml.jobsList.multiJobsActions.startDatafeedsLabel": "开始 {jobsCount, plural, one { 个数据馈送} other { 个数据馈送}}",
74417441
"xpack.ml.jobsList.multiJobsActions.stopDatafeedsLabel": "停止 {jobsCount, plural, one { 个数据馈送} other { 个数据馈送}}",
74427442
"xpack.ml.jobsList.nodeAvailableWarning.linkToCloud.hereLinkText": "此处",
7443-
"xpack.ml.jobsList.nodeAvailableWarning.linkToCloudDescription": "这可以在云 {hereCloudLink} 中进行配置。",
74447443
"xpack.ml.jobsList.nodeAvailableWarning.noMLNodesAvailableDescription": "没有可用的 ML 节点。",
74457444
"xpack.ml.jobsList.nodeAvailableWarning.noMLNodesAvailableTitle": "没有可用的 ML 节点",
7446-
"xpack.ml.jobsList.nodeAvailableWarning.unavailableCreateOrRunJobsDescription": "您将无法创建或运行作业。{cloudConfigLink}",
74477445
"xpack.ml.jobsList.noJobsFoundLabel": "找不到作业",
74487446
"xpack.ml.jobsList.processedRecordsLabel": "已处理记录",
74497447
"xpack.ml.jobsList.refreshButtonLabel": "刷新",
@@ -13008,4 +13006,4 @@
1300813006
"xpack.lens.xyVisualization.stackedBarLabel": "堆叠条形图",
1300913007
"xpack.lens.xyVisualization.xyLabel": "XY"
1301013008
}
13011-
}
13009+
}

0 commit comments

Comments
 (0)