[Stack Monitoring] Convert standalone_clusters directory to typescript (#112696) (#113150)

* [Stack Monitoring] Convert standalone_clusters directory to typescript

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Zacqary Adam Xeper <Zacqary@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2021-09-27 15:33:02 -04:00 committed by GitHub
parent a4807a125d
commit ede315d503
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View file

@ -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;

View file

@ -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;
};

View file

@ -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<string, any> } } = {
range: {
timestamp: {
format: 'epoch_millis',