[ML] AIOps: Fix relative time bound support in the chart preview (#160121)

## Summary

- Fixes relative time range support in the Change Point Detection UI. 
- Enables functional tests (resolves
https://github.com/elastic/kibana/issues/158851)


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Dima Arnautov 2023-06-22 12:51:20 +02:00 committed by GitHub
parent 924da11c89
commit d7b2a52e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -120,7 +120,7 @@ export const ChangePointDetectionContextProvider: FC = ({ children }) => {
>({});
const [bucketInterval, setBucketInterval] = useState<TimeBucketsInterval>();
const timeRange = useTimeRangeUpdates();
const timeRange = useTimeRangeUpdates(true);
useEffect(function updateIntervalOnTimeBoundsChange() {
const timeUpdateSubscription = timefilter

View file

@ -30,7 +30,7 @@ export const useCommonChartProps = ({
annotation: ChangePointAnnotation;
previewMode?: boolean;
}): Partial<TypedLensByValueInput> => {
const timeRange = useTimeRangeUpdates();
const timeRange = useTimeRangeUpdates(true);
const { dataView } = useDataSource();
const { bucketInterval, resultQuery, resultFilters } = useChangePointDetectionContext();

View file

@ -16,8 +16,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
// aiops lives in the ML UI so we need some related services.
const ml = getService('ml');
// FLAKY: https://github.com/elastic/kibana/issues/158851
describe.skip('change point detection', async function () {
describe('change point detection', async function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce');
await ml.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date');
@ -64,6 +63,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await aiops.changePointDetectionPage.clickUseFullDataButton();
await aiops.changePointDetectionPage.selectMetricField(0, 'products.discount_amount');
await aiops.changePointDetectionPage.selectSplitField(0, 'geoip.city_name');
await aiops.changePointDetectionPage.getTable(0).waitForTableToLoad();
const result = await aiops.changePointDetectionPage.getTable(0).parseTable();
expect(result.length).to.eql(5);
// assert asc sorting by p_value is applied