forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Embeddable Rebuild] [Discover] Fix bundle size (elastic#189206)
## Summary This PR is a follow up to elastic#180536, where `8.8KB` was added to the Discover bundle size - now, after async importing from the `presentation-publishing` package where necessary, I've reduced that increase to `3.4KB` (a decrease of `5.4KB` from the previous PR). ### 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)
- Loading branch information
Showing
3 changed files
with
42 additions
and
28 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
35 changes: 35 additions & 0 deletions
35
src/plugins/discover/public/embeddable/actions/view_saved_search_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,35 @@ | ||
/* | ||
* 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 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 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { SEARCH_EMBEDDABLE_TYPE } from '@kbn/discover-utils'; | ||
import { ViewMode } from '@kbn/embeddable-plugin/public'; | ||
import { | ||
apiCanAccessViewMode, | ||
apiHasType, | ||
apiIsOfType, | ||
CanAccessViewMode, | ||
EmbeddableApiContext, | ||
getInheritedViewMode, | ||
HasType, | ||
} from '@kbn/presentation-publishing'; | ||
|
||
import { apiPublishesSavedSearch, PublishesSavedSearch } from '../types'; | ||
|
||
type ViewSavedSearchActionApi = CanAccessViewMode & HasType & PublishesSavedSearch; | ||
|
||
export const compatibilityCheck = ( | ||
api: EmbeddableApiContext['embeddable'] | ||
): api is ViewSavedSearchActionApi => { | ||
return ( | ||
apiCanAccessViewMode(api) && | ||
getInheritedViewMode(api) === ViewMode.VIEW && | ||
apiHasType(api) && | ||
apiIsOfType(api, SEARCH_EMBEDDABLE_TYPE) && | ||
apiPublishesSavedSearch(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