-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Migrate internal urls to non-hash paths #76735
Changes from 64 commits
5ff3100
df33079
8c3adc1
0333310
65de961
4ec96fd
49d0e7d
6827517
6f86f70
7f8decf
ce2f3ec
6fbb599
195929f
f175d27
8ffd123
a30ec90
0e9915b
5b8c82e
7742303
f56525c
25272ca
adc1047
5d0c800
c62a924
ac70ed2
ad88c4e
fb40acb
738f0b7
2d317c1
df40e5f
a10374a
4ee28a9
0e2ed56
bb8230c
7176749
f561cf4
ffa623a
9272d37
dd3517b
4a50f1f
5eda3bf
fe633ae
6461407
cf3edb7
787bade
de7c268
d0e20a4
853d5a3
662c756
b530216
a58a477
b76adb0
13abdba
dc3ba76
40f8845
733e9fa
1fa7026
68e7519
3439383
cea397e
0c29605
e224267
f85413f
1efaed2
29d8674
d3edff7
42313ae
f762277
ba56a81
0d83eac
cc8f5dd
92dad64
0a4a559
efe49ea
abe0ce6
b7f9be7
5dd7373
0a0436b
75352f9
ee507b4
a39face
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
import Boom from 'boom'; | ||
import { EsErrorBody } from '../util/errors'; | ||
import { ANALYSIS_CONFIG_TYPE } from '../constants/data_frame_analytics'; | ||
|
||
export interface DeleteDataFrameAnalyticsWithIndexStatus { | ||
success: boolean; | ||
|
@@ -81,8 +82,4 @@ export interface DataFrameAnalyticsConfig { | |
allow_lazy_start?: boolean; | ||
} | ||
|
||
export enum ANALYSIS_CONFIG_TYPE { | ||
OUTLIER_DETECTION = 'outlier_detection', | ||
REGRESSION = 'regression', | ||
CLASSIFICATION = 'classification', | ||
} | ||
export type DataFrameAnalyticsType = typeof ANALYSIS_CONFIG_TYPE[keyof typeof ANALYSIS_CONFIG_TYPE]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed here d3edff7 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,10 +33,12 @@ export function checkGetManagementMlJobsResolver() { | |
}); | ||
} | ||
|
||
export function checkGetJobsCapabilitiesResolver(): Promise<MlCapabilities> { | ||
export function checkGetJobsCapabilitiesResolver( | ||
redirectToMlAccessDeniedPage: () => Promise<void> | ||
): Promise<MlCapabilities> { | ||
return new Promise((resolve, reject) => { | ||
getCapabilities() | ||
.then(({ capabilities, isPlatinumOrTrialLicense }) => { | ||
.then(async ({ capabilities, isPlatinumOrTrialLicense }) => { | ||
Comment on lines
+38
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to wrap in Promise, just an async function with |
||
_capabilities = capabilities; | ||
// the minimum privilege for using ML with a platinum or trial license is being able to get the transforms list. | ||
// all other functionality is controlled by the return capabilities object. | ||
|
@@ -46,21 +48,23 @@ export function checkGetJobsCapabilitiesResolver(): Promise<MlCapabilities> { | |
if (_capabilities.canGetJobs || isPlatinumOrTrialLicense === false) { | ||
return resolve(_capabilities); | ||
} else { | ||
window.location.href = '#/access-denied'; | ||
await redirectToMlAccessDeniedPage(); | ||
return reject(); | ||
} | ||
}) | ||
.catch((e) => { | ||
window.location.href = '#/access-denied'; | ||
.catch(async (e) => { | ||
await redirectToMlAccessDeniedPage(); | ||
return reject(); | ||
}); | ||
}); | ||
} | ||
|
||
export function checkCreateJobsCapabilitiesResolver(): Promise<MlCapabilities> { | ||
export function checkCreateJobsCapabilitiesResolver( | ||
redirectToJobsManagementPage: () => Promise<void> | ||
): Promise<MlCapabilities> { | ||
return new Promise((resolve, reject) => { | ||
getCapabilities() | ||
.then(({ capabilities, isPlatinumOrTrialLicense }) => { | ||
.then(async ({ capabilities, isPlatinumOrTrialLicense }) => { | ||
_capabilities = capabilities; | ||
// if the license is basic (isPlatinumOrTrialLicense === false) then do not redirect, | ||
// allow the promise to resolve as the separate license check will redirect then user to | ||
|
@@ -69,34 +73,36 @@ export function checkCreateJobsCapabilitiesResolver(): Promise<MlCapabilities> { | |
return resolve(_capabilities); | ||
} else { | ||
// if the user has no permission to create a job, | ||
// redirect them back to the Transforms Management page | ||
window.location.href = '#/jobs'; | ||
// redirect them back to the Anomaly Detection Management page | ||
await redirectToJobsManagementPage(); | ||
return reject(); | ||
} | ||
}) | ||
.catch((e) => { | ||
window.location.href = '#/jobs'; | ||
.catch(async (e) => { | ||
await redirectToJobsManagementPage(); | ||
return reject(); | ||
}); | ||
}); | ||
} | ||
|
||
export function checkFindFileStructurePrivilegeResolver(): Promise<MlCapabilities> { | ||
export function checkFindFileStructurePrivilegeResolver( | ||
redirectToMlAccessDeniedPage: () => Promise<void> | ||
): Promise<MlCapabilities> { | ||
return new Promise((resolve, reject) => { | ||
getCapabilities() | ||
.then(({ capabilities }) => { | ||
.then(async ({ capabilities }) => { | ||
_capabilities = capabilities; | ||
// the minimum privilege for using ML with a basic license is being able to use the datavisualizer. | ||
// all other functionality is controlled by the return _capabilities object | ||
if (_capabilities.canFindFileStructure) { | ||
return resolve(_capabilities); | ||
} else { | ||
window.location.href = '#/access-denied'; | ||
await redirectToMlAccessDeniedPage(); | ||
return reject(); | ||
} | ||
}) | ||
.catch((e) => { | ||
window.location.href = '#/access-denied'; | ||
.catch(async (e) => { | ||
await redirectToMlAccessDeniedPage(); | ||
return reject(); | ||
}); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,16 @@ import PropTypes from 'prop-types'; | |
|
||
import { EuiIcon, EuiFlexItem } from '@elastic/eui'; | ||
import { CreateJobLinkCard } from '../create_job_link_card'; | ||
import { useMlKibana } from '../../contexts/kibana'; | ||
|
||
export const RecognizedResult = ({ config, indexPattern, savedSearch }) => { | ||
const { | ||
services: { | ||
http: { basePath }, | ||
}, | ||
} = useMlKibana(); | ||
const id = savedSearch === null ? `index=${indexPattern.id}` : `savedSearchId=${savedSearch.id}`; | ||
|
||
const href = `#/jobs/new_job/recognize?id=${config.id}&${id}`; | ||
const href = `${basePath.get()}/app/ml/jobs/new_job/recognize?id=${config.id}&${id}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this URL should be created by the ML URL generator |
||
|
||
let logo = null; | ||
// if a logo is available, use that, otherwise display the id | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the same as an
enum
already inplugins/ml/public/application/data_frame_analytics/common/analytics.ts
. This one using theconst
approach as well as the location here LGTM so suggest to try to get rid of the on mentioned in this comment.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went through and updated the usage of
enum ANALYSIS_CONFIG_TYPE
toconst ANALYSIS_CONFIG_TYPE
here dd3517b