forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Embeddable Rebuild] [Controls] Clean up services + TODOs (elastic#19…
…3180) Part of elastic#192005 Closes elastic#167438 ## Summary ## Summary This PR represents the second major cleanup task for the control group embeddable refactor. The tasks included in this PR can be loosely summarized as follows: 1. It removes the old, cumbersome services implementation and replaces it with a much simpler system (which is the same one used in the `links` + `presentation_panel` plugins). - This it the main reason for the decrease in lines - the old system required a **huge** amount of boilerplate code, which is no longer necessary with the new method for storing services. 2. It addresses and/or removes any remaining TODO comments in the `controls` plugin - This includes renaming `ControlStyle` and `DEFAULT_CONTROL_STYLE` to `ControlLabelPosition` and `DEFAULT_CONTROL_LABEL_POSITION` respectively, which represents a bulk of the changes. 3. It moves all compatibility checks for all control actions to be async imported. 4. It removes the ability to register controls from the `controls` plugin setup contract. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
af0582c
commit db55574
Showing
91 changed files
with
399 additions
and
1,408 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
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
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
42 changes: 42 additions & 0 deletions
42
src/plugins/controls/public/actions/clear_control_action_compatibility_check.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,42 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { PresentationContainer, apiIsPresentationContainer } from '@kbn/presentation-containers'; | ||
import { | ||
HasParentApi, | ||
HasType, | ||
HasUniqueId, | ||
apiCanAccessViewMode, | ||
apiHasParentApi, | ||
apiHasType, | ||
apiHasUniqueId, | ||
apiIsOfType, | ||
} from '@kbn/presentation-publishing'; | ||
import { CONTROL_GROUP_TYPE } from '../../common'; | ||
import { isClearableControl, type CanClearSelections } from '../types'; | ||
|
||
type ClearControlActionApi = HasType & | ||
HasUniqueId & | ||
CanClearSelections & | ||
HasParentApi<PresentationContainer & HasType>; | ||
|
||
export const compatibilityCheck = (api: unknown | null): api is ClearControlActionApi => | ||
Boolean( | ||
apiHasType(api) && | ||
apiHasUniqueId(api) && | ||
isClearableControl(api) && | ||
apiHasParentApi(api) && | ||
apiCanAccessViewMode(api.parentApi) && | ||
apiIsOfType(api.parentApi, CONTROL_GROUP_TYPE) && | ||
apiIsPresentationContainer(api.parentApi) | ||
); | ||
|
||
export function isCompatible(api: unknown) { | ||
return compatibilityCheck(api); | ||
} |
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.