Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Make bundle smaller #95881

Merged
merged 9 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pageLoadAssetSize:
lists: 202261
logstash: 53548
management: 46112
maps: 183610
maps: 80000
mapsLegacy: 87859
mapsLegacyLicensing: 20214
ml: 82187
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { useLayerList } from './useLayerList';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { RenderTooltipContentParams } from '../../../../../../maps/public';
import type { RenderTooltipContentParams } from '../../../../../../maps/public';
import { MapToolTip } from './MapToolTip';
import { useMapFilters } from './useMapFilters';
import { EmbeddableStart } from '../../../../../../../../src/plugins/embeddable/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
TRANSACTION_DURATION_COUNTRY,
TRANSACTION_DURATION_REGION,
} from './useLayerList';
import { RenderTooltipContentParams } from '../../../../../../maps/public';
import type { RenderTooltipContentParams } from '../../../../../../maps/public';
import { I18LABELS } from '../translations';

type MapToolTipProps = Partial<RenderTooltipContentParams>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import _ from 'lodash';
import { Filter } from '../../../../../../src/plugins/data/public';
import { TooltipFeature } from '../../../../../plugins/maps/common/descriptor_types';
import type { TooltipFeature } from '../../../../../plugins/maps/common/descriptor_types';

export interface ITooltipProperty {
getPropertyKey(): string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
EmbeddableFactoryDefinition,
IContainer,
} from '../../../../../src/plugins/embeddable/public';
import '../index.scss';
import { MAP_SAVED_OBJECT_TYPE, APP_ICON } from '../../common/constants';
import { getMapEmbeddableDisplayName } from '../../common/i18n_getters';
import { MapByReferenceInput, MapEmbeddableInput, MapByValueInput } from './types';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export const plugin: PluginInitializer<MapsPluginSetup, MapsPluginStart> = (

export { MAP_SAVED_OBJECT_TYPE } from '../common/constants';

export { RenderTooltipContentParams } from './classes/tooltips/tooltip_property';
export type { RenderTooltipContentParams } from './classes/tooltips/tooltip_property';

export { MapsStartApi } from './api';
29 changes: 21 additions & 8 deletions x-pack/plugins/maps/public/kibana_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* 2.0.
*/

import _ from 'lodash';
import { CoreStart } from 'kibana/public';
import type { CoreStart } from 'kibana/public';
import type { MapsEmsConfig } from '../../../../src/plugins/maps_ems/public';
import { MapsConfigType } from '../config';
import { MapsPluginStartDependencies } from './plugin';
import { EMSSettings } from '../common/ems_settings';
import { PaletteRegistry } from '../../../../src/plugins/charts/public';
import type { MapsConfigType } from '../config';
import type { MapsPluginStartDependencies } from './plugin';
import type { EMSSettings } from '../common/ems_settings';
import type { PaletteRegistry } from '../../../../src/plugins/charts/public';

let kibanaVersion: string;
export const setKibanaVersion = (version: string) => (kibanaVersion = version);
Expand Down Expand Up @@ -75,8 +74,22 @@ export const getEMSSettings = () => {

export const getEmsTileLayerId = () => getKibanaCommonConfig().emsTileLayerId;

export const getRegionmapLayers = () => _.get(getKibanaCommonConfig(), 'regionmap.layers', []);
export const getTilemap = () => _.get(getKibanaCommonConfig(), 'tilemap', []);
export const getRegionmapLayers = () => {
const config = getKibanaCommonConfig();
if (config.regionmap && config.regionmap.layers) {
return config.regionmap.layers;
} else {
return [];
}
};
export const getTilemap = () => {
const config = getKibanaCommonConfig();
if (config.tilemap) {
return config.tilemap;
} else {
return {};
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
}
};

export const getShareService = () => pluginsStart.share;

Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/maps/public/lazy_load_bundle/lazy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import '../../index.scss';
export * from '../../embeddable/map_embeddable';
export * from '../../kibana_services';
export { renderApp } from '../../render_app';
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/maps/public/maps_vis_type_alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import { i18n } from '@kbn/i18n';
import {
import type {
VisualizationsSetup,
VisualizationStage,
} from '../../../../src/plugins/visualizations/public';
import { SavedObject } from '../../../../src/core/types/saved_objects';
import { MapSavedObject } from '../common/map_saved_object_type';
import type { SavedObject } from '../../../../src/core/types/saved_objects';
import type { MapSavedObject } from '../common/map_saved_object_type';
import {
APP_ID,
APP_ICON,
Expand Down
37 changes: 18 additions & 19 deletions x-pack/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
* 2.0.
*/

import { Setup as InspectorSetupContract } from 'src/plugins/inspector/public';
import { UiActionsStart } from 'src/plugins/ui_actions/public';
import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
import { DashboardStart } from 'src/plugins/dashboard/public';
import {
import type { Setup as InspectorSetupContract } from 'src/plugins/inspector/public';
import type { UiActionsStart } from 'src/plugins/ui_actions/public';
import type { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
import type { Start as InspectorStartContract } from 'src/plugins/inspector/public';
import type { DashboardStart } from 'src/plugins/dashboard/public';
import type {
AppMountParameters,
CoreSetup,
CoreStart,
Plugin,
PluginInitializerContext,
DEFAULT_APP_CATEGORIES,
} from '../../../../src/core/public';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
// @ts-ignore
import { MapView } from './inspector/views/map_view';
import {
Expand All @@ -29,8 +29,8 @@ import {
} from './kibana_services';
import { featureCatalogueEntry } from './feature_catalogue_entry';
import { getMapsVisTypeAlias } from './maps_vis_type_alias';
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
import {
import type { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
import type {
VisualizationsSetup,
VisualizationsStart,
} from '../../../../src/plugins/visualizations/public';
Expand All @@ -43,28 +43,27 @@ import {
} from './url_generator';
import { visualizeGeoFieldAction } from './trigger_actions/visualize_geo_field_action';
import { MapEmbeddableFactory } from './embeddable/map_embeddable_factory';
import { EmbeddableSetup } from '../../../../src/plugins/embeddable/public';
import type { EmbeddableSetup, EmbeddableStart } from '../../../../src/plugins/embeddable/public';
import { MapsXPackConfig, MapsConfigType } from '../config';
import { getAppTitle } from '../common/i18n_getters';
import { lazyLoadMapModules } from './lazy_load_bundle';
import { MapsStartApi } from './api';
import { createLayerDescriptors, registerLayerWizard, registerSource } from './api';
import { SharePluginSetup, SharePluginStart } from '../../../../src/plugins/share/public';
import { EmbeddableStart } from '../../../../src/plugins/embeddable/public';
import type { SharePluginSetup, SharePluginStart } from '../../../../src/plugins/share/public';
import type { MapsEmsPluginSetup } from '../../../../src/plugins/maps_ems/public';
import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public';
import { FileUploadPluginStart } from '../../file_upload/public';
import { SavedObjectsStart } from '../../../../src/plugins/saved_objects/public';
import { PresentationUtilPluginStart } from '../../../../src/plugins/presentation_util/public';
import type { DataPublicPluginStart } from '../../../../src/plugins/data/public';
import type { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public';
import type { FileUploadPluginStart } from '../../file_upload/public';
import type { SavedObjectsStart } from '../../../../src/plugins/saved_objects/public';
import type { PresentationUtilPluginStart } from '../../../../src/plugins/presentation_util/public';
import {
getIsEnterprisePlus,
registerLicensedFeatures,
setLicensingPluginStart,
} from './licensed_features';
import { EMSSettings } from '../common/ems_settings';
import { SavedObjectTaggingPluginStart } from '../../saved_objects_tagging/public';
import { ChartsPluginStart } from '../../../../src/plugins/charts/public';
import type { SavedObjectTaggingPluginStart } from '../../saved_objects_tagging/public';
import type { ChartsPluginStart } from '../../../../src/plugins/charts/public';

export interface MapsPluginSetupDependencies {
inspector: InspectorSetupContract;
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/maps/public/url_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
*/

import rison from 'rison-node';
import {
import type {
TimeRange,
Filter,
Query,
esFilters,
QueryState,
RefreshInterval,
} from '../../../../src/plugins/data/public';
import { esFilters } from '../../../../src/plugins/data/public';
import { setStateToKbnUrl } from '../../../../src/plugins/kibana_utils/public';
import { UrlGeneratorsDefinition } from '../../../../src/plugins/share/public';
import { LayerDescriptor } from '../common/descriptor_types';
import type { UrlGeneratorsDefinition } from '../../../../src/plugins/share/public';
import type { LayerDescriptor } from '../common/descriptor_types';
import { INITIAL_LAYERS_KEY } from '../common/constants';
import { lazyLoadMapModules } from './lazy_load_bundle';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
MapEmbeddableInput,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../../plugins/maps/public/embeddable';
import {
import type {
RenderTooltipContentParams,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../../plugins/maps/public/classes/tooltips/tooltip_property';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { RenderTooltipContentParams } from '../../../../../maps/public/classes/tooltips/tooltip_property';
import type { RenderTooltipContentParams } from '../../../../../maps/public/classes/tooltips/tooltip_property';

export interface IndexPatternMapping {
title: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { MAP_SAVED_OBJECT_TYPE } from '../../../../../../../maps/public';
import { MapToolTipComponent } from './map_tool_tip';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { RenderTooltipContentParams } from '../../../../../../../maps/public/classes/tooltips/tooltip_property';
import type { RenderTooltipContentParams } from '../../../../../../../maps/public/classes/tooltips/tooltip_property';
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved

export interface EmbeddedMapProps {
upPoints: LocationPoint[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { monitorLocationsSelector } from '../../../../../state/selectors';
import { useMonitorId } from '../../../../../hooks';
import { MonitorLocation } from '../../../../../../common/runtime_types/monitor';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { RenderTooltipContentParams } from '../../../../../../../maps/public/classes/tooltips/tooltip_property';
import type { RenderTooltipContentParams } from '../../../../../../../maps/public/classes/tooltips/tooltip_property';
import { formatAvailabilityValue } from '../../availability_reporting/availability_reporting';
import { LastCheckLabel } from '../../translations';

Expand Down