-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Decouple edit-anomaly-swimlane UI action (#179073)
## Summary - Decouples edit-anomaly-swimlane and apply-time-range-selection UI actions from embeddable framework Part of #178375 Part of #174967
- Loading branch information
Showing
15 changed files
with
259 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/ml/public/embeddables/anomaly_charts/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { MlEntityField } from '@kbn/ml-anomaly-utils'; | ||
import type { HasType, PublishingSubject } from '@kbn/presentation-publishing'; | ||
import type { JobId } from '../../shared'; | ||
import type { AnomalyExplorerChartsEmbeddableType } from '../constants'; | ||
import type { MlEmbeddableBaseApi } from '../types'; | ||
|
||
export interface AnomalyChartsFieldSelectionApi { | ||
jobIds: PublishingSubject<JobId[]>; | ||
entityFields: PublishingSubject<MlEntityField[] | undefined>; | ||
} | ||
|
||
export interface AnomalyChartsEmbeddableApi | ||
extends HasType<AnomalyExplorerChartsEmbeddableType>, | ||
MlEmbeddableBaseApi, | ||
AnomalyChartsFieldSelectionApi {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
x-pack/plugins/ml/public/embeddables/anomaly_swimlane/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { | ||
HasType, | ||
PublishesWritablePanelTitle, | ||
PublishingSubject, | ||
} from '@kbn/presentation-publishing'; | ||
import { apiIsOfType } from '@kbn/presentation-publishing'; | ||
import { isPopulatedObject } from '@kbn/ml-is-populated-object'; | ||
import type { SwimlaneType } from '../../application/explorer/explorer_constants'; | ||
import type { JobId } from '../../shared'; | ||
import type { AnomalySwimLaneEmbeddableType } from '../constants'; | ||
import { ANOMALY_SWIMLANE_EMBEDDABLE_TYPE } from '../constants'; | ||
import type { AnomalySwimlaneEmbeddableUserInput, MlEmbeddableBaseApi } from '../types'; | ||
import type { AppStateSelectedCells } from '../../application/explorer/explorer_utils'; | ||
|
||
export interface AnomalySwimLaneComponentApi { | ||
jobIds: PublishingSubject<JobId[]>; | ||
swimlaneType: PublishingSubject<SwimlaneType>; | ||
viewBy: PublishingSubject<string>; | ||
perPage: PublishingSubject<number>; | ||
fromPage: PublishingSubject<number>; | ||
interval: PublishingSubject<number | undefined>; | ||
updateUserInput: (input: AnomalySwimlaneEmbeddableUserInput) => void; | ||
} | ||
|
||
export interface AnomalySwimLaneEmbeddableApi | ||
extends HasType<AnomalySwimLaneEmbeddableType>, | ||
PublishesWritablePanelTitle, | ||
MlEmbeddableBaseApi, | ||
AnomalySwimLaneComponentApi {} | ||
|
||
export interface AnomalySwimLaneActionContext { | ||
embeddable: AnomalySwimLaneEmbeddableApi; | ||
data?: AppStateSelectedCells; | ||
} | ||
|
||
export function isSwimLaneEmbeddableContext(arg: unknown): arg is AnomalySwimLaneActionContext { | ||
return ( | ||
isPopulatedObject(arg, ['embeddable']) && | ||
apiIsOfType(arg.embeddable, ANOMALY_SWIMLANE_EMBEDDABLE_TYPE) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.