Skip to content

Commit

Permalink
Resolve type check errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaStoeva committed Oct 29, 2024
1 parent 71566ec commit 8eef79b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export const createDataStreamPayload = (dataStream: Partial<DataStream>): DataSt
enabled: true,
data_retention: '7d',
},
indexMode: 'standard',
...dataStream,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ export function deserializeTemplate(
type = 'managed';
}

const ilmPolicyName = settings?.index?.lifecycle?.name;

const deserializedTemplate: TemplateDeserialized = {
name,
version,
priority,
...(template.lifecycle ? { lifecycle: deserializeESLifecycle(template.lifecycle) } : {}),
indexPatterns: indexPatterns.sort(),
template,
ilmPolicy: settings?.index?.lifecycle,
ilmPolicy: ilmPolicyName ? { name: ilmPolicyName } : undefined,
composedOf: composedOf ?? [],
ignoreMissingComponentTemplates: ignoreMissingComponentTemplates ?? [],
dataStream,
Expand Down
33 changes: 3 additions & 30 deletions x-pack/plugins/index_management/common/types/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,9 @@
* 2.0.
*/

export type { Index } from '@kbn/index-management-shared-types';
import { IndicesIndexSettingsKeys } from '@elastic/elasticsearch/lib/api/types';

export interface IndexModule {
number_of_shards: number | string;
codec: string;
routing_partition_size: number;
refresh_interval: string;
load_fixed_bitset_filters_eagerly: boolean;
shard: {
check_on_startup: boolean | 'checksum';
};
number_of_replicas: number;
auto_expand_replicas: false | string;
lifecycle: LifecycleModule;
routing: {
allocation: {
enable: 'all' | 'primaries' | 'new_primaries' | 'none';
};
rebalance: {
enable: 'all' | 'primaries' | 'replicas' | 'none';
};
};
}
export type { Index } from '@kbn/index-management-shared-types';

interface AnalysisModule {
analyzer: {
Expand All @@ -41,15 +21,8 @@ interface AnalysisModule {
};
}

interface LifecycleModule {
name: string;
rollover_alias?: string;
parse_origination_date?: boolean;
origination_date?: number;
}

export interface IndexSettings {
index?: Partial<IndexModule>;
index?: IndicesIndexSettingsKeys;
analysis?: AnalysisModule;
[key: string]: any;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { EuiTablePagination } from '@elastic/eui';
import { useEuiTablePersist } from '@kbn/shared-ux-table-persist';
import { IndexModule } from '../../../../../../common';
import { Index } from '../../../../../../common';

interface IndexTablePaginationProps {
pager: any;
Expand All @@ -27,7 +27,7 @@ export const IndexTablePagination = ({
readURLParams,
setURLParam,
}: IndexTablePaginationProps) => {
const { pageSize, onTableChange } = useEuiTablePersist<IndexModule>({
const { pageSize, onTableChange } = useEuiTablePersist<Index>({
tableId: 'indices',
initialPageSize: pager.itemsPerPage,
pageSizeOptions: PAGE_SIZE_OPTIONS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import { IScopedClusterClient } from '@kbn/core/server';
import {
IndicesDataStream,
IndicesDataStreamsStatsDataStreamsStatsItem,
IndicesGetIndexTemplateIndexTemplateItem,
SecurityHasPrivilegesResponse,
} from '@elastic/elasticsearch/lib/api/types';
import type { MeteringStats } from '../../../lib/types';
import {
deserializeDataStream,
deserializeDataStreamList,
} from '../../../lib/data_stream_serialization';
import { EnhancedDataStreamFromEs, TemplateSerialized } from '../../../../common/types';
import { EnhancedDataStreamFromEs } from '../../../../common/types';
import { RouteDependencies } from '../../../types';
import { addBasePath } from '..';

Expand All @@ -38,7 +39,7 @@ const enhanceDataStreams = ({
meteringStats?: MeteringStats[];
dataStreamsPrivileges?: SecurityHasPrivilegesResponse;
globalMaxRetention?: string;
indexTemplates?: Array<{ name: string; index_template: TemplateSerialized }>;
indexTemplates?: IndicesGetIndexTemplateIndexTemplateItem[];
}): EnhancedDataStreamFromEs[] => {
return dataStreams.map((dataStream) => {
const enhancedDataStream: EnhancedDataStreamFromEs = {
Expand Down

0 comments on commit 8eef79b

Please sign in to comment.