Skip to content

Commit

Permalink
[Maps] remove maps_file_upload plugin and fold public folder into fil…
Browse files Browse the repository at this point in the history
…e_upload plugin (elastic#90292) (elastic#90890)

* get geojson working with api/file_upload/import

* remove maps_file_upload server code

* remove common folder

* remove maps_file_upload plugin

* fix tsconfig paths

* rename file_upload plugin in maps tsconfig

* fix file path

* node scripts/build_plugin_list_docs

* fix webpack compile errors

* telemetry schema cleanup, i18n cleanup, limits cleanup

* remove mapsFileUpload from limits.yml

* remove index pattern link test case

* update telemetry/v2/clusters/_stats for new file_upload path

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
nreese and kibanamachine authored Feb 10, 2021
1 parent b253d4b commit bd81ff9
Show file tree
Hide file tree
Showing 55 changed files with 36 additions and 763 deletions.
4 changes: 0 additions & 4 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,6 @@ using the CURL scripts in the scripts folder.
|Visualize geo data from Elasticsearch or 3rd party geo-services.
|{kib-repo}blob/{branch}/x-pack/plugins/maps_file_upload/README.md[mapsFileUpload]
|Deprecated - plugin targeted for removal and will get merged into file_upload plugin
|{kib-repo}blob/{branch}/x-pack/plugins/maps_legacy_licensing/README.md[mapsLegacyLicensing]
|This plugin provides access to the detailed tile map services from Elastic.
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ pageLoadAssetSize:
presentationUtil: 28545
spacesOss: 18817
osquery: 107090
mapsFileUpload: 23775
fileUpload: 25664
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"xpack.endpoint": "plugins/endpoint",
"xpack.enterpriseSearch": "plugins/enterprise_search",
"xpack.features": "plugins/features",
"xpack.fileUpload": "plugins/maps_file_upload",
"xpack.fileUpload": "plugins/file_upload",
"xpack.globalSearch": ["plugins/global_search"],
"xpack.globalSearchBar": ["plugins/global_search_bar"],
"xpack.graph": ["plugins/graph"],
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/file_upload/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": true,
"ui": false,
"requiredPlugins": ["usageCollection"]
"ui": true,
"requiredPlugins": ["data", "usageCollection"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ export class JsonImportProgress extends Component {
<a
data-test-subj="indexManagementNewIndexLink"
target="_blank"
href={`${basePath}/app/kibana#/
management/elasticsearch/index_management/indices/
filter/${indexName}`.replace(/\s/g, '')}
href={`${basePath}/app/management/kibana/indexPatterns`}
>
{i18n.translate('xpack.fileUpload.jsonImport.indexMgmtLink', {
defaultMessage: 'Index Management',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { EuiFilePicker, EuiFormRow, EuiProgress } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { parseFile } from '../util/file_parser';
import { MAX_FILE_SIZE } from '../../common/constants/file_import';

const MAX_FILE_SIZE = 52428800;
const ACCEPTABLE_FILETYPES = ['json', 'geojson'];
const acceptedFileTypeString = ACCEPTABLE_FILETYPES.map((type) => `.${type}`).join(',');
const acceptedFileTypeStringMessage = ACCEPTABLE_FILETYPES.map((type) => `.${type}`).join(', ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ export function plugin() {
return new FileUploadPlugin();
}

export * from '../common';

export { StartContract } from './plugin';
export { FileUploadComponentProps } from './get_file_upload_component';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,12 @@
*/

import _ from 'lodash';
import { ES_GEO_FIELD_TYPE } from '../../common/constants/file_import';

const DEFAULT_SETTINGS = {
number_of_shards: 1,
export const ES_GEO_FIELD_TYPE = {
GEO_POINT: 'geo_point',
GEO_SHAPE: 'geo_shape',
};

const DEFAULT_GEO_SHAPE_MAPPINGS = {
coordinates: {
type: ES_GEO_FIELD_TYPE.GEO_SHAPE,
},
};

const DEFAULT_GEO_POINT_MAPPINGS = {
coordinates: {
type: ES_GEO_FIELD_TYPE.GEO_POINT,
},
};

const DEFAULT_INGEST_PIPELINE = {};

export function getGeoIndexTypesForFeatures(featureTypes) {
const hasNoFeatureType = !featureTypes || !featureTypes.length;
if (hasNoFeatureType) {
Expand Down Expand Up @@ -77,11 +63,16 @@ export function geoJsonToEs(parsedGeojson, datatype) {
export function getGeoJsonIndexingDetails(parsedGeojson, dataType) {
return {
data: geoJsonToEs(parsedGeojson, dataType),
ingestPipeline: DEFAULT_INGEST_PIPELINE,
mappings:
dataType === ES_GEO_FIELD_TYPE.GEO_POINT
? DEFAULT_GEO_POINT_MAPPINGS
: DEFAULT_GEO_SHAPE_MAPPINGS,
settings: DEFAULT_SETTINGS,
ingestPipeline: {},
mappings: {
properties: {
coordinates: {
type: dataType,
},
},
},
settings: {
number_of_shards: 1,
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* 2.0.
*/

import { geoJsonToEs } from './geo_processing';
import { ES_GEO_FIELD_TYPE } from '../../common/constants/file_import';
import { ES_GEO_FIELD_TYPE, geoJsonToEs } from './geo_processing';

describe('geo_processing', () => {
describe('getGeoJsonToEs', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { getGeoJsonIndexingDetails } from './geo_processing';
import { sizeLimitedChunking } from './size_limited_chunking';
import { i18n } from '@kbn/i18n';

const fileType = 'json';

export async function indexData(parsedFile, transformDetails, indexName, dataType, appName) {
if (!parsedFile) {
throw i18n.translate('xpack.fileUpload.indexingService.noFileImported', {
Expand Down Expand Up @@ -117,10 +115,10 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) {

async function writeToIndex(indexingDetails) {
const query = indexingDetails.id ? { id: indexingDetails.id } : null;
const { appName, index, data, settings, mappings, ingestPipeline } = indexingDetails;
const { index, data, settings, mappings, ingestPipeline } = indexingDetails;

return await httpService({
url: `/api/maps/fileupload/import`,
url: `/api/file_upload/import`,
method: 'POST',
...(query ? { query } : {}),
data: {
Expand All @@ -129,8 +127,6 @@ async function writeToIndex(indexingDetails) {
settings,
mappings,
ingestPipeline,
fileType,
...(appName ? { app: appName } : {}),
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { MAX_BYTES } from '../../common/constants/file_import';
const MAX_BYTES = 31457280;

// MAX_BYTES is a good guideline for splitting up posts, but this logic
// occasionally sizes chunks so closely to the limit, that the remaining content
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/file_upload/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"include": ["common/**/*", "public/**/*", "server/**/*"],
"references": [
{ "path": "../../../src/core/tsconfig.json" },
{ "path": "../../../src/plugins/data/tsconfig.json" },
{ "path": "../../../src/plugins/usage_collection/tsconfig.json" }
]
}
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"features",
"inspector",
"data",
"mapsFileUpload",
"fileUpload",
"uiActions",
"navigation",
"visualizations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { GeoJsonFileSource } from '../../sources/geojson_file_source';
import { VectorLayer } from '../../layers/vector_layer';
import { createDefaultLayerDescriptor } from '../../sources/es_search_source';
import { RenderWizardArguments } from '../../layers/layer_wizard_registry';
import { FileUploadComponentProps } from '../../../../../maps_file_upload/public';
import { FileUploadComponentProps } from '../../../../../file_upload/public';

export const INDEX_SETUP_STEP_ID = 'INDEX_SETUP_STEP_ID';
export const INDEXING_STEP_ID = 'INDEXING_STEP_ID';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/kibana_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const getIndexPatternService = () => pluginsStart.data.indexPatterns;
export const getAutocompleteService = () => pluginsStart.data.autocomplete;
export const getInspector = () => pluginsStart.inspector;
export const getFileUploadComponent = async () => {
return await pluginsStart.mapsFileUpload.getFileUploadComponent();
return await pluginsStart.fileUpload.getFileUploadComponent();
};
export const getUiSettings = () => coreStart.uiSettings;
export const getIsDarkMode = () => getUiSettings().get('theme:darkMode', false);
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { EmbeddableStart } from '../../../../src/plugins/embeddable/public';
import { MapsLegacyConfig } from '../../../../src/plugins/maps_legacy/config';
import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public';
import { StartContract as FileUploadStartContract } from '../../maps_file_upload/public';
import { StartContract as FileUploadStartContract } from '../../file_upload/public';
import { SavedObjectsStart } from '../../../../src/plugins/saved_objects/public';
import { PresentationUtilPluginStart } from '../../../../src/plugins/presentation_util/public';
import {
Expand All @@ -80,7 +80,7 @@ export interface MapsPluginStartDependencies {
charts: ChartsPluginStart;
data: DataPublicPluginStart;
embeddable: EmbeddableStart;
mapsFileUpload: FileUploadStartContract;
fileUpload: FileUploadStartContract;
inspector: InspectorStartContract;
licensing: LicensingPluginStart;
navigation: NavigationPublicPluginStart;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{ "path": "../../../src/plugins/maps_legacy/tsconfig.json" },
{ "path": "../features/tsconfig.json" },
{ "path": "../licensing/tsconfig.json" },
{ "path": "../maps_file_upload/tsconfig.json" },
{ "path": "../file_upload/tsconfig.json" },
{ "path": "../saved_objects_tagging/tsconfig.json" },
]
}
3 changes: 0 additions & 3 deletions x-pack/plugins/maps_file_upload/README.md

This file was deleted.

21 changes: 0 additions & 21 deletions x-pack/plugins/maps_file_upload/common/constants/file_import.ts

This file was deleted.

12 changes: 0 additions & 12 deletions x-pack/plugins/maps_file_upload/jest.config.js

This file was deleted.

8 changes: 0 additions & 8 deletions x-pack/plugins/maps_file_upload/kibana.json

This file was deleted.

16 changes: 0 additions & 16 deletions x-pack/plugins/maps_file_upload/mappings.ts

This file was deleted.

12 changes: 0 additions & 12 deletions x-pack/plugins/maps_file_upload/server/client/errors.js

This file was deleted.

12 changes: 0 additions & 12 deletions x-pack/plugins/maps_file_upload/server/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions x-pack/plugins/maps_file_upload/server/kibana_server_services.js

This file was deleted.

Loading

0 comments on commit bd81ff9

Please sign in to comment.