Skip to content

Commit

Permalink
[ML] Adding support for saved object based ml modules (#92855) (#94428)
Browse files Browse the repository at this point in the history
* [ML] Adding support for saved object based ml modules

* updating icon mapping

* cleaning up code

* missed private variable

* removing mappings json file

* renaming module id

* updating test

* removing unrelated file

* type clean up

* changing logo type

* changes based on review

* removing fleet changes

* updating type guards

* fixing list module return type

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: James Gowdy <[email protected]>
  • Loading branch information
kibanamachine and jgowdyelastic authored Mar 11, 2021
1 parent 4f7da0e commit b97936d
Show file tree
Hide file tree
Showing 6 changed files with 319 additions and 182 deletions.
16 changes: 15 additions & 1 deletion x-pack/plugins/ml/common/types/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface ModuleJob {

export interface ModuleDatafeed {
id: string;
job_id: string;
config: Omit<Datafeed, 'datafeed_id'>;
}

Expand Down Expand Up @@ -48,14 +49,27 @@ export interface Module {
title: string;
description: string;
type: string;
logoFile: string;
logoFile?: string;
logo?: Logo;
defaultIndexPattern: string;
query: any;
jobs: ModuleJob[];
datafeeds: ModuleDatafeed[];
kibana: KibanaObjects;
}

export interface FileBasedModule extends Omit<Module, 'jobs' | 'datafeeds' | 'kibana'> {
jobs: Array<{ file: string; id: string }>;
datafeeds: Array<{ file: string; job_id: string; id: string }>;
kibana: {
search: Array<{ file: string; id: string }>;
visualization: Array<{ file: string; id: string }>;
dashboard: Array<{ file: string; id: string }>;
};
}

export type Logo = { icon: string } | null;

export interface ResultItem {
id: string;
success?: boolean;
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ml/common/types/saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

export type JobType = 'anomaly-detector' | 'data-frame-analytics';
export const ML_SAVED_OBJECT_TYPE = 'ml-job';
export const ML_MODULE_SAVED_OBJECT_TYPE = 'ml-module';

export interface SavedObjectResult {
[jobId: string]: { success: boolean; error?: any };
Expand Down
Loading

0 comments on commit b97936d

Please sign in to comment.