-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* table js -> ts * remove any's * fix CI Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
e9c7a72
commit 77ac5df
Showing
66 changed files
with
1,187 additions
and
985 deletions.
There are no files selected for viewing
File renamed without changes.
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
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
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
47 changes: 0 additions & 47 deletions
47
src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.js
This file was deleted.
Oops, something went wrong.
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
53 changes: 53 additions & 0 deletions
53
src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_buckets_path.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,53 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { startsWith } from 'lodash'; | ||
import { toPercentileNumber } from '../../../../common/to_percentile_number'; | ||
import { METRIC_TYPES } from '../../../../common/enums'; | ||
import type { Metric } from '../../../../common/types'; | ||
|
||
const percentileTest = /\[[0-9\.]+\]$/; | ||
|
||
export const getBucketsPath = (id: string, metrics: Metric[]) => { | ||
const metric = metrics.find((m) => startsWith(id, m.id)); | ||
let bucketsPath = String(id); | ||
|
||
if (metric) { | ||
switch (metric.type) { | ||
case METRIC_TYPES.DERIVATIVE: | ||
bucketsPath += '[normalized_value]'; | ||
break; | ||
// For percentiles we need to breakout the percentile key that the user | ||
// specified. This information is stored in the key using the following pattern | ||
// {metric.id}[{percentile}] | ||
case METRIC_TYPES.PERCENTILE: | ||
if (percentileTest.test(bucketsPath)) break; | ||
if (metric.percentiles?.length) { | ||
const percent = metric.percentiles[0]; | ||
|
||
bucketsPath += `[${toPercentileNumber(percent.value!)}]`; | ||
} | ||
break; | ||
case METRIC_TYPES.PERCENTILE_RANK: | ||
if (percentileTest.test(bucketsPath)) break; | ||
bucketsPath += `[${toPercentileNumber(metric.value!)}]`; | ||
break; | ||
case METRIC_TYPES.STD_DEVIATION: | ||
case METRIC_TYPES.VARIANCE: | ||
case METRIC_TYPES.SUM_OF_SQUARES: | ||
if (/^std_deviation/.test(metric.type) && ['upper', 'lower'].includes(metric.mode!)) { | ||
bucketsPath += `[std_${metric.mode}]`; | ||
} else { | ||
bucketsPath += `[${metric.type}]`; | ||
} | ||
break; | ||
} | ||
} | ||
|
||
return bucketsPath; | ||
}; |
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
Oops, something went wrong.