Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Adding space aware jobs #77916

Merged
merged 104 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
ba7bdae
[ML] Adding space aware jobs
jgowdyelastic Sep 18, 2020
4a8d36a
Merge branch 'master' into adding-space-aware-jobs
elasticmachine Sep 28, 2020
7793ced
Merge branch 'master' into adding-space-aware-jobs
elasticmachine Sep 29, 2020
3397246
adding mlClient
jgowdyelastic Sep 29, 2020
837ad42
switching to type includes
jgowdyelastic Sep 29, 2020
15a04e8
Merge branch 'master' into adding-space-aware-jobs
elasticmachine Sep 30, 2020
f430b02
adding additional job checks
jgowdyelastic Oct 1, 2020
5ba9d98
Merge branch 'master' into adding-space-aware-jobs
jgowdyelastic Oct 1, 2020
f049540
fixing conflict
jgowdyelastic Oct 1, 2020
cd76629
Merge branch 'master' into adding-space-aware-jobs
elasticmachine Oct 1, 2020
815219c
Merge branch 'adding-space-aware-jobs' of github.com:jgowdyelastic/ki…
jgowdyelastic Oct 1, 2020
837fac0
Merge branch 'master' into adding-space-aware-jobs
elasticmachine Oct 1, 2020
6b2ff4c
Merge branch 'adding-space-aware-jobs' of github.com:jgowdyelastic/ki…
jgowdyelastic Oct 1, 2020
2e4674b
adding dfa checks
jgowdyelastic Oct 1, 2020
0490d31
refactoring jobs in spaces checks
jgowdyelastic Oct 2, 2020
a6fcb33
filtering calendars
jgowdyelastic Oct 2, 2020
4a33827
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 5, 2020
b956b83
adding initial job object status and repair endpoints
jgowdyelastic Oct 5, 2020
9881370
enabling repair endpoint
jgowdyelastic Oct 6, 2020
72661e8
fixing listed jobs in status
jgowdyelastic Oct 6, 2020
5495f6b
adding datafeed repair
jgowdyelastic Oct 6, 2020
3970c29
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 6, 2020
4434c33
updating shared services
jgowdyelastic Oct 7, 2020
18927bd
adding results job id check
jgowdyelastic Oct 8, 2020
2c0acc9
fixing conflicts
jgowdyelastic Oct 8, 2020
807768c
Merge branch 'master' into adding-space-aware-jobs
jgowdyelastic Oct 8, 2020
d1fdfe7
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 8, 2020
b37f4e5
don't remove SO on delete
jgowdyelastic Oct 8, 2020
6baa5d3
fixing non-ml plugins
jgowdyelastic Oct 8, 2020
4a1b06e
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 8, 2020
c6a55bc
filtering job audit messages
jgowdyelastic Oct 9, 2020
1f4e891
Merge branch 'adding-space-aware-jobs' of github.com:jgowdyelastic/ki…
jgowdyelastic Oct 9, 2020
d926b32
fixing types
jgowdyelastic Oct 9, 2020
697b923
fixing tests
jgowdyelastic Oct 9, 2020
4324e00
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 12, 2020
c85c71c
adding job ids wildcard support
jgowdyelastic Oct 12, 2020
eca33a4
removing empty migration test
jgowdyelastic Oct 12, 2020
f94b6cb
fixing tests and disabling spaces test user
jgowdyelastic Oct 12, 2020
480bea1
adding saved objects all permission
jgowdyelastic Oct 12, 2020
52c6ec3
fixing calendars
jgowdyelastic Oct 13, 2020
d2b3097
updating job 404
jgowdyelastic Oct 13, 2020
43eac01
updating job wildcard search
jgowdyelastic Oct 13, 2020
de29690
renaming services
jgowdyelastic Oct 13, 2020
1b87324
fixing conflicts
jgowdyelastic Oct 14, 2020
3356cef
Merge branch 'master' into adding-space-aware-jobs
jgowdyelastic Oct 14, 2020
05f894e
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 14, 2020
393a4ee
fixing log tests
jgowdyelastic Oct 14, 2020
cb66804
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 14, 2020
d789ad2
disabling apm test
jgowdyelastic Oct 15, 2020
535f570
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 15, 2020
a3144fb
skipping more apm tests
jgowdyelastic Oct 15, 2020
fda0e72
optimzing repair
jgowdyelastic Oct 15, 2020
435f111
fixing types
jgowdyelastic Oct 16, 2020
51a0d6e
updating apm test archive to include ML saved objects
jgowdyelastic Oct 16, 2020
499fad3
enabling disabled test
jgowdyelastic Oct 16, 2020
14530bc
removing comment
jgowdyelastic Oct 16, 2020
eced3bf
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 16, 2020
6b6dc95
adding space assigning endpoints
jgowdyelastic Oct 16, 2020
348139f
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 19, 2020
5312023
adding saved object default permissions
jgowdyelastic Oct 20, 2020
baa4a7b
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 20, 2020
113e0df
removing commented code
jgowdyelastic Oct 20, 2020
90105ca
loading all jobs for all spaces for status check
jgowdyelastic Oct 20, 2020
6d43384
adding spaces list endpoint
jgowdyelastic Oct 21, 2020
cd9ab5e
adding job spaces to management page
jgowdyelastic Oct 21, 2020
30cac1a
adding trained model fltering
jgowdyelastic Oct 21, 2020
e0069e3
fixing trained model id check and job wildcard check
jgowdyelastic Oct 21, 2020
39999ee
fixing types
jgowdyelastic Oct 21, 2020
0ca4eb7
fixing bug when adding new job to calendar
jgowdyelastic Oct 21, 2020
ee315f1
changes based on review
jgowdyelastic Oct 22, 2020
bd509c2
updating schema
jgowdyelastic Oct 22, 2020
68d10ba
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 26, 2020
2532101
changes based on review
jgowdyelastic Oct 26, 2020
e4e87b2
fixing types
jgowdyelastic Oct 26, 2020
e99cc1f
rolling back http service injection
jgowdyelastic Oct 26, 2020
6b45fff
fixing http service injection
jgowdyelastic Oct 26, 2020
6c5756f
adding errrors to repair endpoint response
jgowdyelastic Oct 27, 2020
43648c8
updating api doc
jgowdyelastic Oct 27, 2020
4a79bb6
improving types
jgowdyelastic Oct 27, 2020
481abc4
disabling id check on ad get endpoints
jgowdyelastic Oct 27, 2020
8eedebb
fixing tests
jgowdyelastic Oct 27, 2020
6d85ab0
fixing group requests
jgowdyelastic Oct 27, 2020
3a9782d
adding comments
jgowdyelastic Oct 27, 2020
4cd0d41
using filter in saved object search
jgowdyelastic Oct 27, 2020
9b7d26c
Merge branch 'master' into adding-space-aware-jobs
jgowdyelastic Oct 28, 2020
7071d62
fixing fake request issue
jgowdyelastic Oct 28, 2020
39651e5
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Oct 28, 2020
2767f7d
removing console log
jgowdyelastic Oct 28, 2020
4cf9649
Merge branch 'master' into adding-space-aware-jobs
jgowdyelastic Oct 29, 2020
8fd05f3
making job saved object hidden
jgowdyelastic Oct 29, 2020
9ed7d48
Merge branch 'master' into adding-space-aware-jobs
jgowdyelastic Oct 29, 2020
38fdb05
removing acccidentally included file
jgowdyelastic Oct 29, 2020
e0d6b38
renaming saved object client
jgowdyelastic Oct 29, 2020
763637d
updating apidoc
jgowdyelastic Oct 29, 2020
807cd28
unhiding ml saved objects
jgowdyelastic Oct 29, 2020
04e120c
moving route guard
jgowdyelastic Oct 29, 2020
481c33d
improving error when SOC is null
jgowdyelastic Oct 29, 2020
cd07a6d
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Nov 2, 2020
3ba5c0e
Merge branch 'master' into adding-space-aware-jobs
jgowdyelastic Nov 2, 2020
9cfafac
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Nov 2, 2020
660af5c
fixing types after merge with master
jgowdyelastic Nov 2, 2020
13ccded
fixing tests
jgowdyelastic Nov 2, 2020
35a981a
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Nov 3, 2020
563526a
Merge branch 'master' into adding-space-aware-jobs
kibanamachine Nov 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ export function registerTransactionDurationAnomalyAlertType({
}
const alertParams = params;
const request = {} as KibanaRequest;
const { mlAnomalySearch } = ml.mlSystemProvider(request);
const anomalyDetectors = ml.anomalyDetectorsProvider(request);
const { mlAnomalySearch } = ml.mlSystemProvider(
request,
services.savedObjectsClient
);
const anomalyDetectors = ml.anomalyDetectorsProvider(
request,
services.savedObjectsClient
);

const mlJobs = await getMLJobs(anomalyDetectors, alertParams.environment);

Expand All @@ -94,6 +100,7 @@ export function registerTransactionDurationAnomalyAlertType({
return {};
}

const jobIds = mlJobs.map((job) => job.job_id);
const anomalySearchParams = {
terminateAfter: 1,
body: {
Expand All @@ -102,7 +109,7 @@ export function registerTransactionDurationAnomalyAlertType({
bool: {
filter: [
{ term: { result_type: 'record' } },
{ terms: { job_id: mlJobs.map((job) => job.job_id) } },
{ terms: { job_id: jobIds } },
{
range: {
timestamp: {
Expand Down Expand Up @@ -163,7 +170,8 @@ export function registerTransactionDurationAnomalyAlertType({
};

const response = ((await mlAnomalySearch(
anomalySearchParams
anomalySearchParams,
jobIds
)) as unknown) as {
hits: { total: { value: number } };
aggregations?: {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/apm/server/lib/helpers/setup_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ function getMlSetup(
request: KibanaRequest
) {
return {
mlSystem: ml.mlSystemProvider(request),
anomalyDetectors: ml.anomalyDetectorsProvider(request),
mlSystem: ml.mlSystemProvider(request, savedObjectsClient),
anomalyDetectors: ml.anomalyDetectorsProvider(request, savedObjectsClient),
modules: ml.modulesProvider(request, savedObjectsClient),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function getServiceAnomalies({
},
};

const response = await ml.mlSystem.mlAnomalySearch(params);
const response = await ml.mlSystem.mlAnomalySearch(params, mlJobIds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that the filter by mlJobIds is now redundant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no this will still be needed in the query.
We need an explicit list of job ids passed to the function so we can check they are available in the current space.
We could attempt to retrieve them from the query, but each query object could be different and the job filtering done in a different way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an important aspect. Can we document that somewhere?


return {
mlJobIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function anomalySeriesFetcher({
const response: ESSearchResponse<
unknown,
typeof params
> = (await ml.mlSystem.mlAnomalySearch(params)) as any;
> = (await ml.mlSystem.mlAnomalySearch(params, [jobId])) as any;

return response;
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function getMlBucketSize({
};

try {
const resp = await ml.mlSystem.mlAnomalySearch<ESResponse>(params);
const resp = await ml.mlSystem.mlAnomalySearch<ESResponse>(params, [jobId]);
return resp.hits.hits[0]?._source.bucket_span;
} catch (err) {
const isHttpError = 'statusCode' in err;
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/infra/server/lib/infra_ml/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export async function getLogEntryDatasets(
endTime,
COMPOSITE_AGGREGATION_BATCH_SIZE,
afterLatestBatchKey
)
),
jobIds
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ async function fetchMetricsHostsAnomalies(

const results = decodeOrThrow(metricsHostsAnomaliesResponseRT)(
await mlSystem.mlAnomalySearch(
createMetricsHostsAnomaliesQuery(jobIds, startTime, endTime, sort, expandedPagination)
createMetricsHostsAnomaliesQuery(jobIds, startTime, endTime, sort, expandedPagination),
jobIds
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ async function fetchMetricK8sAnomalies(

const results = decodeOrThrow(metricsK8sAnomaliesResponseRT)(
await mlSystem.mlAnomalySearch(
createMetricsK8sAnomaliesQuery(jobIds, startTime, endTime, sort, expandedPagination)
createMetricsK8sAnomaliesQuery(jobIds, startTime, endTime, sort, expandedPagination),
jobIds
)
);

Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/infra/server/lib/log_analysis/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export async function getLogEntryDatasets(
endTime,
COMPOSITE_AGGREGATION_BATCH_SIZE,
afterLatestBatchKey
)
),
jobIds
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ async function fetchLogEntryAnomalies(

const results = decodeOrThrow(logEntryAnomaliesResponseRT)(
await mlSystem.mlAnomalySearch(
createLogEntryAnomaliesQuery(jobIds, startTime, endTime, sort, expandedPagination, datasets)
createLogEntryAnomaliesQuery(jobIds, startTime, endTime, sort, expandedPagination, datasets),
jobIds
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ async function fetchTopLogEntryCategories(
endTime,
categoryCount,
datasets
)
),
[logEntryCategoriesCountJobId]
)
);

Expand Down Expand Up @@ -284,7 +285,8 @@ export async function fetchLogEntryCategories(

const logEntryCategoriesResponse = decodeOrThrow(logEntryCategoriesResponseRT)(
await context.infra.mlSystem.mlAnomalySearch(
createLogEntryCategoriesQuery(logEntryCategoriesCountJobId, categoryIds)
createLogEntryCategoriesQuery(logEntryCategoriesCountJobId, categoryIds),
[logEntryCategoriesCountJobId]
)
);

Expand Down Expand Up @@ -333,7 +335,8 @@ async function fetchTopLogEntryCategoryHistograms(
startTime,
endTime,
bucketCount
)
),
[logEntryCategoriesCountJobId]
)
.then(decodeOrThrow(logEntryCategoryHistogramsResponseRT))
.then((response) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export async function getLatestLogEntriesCategoriesDatasetsStats(
endTime,
COMPOSITE_AGGREGATION_BATCH_SIZE,
afterLatestBatchKey
)
),
jobIds
);

const { after_key: afterKey, buckets: latestBatchBuckets = [] } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export async function getLogEntryRateBuckets(
COMPOSITE_AGGREGATION_BATCH_SIZE,
afterLatestBatchKey,
datasets
)
),
[logRateJobId]
);

const { after_key: afterKey, buckets: latestBatchBuckets = [] } =
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/infra/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ export class InfraServerPlugin {
core.http.registerRouteHandlerContext(
'infra',
(context, request): InfraRequestHandlerContext => {
const mlSystem = plugins.ml?.mlSystemProvider(request);
const mlAnomalyDetectors = plugins.ml?.anomalyDetectorsProvider(request);
const mlSystem = plugins.ml?.mlSystemProvider(request, context.core.savedObjects.client);
const mlAnomalyDetectors = plugins.ml?.anomalyDetectorsProvider(
request,
context.core.savedObjects.client
);
const spaceId = plugins.spaces?.spacesService.getSpaceId(request) || 'default';

return {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ml/common/types/calendars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Calendar {
description: string;
events: any[];
job_ids: string[];
total_job_count?: number;
}

export interface UpdateCalendar extends Calendar {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/ml/common/types/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function getPluginPrivileges() {
const adminMlCapabilitiesKeys = Object.keys(adminMlCapabilities);
const allMlCapabilitiesKeys = [...adminMlCapabilitiesKeys, ...userMlCapabilitiesKeys];
// TODO: include ML in base privileges for the `8.0` release: https://github.com/elastic/kibana/issues/71422
const savedObjects = ['index-pattern', 'dashboard', 'search', 'visualization'];
const savedObjects = ['index-pattern', 'dashboard', 'search', 'visualization', 'ml-job'];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legrego should read/all access to ml-job also be given to apmUser?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they'd just need read access to these job definitions, but I haven't taken a deep dive into this PR just yet.

const privilege = {
app: [PLUGIN_ID, 'kibana'],
excludeFromBasePrivileges: true,
Expand Down Expand Up @@ -116,7 +116,7 @@ export function getPluginPrivileges() {
catalogue: [],
savedObject: {
all: [],
read: [],
read: ['ml-job'],
},
api: apmUserMlCapabilitiesKeys.map((k) => `ml:${k}`),
ui: apmUserMlCapabilitiesKeys,
Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/ml/common/types/saved_objects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export type JobType = 'anomaly-detector' | 'data-frame-analytics';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { JobSpacesList } from './job_spaces_list';
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { FC } from 'react';

import { EuiFlexGroup, EuiFlexItem, EuiBadge } from '@elastic/eui';

interface Props {
spaces: string[];
}

export const JobSpacesList: FC<Props> = ({ spaces }) => (
<EuiFlexGroup wrap responsive={false} gutterSize="xs">
{spaces.map((space) => (
<EuiFlexItem grow={false} key={space}>
<EuiBadge color={'hollow'}>{space}</EuiBadge>
</EuiFlexItem>
))}
</EuiFlexGroup>
);
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export const DataFrameAnalyticsList: FC<Props> = ({
setAnalyticsStats,
setErrorMessage,
setIsInitialized,
blockRefresh
blockRefresh,
isManagementTable
);

const updateFilteredItems = (queryClauses: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export interface DataFrameAnalyticsListRow {
mode: string;
state: DataFrameAnalyticsStats['state'];
stats: DataFrameAnalyticsStats;
spaces?: string[];
}

// Used to pass on attribute names to table columns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
import { useActions } from './use_actions';
import { useMlLink } from '../../../../../contexts/kibana';
import { ML_PAGES } from '../../../../../../../common/constants/ml_url_generator';
import { JobSpacesList } from '../../../../../components/job_spaces_list';

enum TASK_STATE_COLOR {
analyzing = 'primary',
Expand Down Expand Up @@ -278,7 +279,8 @@ export const useColumns = (
name: i18n.translate('xpack.ml.jobsList.analyticsSpacesLabel', {
defaultMessage: 'Spaces',
}),
render: () => <EuiBadge color={'hollow'}>{'all'}</EuiBadge>,
render: (item: DataFrameAnalyticsListRow) =>
Array.isArray(item.spaces) ? <JobSpacesList spaces={item.spaces} /> : null,
width: '75px',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export const getAnalyticsFactory = (
React.SetStateAction<GetDataFrameAnalyticsStatsResponseError | undefined>
>,
setIsInitialized: React.Dispatch<React.SetStateAction<boolean>>,
blockRefresh: boolean
blockRefresh: boolean,
isManagementTable: boolean
): GetAnalytics => {
let concurrentLoads = 0;

Expand All @@ -123,6 +124,12 @@ export const getAnalyticsFactory = (
const analyticsConfigs = await ml.dataFrameAnalytics.getDataFrameAnalytics();
const analyticsStats = await ml.dataFrameAnalytics.getDataFrameAnalyticsStats();

let spaces: { [id: string]: string[] } = {};
if (isManagementTable) {
const allSpaces = await ml.savedObjects.jobsSpaces();
spaces = allSpaces['data-frame-analytics'];
}

const analyticsStatsResult = isGetDataFrameAnalyticsStatsResponseOk(analyticsStats)
? getAnalyticsJobsStats(analyticsStats)
: undefined;
Expand All @@ -148,6 +155,7 @@ export const getAnalyticsFactory = (
mode: DATA_FRAME_MODE.BATCH,
state: stats.state,
stats,
spaces: spaces[config.id] ?? [],
});
return reducedtableRows;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ export function getTestUrl(job, customUrl) {

return new Promise((resolve, reject) => {
ml.results
.anomalySearch({
body,
})
.anomalySearch(
{
body,
},
[job.job_id]
)
.then((resp) => {
if (resp.hits.total.value > 0) {
const record = resp.hits.hits[0]._source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import { toLocaleString } from '../../../../util/string_utils';
import { ResultLinks, actionsMenuContent } from '../job_actions';
import { JobDescription } from './job_description';
import { JobIcon } from '../../../../components/job_message_icon';
import { JobSpacesList } from '../../../../components/job_spaces_list';
import { TIME_FORMAT } from '../../../../../../common/constants/time_format';

import { EuiBadge, EuiBasicTable, EuiButtonIcon, EuiScreenReaderOnly } from '@elastic/eui';
import { EuiBasicTable, EuiButtonIcon, EuiScreenReaderOnly } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { AnomalyDetectionJobIdLink } from './job_id_link';
Expand Down Expand Up @@ -251,7 +252,7 @@ export class JobsList extends Component {
name: i18n.translate('xpack.ml.jobsList.spacesLabel', {
defaultMessage: 'Spaces',
}),
render: () => <EuiBadge color={'hollow'}>{'all'}</EuiBadge>,
render: (item) => <JobSpacesList spaces={item.spaces} />,
});
// Remove actions if Ml not enabled in current space
if (this.props.isMlEnabledInSpace === false) {
Expand Down
Loading