Skip to content

Commit

Permalink
[Maps] fix typings for optionalPlugins (#114103)
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese authored Oct 7, 2021
1 parent c2aeac5 commit a67eef4
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 62 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export interface MapsPluginStartDependencies {
dashboard: DashboardStart;
savedObjectsTagging?: SavedObjectTaggingPluginStart;
presentationUtil: PresentationUtilPluginStart;
security: SecurityPluginStart;
security?: SecurityPluginStart;
spaces?: SpacesPluginStart;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { getMapsTelemetry, MapsUsage } from '../maps_telemetry';

export function registerMapsUsageCollector(usageCollection: UsageCollectionSetup): void {
export function registerMapsUsageCollector(usageCollection?: UsageCollectionSetup): void {
if (!usageCollection) {
return;
}
Expand Down
121 changes: 61 additions & 60 deletions x-pack/plugins/maps/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import { embeddableMigrations } from './embeddable_migrations';

interface SetupDeps {
features: FeaturesPluginSetupContract;
usageCollection: UsageCollectionSetup;
home: HomeServerPluginSetup;
usageCollection?: UsageCollectionSetup;
home?: HomeServerPluginSetup;
licensing: LicensingPluginSetup;
mapsEms: MapsEmsPluginSetup;
embeddable: EmbeddableSetup;
Expand Down Expand Up @@ -72,66 +72,65 @@ export class MapsPlugin implements Plugin {
const sampleDataLinkLabel = i18n.translate('xpack.maps.sampleDataLinkLabel', {
defaultMessage: 'Map',
});
if (home) {
home.sampleData.addSavedObjectsToSampleDataset('ecommerce', getEcommerceSavedObjects());

home.sampleData.addAppLinksToSampleDataset('ecommerce', [
{
path: getFullPath('2c9c1f60-1909-11e9-919b-ffe5949a18d2'),
label: sampleDataLinkLabel,
icon: APP_ICON,
},
]);
home.sampleData.addSavedObjectsToSampleDataset('ecommerce', getEcommerceSavedObjects());

home.sampleData.addSavedObjectsToSampleDataset('flights', getFlightsSavedObjects());
home.sampleData.addAppLinksToSampleDataset('ecommerce', [
{
path: getFullPath('2c9c1f60-1909-11e9-919b-ffe5949a18d2'),
label: sampleDataLinkLabel,
icon: APP_ICON,
},
]);

home.sampleData.addAppLinksToSampleDataset('flights', [
{
path: getFullPath('5dd88580-1906-11e9-919b-ffe5949a18d2'),
label: sampleDataLinkLabel,
icon: APP_ICON,
},
]);

home.sampleData.replacePanelInSampleDatasetDashboard({
sampleDataId: 'flights',
dashboardId: '7adfa750-4c81-11e8-b3d7-01146121b73d',
oldEmbeddableId: '334084f0-52fd-11e8-a160-89cc2ad9e8e2',
embeddableId: '5dd88580-1906-11e9-919b-ffe5949a18d2',
// @ts-ignore
embeddableType: MAP_SAVED_OBJECT_TYPE,
embeddableConfig: {
isLayerTOCOpen: true,
},
});

home.sampleData.addSavedObjectsToSampleDataset('logs', getWebLogsSavedObjects());
home.sampleData.addAppLinksToSampleDataset('logs', [
{
path: getFullPath('de71f4f0-1902-11e9-919b-ffe5949a18d2'),
label: sampleDataLinkLabel,
icon: APP_ICON,
},
]);
home.sampleData.replacePanelInSampleDatasetDashboard({
sampleDataId: 'logs',
dashboardId: 'edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b',
oldEmbeddableId: '06cf9c40-9ee8-11e7-8711-e7a007dcef99',
embeddableId: 'de71f4f0-1902-11e9-919b-ffe5949a18d2',
// @ts-ignore
embeddableType: MAP_SAVED_OBJECT_TYPE,
embeddableConfig: {
isLayerTOCOpen: false,
},
});

home.tutorials.registerTutorial(
emsBoundariesSpecProvider({
prependBasePath,
emsLandingPageUrl: emsSettings.getEMSLandingPageUrl(),
})
);
}
home.sampleData.addSavedObjectsToSampleDataset('flights', getFlightsSavedObjects());

home.sampleData.addAppLinksToSampleDataset('flights', [
{
path: getFullPath('5dd88580-1906-11e9-919b-ffe5949a18d2'),
label: sampleDataLinkLabel,
icon: APP_ICON,
},
]);

home.sampleData.replacePanelInSampleDatasetDashboard({
sampleDataId: 'flights',
dashboardId: '7adfa750-4c81-11e8-b3d7-01146121b73d',
oldEmbeddableId: '334084f0-52fd-11e8-a160-89cc2ad9e8e2',
embeddableId: '5dd88580-1906-11e9-919b-ffe5949a18d2',
// @ts-ignore
embeddableType: MAP_SAVED_OBJECT_TYPE,
embeddableConfig: {
isLayerTOCOpen: true,
},
});

home.sampleData.addSavedObjectsToSampleDataset('logs', getWebLogsSavedObjects());
home.sampleData.addAppLinksToSampleDataset('logs', [
{
path: getFullPath('de71f4f0-1902-11e9-919b-ffe5949a18d2'),
label: sampleDataLinkLabel,
icon: APP_ICON,
},
]);
home.sampleData.replacePanelInSampleDatasetDashboard({
sampleDataId: 'logs',
dashboardId: 'edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b',
oldEmbeddableId: '06cf9c40-9ee8-11e7-8711-e7a007dcef99',
embeddableId: 'de71f4f0-1902-11e9-919b-ffe5949a18d2',
// @ts-ignore
embeddableType: MAP_SAVED_OBJECT_TYPE,
embeddableConfig: {
isLayerTOCOpen: false,
},
});

home.tutorials.registerTutorial(
emsBoundariesSpecProvider({
prependBasePath,
emsLandingPageUrl: emsSettings.getEMSLandingPageUrl(),
})
);
}

// @ts-ignore
Expand Down Expand Up @@ -160,7 +159,9 @@ export class MapsPlugin implements Plugin {

initRoutes(core, () => lastLicenseId, emsSettings, this.kibanaVersion, this._logger);

this._initHomeData(home, core.http.basePath.prepend, emsSettings);
if (home) {
this._initHomeData(home, core.http.basePath.prepend, emsSettings);
}

features.registerKibanaFeature({
id: APP_ID,
Expand Down

0 comments on commit a67eef4

Please sign in to comment.