Skip to content

Commit

Permalink
[Stack Monitoring] Convert standalone_clusters directory to typescript (
Browse files Browse the repository at this point in the history
#112696)

* [Stack Monitoring] Convert standalone_clusters directory to typescript

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Zacqary and kibanamachine committed Sep 27, 2021
1 parent ac14197 commit d7770a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/monitoring/common/types/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export interface ElasticsearchLegacySource {
heap_max_in_bytes?: number;
};
};
fs: {
fs?: {
available_in_bytes?: number;
total_in_bytes?: number;
};
Expand Down Expand Up @@ -497,7 +497,7 @@ export interface ElasticsearchMetricbeatSource {
};
nodes?: {
versions?: string[];
count?: number;
count?: number | {};
jvm?: {
max_uptime?: {
ms?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand All @@ -28,5 +29,5 @@ export const getStandaloneClusterDefinition = () => {
},
},
},
};
} as Cluster;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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',
Expand Down

0 comments on commit d7770a6

Please sign in to comment.