mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 02:29:33 +08:00
Elasticsearch: Removed reference to obsolete esVersion value (#65415)
* elastic: removed reference to obsolete esVersion value * removed unused code * cleaned up tests
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { valid, gte, SemVer } from 'semver';
|
||||
import { gte, SemVer } from 'semver';
|
||||
|
||||
import { isMetricAggregationWithField } from './components/QueryEditor/MetricAggregationsEditor/aggregations';
|
||||
import { metricAggregationConfig } from './components/QueryEditor/MetricAggregationsEditor/utils';
|
||||
@ -91,32 +91,6 @@ export const convertOrderByToMetricId = (orderBy: string): string | undefined =>
|
||||
export const getScriptValue = (metric: MetricAggregationWithInlineScript) =>
|
||||
(typeof metric.settings?.script === 'object' ? metric.settings?.script?.inline : metric.settings?.script) || '';
|
||||
|
||||
/**
|
||||
* Coerces the version to a valid semver string.
|
||||
* It takes care of also converting from the legacy format (numeric) to the new one.
|
||||
* @param version
|
||||
*/
|
||||
export const coerceESVersion = (version: string | number | undefined): string => {
|
||||
if (typeof version === 'string') {
|
||||
return valid(version) || '8.0.0';
|
||||
}
|
||||
|
||||
switch (version) {
|
||||
case 2:
|
||||
return '2.0.0';
|
||||
case 5:
|
||||
return '5.0.0';
|
||||
case 56:
|
||||
return '5.6.0';
|
||||
case 60:
|
||||
return '6.0.0';
|
||||
case 70:
|
||||
return '7.0.0';
|
||||
default:
|
||||
return '8.0.0';
|
||||
}
|
||||
};
|
||||
|
||||
export const isSupportedVersion = (version: SemVer): boolean => {
|
||||
if (gte(version, '7.10.0')) {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user