Skip to content

Commit

Permalink
Renamed some data streams and added a default value for stats find
Browse files Browse the repository at this point in the history
  • Loading branch information
yuliacech committed Nov 26, 2020
1 parent 9260755 commit f86ae06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
18 changes: 9 additions & 9 deletions x-pack/plugins/index_management/common/types/data_streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ interface TimestampFieldFromEs {

type TimestampField = TimestampFieldFromEs;

interface MetaFieldFromEs {
interface MetaFromEs {
managed_by: string;
package: any;
managed: boolean;
}

interface PrivilegesFieldFromEs {
type Meta = MetaFromEs;

interface PrivilegesFromEs {
delete_index: boolean;
}

type PrivilegesField = PrivilegesFieldFromEs;

type MetaField = MetaFieldFromEs;
type Privileges = PrivilegesFromEs;

export type HealthFromEs = 'GREEN' | 'YELLOW' | 'RED';

Expand All @@ -31,13 +31,13 @@ export interface DataStreamFromEs {
timestamp_field: TimestampFieldFromEs;
indices: DataStreamIndexFromEs[];
generation: number;
_meta?: MetaFieldFromEs;
_meta?: MetaFromEs;
status: HealthFromEs;
template: string;
ilm_policy?: string;
store_size?: string;
maximum_timestamp?: number;
privileges: PrivilegesFieldFromEs;
privileges: PrivilegesFromEs;
}

export interface DataStreamIndexFromEs {
Expand All @@ -57,8 +57,8 @@ export interface DataStream {
ilmPolicyName?: string;
storageSize?: string;
maxTimeStamp?: number;
_meta?: MetaField;
privileges: PrivilegesField;
_meta?: Meta;
privileges: Privileges;
}

export interface DataStreamIndex {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ const enhanceDataStreams = ({

if (dataStreamsStats) {
// eslint-disable-next-line @typescript-eslint/naming-convention
const { store_size, maximum_timestamp } = dataStreamsStats.find(
({ data_stream: statsName }: { data_stream: string }) => statsName === dataStream.name
)!;
const { store_size, maximum_timestamp } =
dataStreamsStats.find(
({ data_stream: statsName }: { data_stream: string }) => statsName === dataStream.name
) || {};

enhancedDataStream = {
...enhancedDataStream,
Expand Down

0 comments on commit f86ae06

Please sign in to comment.