-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] fixes linking errors to ML and Discover (#73758)
* Closes #73755 by removing the extra uri encoding from time ranges and using correct refreshValue rison types rather than just strings * removes commented out test assertion
- Loading branch information
Showing
8 changed files
with
85 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...apm/public/components/shared/Links/MachineLearningLinks/useTimeSeriesExplorerHref.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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 { useTimeSeriesExplorerHref } from './useTimeSeriesExplorerHref'; | ||
|
||
jest.mock('../../../../hooks/useApmPluginContext', () => ({ | ||
useApmPluginContext: () => ({ | ||
core: { http: { basePath: { prepend: (url: string) => url } } }, | ||
}), | ||
})); | ||
|
||
jest.mock('../../../../hooks/useLocation', () => ({ | ||
useLocation: () => ({ | ||
search: | ||
'?rangeFrom=2020-07-29T17:27:29.000Z&rangeTo=2020-07-29T18:45:00.000Z&refreshInterval=10000&refreshPaused=true', | ||
}), | ||
})); | ||
|
||
describe('useTimeSeriesExplorerHref', () => { | ||
it('correctly encodes time range values', async () => { | ||
const href = useTimeSeriesExplorerHref({ | ||
jobId: 'apm-production-485b-high_mean_transaction_duration', | ||
serviceName: 'opbeans-java', | ||
transactionType: 'request', | ||
}); | ||
|
||
expect(href).toMatchInlineSnapshot( | ||
`"/app/ml#/timeseriesexplorer?_g=(ml:(jobIds:!(apm-production-485b-high_mean_transaction_duration)),refreshInterval:(pause:!t,value:10000),time:(from:'2020-07-29T17:27:29.000Z',to:'2020-07-29T18:45:00.000Z'))&_a=(mlTimeSeriesExplorer:(entities:(service.name:opbeans-java,transaction.type:request),zoom:(from:'2020-07-29T17:27:29.000Z',to:'2020-07-29T18:45:00.000Z')))"` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
x-pack/plugins/apm/public/components/shared/Links/rison_helpers.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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 { getTimepickerRisonData } from './rison_helpers'; | ||
|
||
describe('getTimepickerRisonData', () => { | ||
it('returns object of timepicker range and refresh interval values', async () => { | ||
const locationSearch = `?rangeFrom=2020-07-29T17:27:29.000Z&rangeTo=2020-07-29T18:45:00.000Z&refreshInterval=10000&refreshPaused=true`; | ||
const timepickerValues = getTimepickerRisonData(locationSearch); | ||
|
||
expect(timepickerValues).toMatchInlineSnapshot(` | ||
Object { | ||
"refreshInterval": Object { | ||
"pause": true, | ||
"value": 10000, | ||
}, | ||
"time": Object { | ||
"from": "2020-07-29T17:27:29.000Z", | ||
"to": "2020-07-29T18:45:00.000Z", | ||
}, | ||
} | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters