Skip to content

Commit

Permalink
remove infrastructure-ui-source saved object 'fields' prop and 'field…
Browse files Browse the repository at this point in the history
…s' deprecations
  • Loading branch information
neptunian committed Oct 31, 2023
1 parent 419402b commit f427278
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 420 deletions.
3 changes: 0 additions & 3 deletions x-pack/plugins/infra/common/source_configuration/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export const defaultSourceConfiguration: InfraSourceConfiguration = {
type: 'index_name',
indexName: LOGS_INDEX_PATTERN,
},
fields: {
message: ['message', '@message'],
},
inventoryDefaultView: '0',
metricsExplorerDefaultView: '0',
logColumns: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,8 @@

/* eslint-disable @typescript-eslint/no-empty-interface */

import { omit } from 'lodash';
import * as rt from 'io-ts';

/**
* Source configuration config file properties.
* These are properties that can appear in the kibana.yml file.
* This is a legacy method of providing properties, and will be deprecated in the future (v 8.0.0).
*/

export const sourceConfigurationConfigFilePropertiesRT = rt.type({
sources: rt.type({
default: rt.partial({
fields: rt.partial({
message: rt.array(rt.string),
}),
}),
}),
});

export type SourceConfigurationConfigFileProperties = rt.TypeOf<
typeof sourceConfigurationConfigFilePropertiesRT
>;

/**
* Log columns
*/
Expand Down Expand Up @@ -104,47 +83,22 @@ export type LogIndexNameReference = rt.TypeOf<typeof logIndexNameReferenceRT>;
export const logIndexReferenceRT = rt.union([logIndexPatternReferenceRT, logIndexNameReferenceRT]);
export type LogIndexReference = rt.TypeOf<typeof logIndexReferenceRT>;

/**
* Fields
*/

const SourceConfigurationFieldsRT = rt.type({
message: rt.array(rt.string),
});

/**
* Properties that represent a full source configuration, which is the result of merging static values with
* saved values.
*/
export const SourceConfigurationRT = rt.type({
name: rt.string,
description: rt.string,
metricAlias: rt.string,
logIndices: logIndexReferenceRT,
inventoryDefaultView: rt.string,
metricsExplorerDefaultView: rt.string,
fields: SourceConfigurationFieldsRT,
logColumns: rt.array(SourceConfigurationColumnRuntimeType),
anomalyThreshold: rt.number,
});

/**
* Stored source configuration as read from and written to saved objects
*/
const SavedSourceConfigurationFieldsRuntimeType = rt.partial(
omit(SourceConfigurationFieldsRT.props, ['message'])
);

export type InfraSavedSourceConfigurationFields = rt.TypeOf<
typeof SavedSourceConfigurationFieldsRuntimeType
>;

export const SavedSourceConfigurationRuntimeType = rt.intersection([
rt.partial(omit(SourceConfigurationRT.props, ['fields'])),
rt.partial({
fields: SavedSourceConfigurationFieldsRuntimeType,
}),
]);
export const SavedSourceConfigurationRuntimeType = rt.partial(SourceConfigurationRT.props);

export interface InfraSavedSourceConfiguration
extends rt.TypeOf<typeof SavedSourceConfigurationRuntimeType> {}
Expand All @@ -154,10 +108,8 @@ export interface InfraSavedSourceConfiguration
* hardcoded defaults.
*/

const StaticSourceConfigurationFieldsRuntimeType = rt.partial(SourceConfigurationFieldsRT.props);
export const StaticSourceConfigurationRuntimeType = rt.partial({
...SourceConfigurationRT.props,
fields: StaticSourceConfigurationFieldsRuntimeType,
});

export interface InfraStaticSourceConfiguration
Expand All @@ -167,11 +119,8 @@ export interface InfraStaticSourceConfiguration
* Full source configuration type after all cleanup has been done at the edges
*/

export type InfraSourceConfigurationFields = rt.TypeOf<typeof SourceConfigurationFieldsRT>;

export const SourceConfigurationRuntimeType = rt.type({
...SourceConfigurationRT.props,
fields: SourceConfigurationFieldsRT,
logColumns: rt.array(SourceConfigurationColumnRuntimeType),
});

Expand Down
86 changes: 0 additions & 86 deletions x-pack/plugins/infra/server/deprecations.test.ts

This file was deleted.

Loading

0 comments on commit f427278

Please sign in to comment.