diff --git a/x-pack/plugins/monitoring/common/types/es.ts b/x-pack/plugins/monitoring/common/types/es.ts index a9d020813ce84..a01e1c383a8e6 100644 --- a/x-pack/plugins/monitoring/common/types/es.ts +++ b/x-pack/plugins/monitoring/common/types/es.ts @@ -156,7 +156,7 @@ export interface ElasticsearchLegacySource { heap_max_in_bytes?: number; }; }; - fs: { + fs?: { available_in_bytes?: number; total_in_bytes?: number; }; @@ -497,7 +497,7 @@ export interface ElasticsearchMetricbeatSource { }; nodes?: { versions?: string[]; - count?: number; + count?: number | {}; jvm?: { max_uptime?: { ms?: number; diff --git a/x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.js b/x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.ts similarity index 84% rename from x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.js rename to x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.ts index ccbc6ccaa78aa..7529b5020d1ff 100644 --- a/x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.js +++ b/x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.ts @@ -6,8 +6,9 @@ */ import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../../common/constants'; +import { Cluster } from '../../types'; -export const getStandaloneClusterDefinition = () => { +export const getStandaloneClusterDefinition: () => Cluster = () => { return { cluster_uuid: STANDALONE_CLUSTER_CLUSTER_UUID, license: {}, @@ -28,5 +29,5 @@ export const getStandaloneClusterDefinition = () => { }, }, }, - }; + } as Cluster; }; diff --git a/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.js b/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.ts similarity index 87% rename from x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.js rename to x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.ts index 938610e51693e..42ac8b89eaf37 100644 --- a/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.js +++ b/x-pack/plugins/monitoring/server/lib/standalone_clusters/has_standalone_clusters.ts @@ -7,15 +7,16 @@ import moment from 'moment'; import { get } from 'lodash'; +import { LegacyRequest } from '../../types'; import { standaloneClusterFilter } from './'; -export async function hasStandaloneClusters(req, indexPatterns) { +export async function hasStandaloneClusters(req: LegacyRequest, indexPatterns: string[]) { const indexPatternList = indexPatterns.reduce((list, patterns) => { list.push(...patterns.split(',')); return list; - }, []); + }, [] as string[]); - const filters = [ + const filters: any[] = [ standaloneClusterFilter, { bool: { @@ -39,7 +40,7 @@ export async function hasStandaloneClusters(req, indexPatterns) { const start = req.payload.timeRange.min; const end = req.payload.timeRange.max; - const timeRangeFilter = { + const timeRangeFilter: { range: { timestamp: Record } } = { range: { timestamp: { format: 'epoch_millis',