Skip to content

Commit

Permalink
[Maps] Add gdal integration (#118633)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck authored Nov 16, 2021
1 parent 899a803 commit 87312b4
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ readonly links: {
uptimeDurationAnomaly: string;
}>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly maps: Readonly<{
guide: string;
importGeospatialPrivileges: string;
gdalTutorial: string;
}>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
Expand Down
7 changes: 6 additions & 1 deletion src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ export class DocLinksService {
maps: {
guide: `${KIBANA_DOCS}maps.html`,
importGeospatialPrivileges: `${KIBANA_DOCS}import-geospatial-data.html#import-geospatial-privileges`,
gdalTutorial: `${ELASTIC_WEBSITE_URL}blog/how-to-ingest-geospatial-data-into-elasticsearch-with-gdal`,
},
monitoring: {
alertsKibana: `${KIBANA_DOCS}kibana-alerts.html`,
Expand Down Expand Up @@ -735,7 +736,11 @@ export interface DocLinksStart {
uptimeDurationAnomaly: string;
}>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly maps: Readonly<{
guide: string;
importGeospatialPrivileges: string;
gdalTutorial: string;
}>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
Expand Down
6 changes: 5 additions & 1 deletion src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,11 @@ export interface DocLinksStart {
uptimeDurationAnomaly: string;
}>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly maps: Readonly<{
guide: string;
importGeospatialPrivileges: string;
gdalTutorial: string;
}>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
Expand Down
1 change: 1 addition & 0 deletions src/plugins/custom_integrations/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const INTEGRATION_CATEGORY_DISPLAY = {
language_client: 'Language client',
upload_file: 'Upload a file',
website_search: 'Website search',
geo: 'Geo',
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function ({ getService }: FtrProviderContext) {

expect(resp.body).to.be.an('array');

expect(resp.body.length).to.be(34);
expect(resp.body.length).to.be(35);

// Test for sample data card
expect(resp.body.findIndex((c: { id: string }) => c.id === 'sample_data_all')).to.be.above(
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/maps/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"presentationUtil"
],
"optionalPlugins": [
"customIntegrations",
"home",
"savedObjectsTagging",
"charts",
Expand Down
129 changes: 129 additions & 0 deletions x-pack/plugins/maps/public/assets/gdal_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion x-pack/plugins/maps/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import { EMSSettings } from '../common/ems_settings';
import { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server';
import { EmbeddableSetup } from '../../../../src/plugins/embeddable/server';
import { embeddableMigrations } from './embeddable_migrations';
import { CustomIntegrationsPluginSetup } from '../../../../src/plugins/custom_integrations/server';
import { registerIntegrations } from './register_integrations';

interface SetupDeps {
features: FeaturesPluginSetupContract;
Expand All @@ -47,6 +49,7 @@ interface SetupDeps {
licensing: LicensingPluginSetup;
mapsEms: MapsEmsPluginSetup;
embeddable: EmbeddableSetup;
customIntegrations?: CustomIntegrationsPluginSetup;
}

export interface StartDeps {
Expand Down Expand Up @@ -159,7 +162,7 @@ export class MapsPlugin implements Plugin {

// @ts-ignore
setup(core: CoreSetup, plugins: SetupDeps) {
const { usageCollection, home, licensing, features, mapsEms } = plugins;
const { usageCollection, home, licensing, features, mapsEms, customIntegrations } = plugins;
const mapsEmsConfig = mapsEms.config;
const config$ = this._initializerContext.config.create();

Expand All @@ -178,6 +181,10 @@ export class MapsPlugin implements Plugin {
this._initHomeData(home, core.http.basePath.prepend, emsSettings);
}

if (customIntegrations) {
registerIntegrations(core, customIntegrations);
}

features.registerKibanaFeature({
id: APP_ID,
name: i18n.translate('xpack.maps.featureRegistry.mapsFeatureName', {
Expand Down
38 changes: 38 additions & 0 deletions x-pack/plugins/maps/server/register_integrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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 { i18n } from '@kbn/i18n';
import { CoreSetup } from 'kibana/server';
import { CustomIntegrationsPluginSetup } from '../../../../src/plugins/custom_integrations/server';
import { APP_ID } from '../common/constants';

export function registerIntegrations(
core: CoreSetup,
customIntegrations: CustomIntegrationsPluginSetup
) {
customIntegrations.registerCustomIntegration({
id: 'ingest_with_gdal',
title: i18n.translate('xpack.maps.registerIntegrations.gdal.integrationTitle', {
defaultMessage: 'GDAL',
}),
description: i18n.translate('xpack.maps.registerIntegrations.gdal.integrationDescription', {
defaultMessage:
'Upload shapefiles and ingest from relational databases such as PostGIS or Oracle Spatial with GDAL.',
}),
uiInternalPath:
'https://www.elastic.co/blog/how-to-ingest-geospatial-data-into-elasticsearch-with-gdal',
icons: [
{
type: 'svg',
src: core.http.basePath.prepend(`/plugins/${APP_ID}/assets/gdal_logo.svg`),
},
],
categories: ['upload_file', 'geo'],
shipper: 'other',
isBeta: false,
});
}
6 changes: 3 additions & 3 deletions x-pack/plugins/maps/server/tutorials/ems/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { i18n } from '@kbn/i18n';
import { TutorialsCategory } from '../../../../../../src/plugins/home/server';
import { getNewMapPath } from '../../../common/constants';
import { getNewMapPath, APP_ID } from '../../../common/constants';

export function emsBoundariesSpecProvider({
emsLandingPageUrl,
Expand Down Expand Up @@ -75,9 +75,9 @@ Indexing EMS administrative boundaries in Elasticsearch allows for search on bou
}),
euiIconType: 'emsApp',
completionTimeMinutes: 1,
previewImagePath: '/plugins/maps/assets/boundaries_screenshot.png',
previewImagePath: `/plugins/${APP_ID}/assets/boundaries_screenshot.png`,
onPrem: instructions,
elasticCloud: instructions,
integrationBrowserCategories: ['upload_file'],
integrationBrowserCategories: ['upload_file', 'geo'],
});
}

0 comments on commit 87312b4

Please sign in to comment.