From f19cece8a55810d54b77930dda33bed5b89a3343 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 25 Jan 2021 10:07:30 -0700 Subject: [PATCH 01/19] migrate file_upload plugin to maps_file_upload --- x-pack/plugins/file_upload/README.md | 3 -- x-pack/plugins/maps/kibana.json | 2 +- .../layers/file_upload_wizard/wizard.tsx | 2 +- x-pack/plugins/maps/public/kibana_services.ts | 2 +- x-pack/plugins/maps/public/plugin.ts | 4 +-- x-pack/plugins/maps_file_upload/README.md | 3 ++ .../common/constants/file_import.ts | 0 .../jest.config.js | 2 +- .../kibana.json | 2 +- .../mappings.ts | 0 .../public/components/index_settings.js | 26 +++++++-------- .../public/components/json_import_progress.js | 10 +++--- .../components/json_index_file_picker.js | 33 ++++++++++--------- .../components/json_upload_and_parse.js | 14 ++++---- .../public/get_file_upload_component.ts | 0 .../public/index.ts | 0 .../public/kibana_services.js | 0 .../public/plugin.ts | 0 .../public/util/file_parser.js | 8 ++--- .../public/util/file_parser.test.js | 0 .../util/geo_json_clean_and_validate.js | 0 .../util/geo_json_clean_and_validate.test.js | 0 .../public/util/geo_processing.js | 0 .../public/util/geo_processing.test.js | 0 .../public/util/http_service.js | 4 +-- .../public/util/indexing_service.js | 16 ++++----- .../public/util/indexing_service.test.js | 0 .../public/util/size_limited_chunking.js | 0 .../public/util/size_limited_chunking.test.js | 0 .../server/client/errors.js | 0 .../server/index.js | 0 .../server/kibana_server_services.js | 0 .../server/models/import_data/import_data.js | 0 .../server/models/import_data/index.js | 0 .../server/plugin.js | 0 .../server/routes/file_upload.js | 0 .../server/routes/file_upload.test.js | 0 .../telemetry/file_upload_usage_collector.ts | 0 .../server/telemetry/index.ts | 0 .../server/telemetry/mappings.ts | 0 .../server/telemetry/telemetry.test.ts | 0 .../server/telemetry/telemetry.ts | 0 42 files changed, 67 insertions(+), 64 deletions(-) delete mode 100644 x-pack/plugins/file_upload/README.md create mode 100644 x-pack/plugins/maps_file_upload/README.md rename x-pack/plugins/{file_upload => maps_file_upload}/common/constants/file_import.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/jest.config.js (84%) rename x-pack/plugins/{file_upload => maps_file_upload}/kibana.json (83%) rename x-pack/plugins/{file_upload => maps_file_upload}/mappings.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/components/index_settings.js (82%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/components/json_import_progress.js (91%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/components/json_index_file_picker.js (85%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/components/json_upload_and_parse.js (93%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/get_file_upload_component.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/index.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/kibana_services.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/plugin.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/file_parser.js (92%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/file_parser.test.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/geo_json_clean_and_validate.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/geo_json_clean_and_validate.test.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/geo_processing.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/geo_processing.test.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/http_service.js (89%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/indexing_service.js (89%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/indexing_service.test.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/size_limited_chunking.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/public/util/size_limited_chunking.test.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/client/errors.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/index.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/kibana_server_services.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/models/import_data/import_data.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/models/import_data/index.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/plugin.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/routes/file_upload.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/routes/file_upload.test.js (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/telemetry/file_upload_usage_collector.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/telemetry/index.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/telemetry/mappings.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/telemetry/telemetry.test.ts (100%) rename x-pack/plugins/{file_upload => maps_file_upload}/server/telemetry/telemetry.ts (100%) diff --git a/x-pack/plugins/file_upload/README.md b/x-pack/plugins/file_upload/README.md deleted file mode 100644 index 0d4b4da61ccf6..0000000000000 --- a/x-pack/plugins/file_upload/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# File upload - -Backend and core front-end react-components for GeoJson file upload. Only supports the Maps plugin. \ No newline at end of file diff --git a/x-pack/plugins/maps/kibana.json b/x-pack/plugins/maps/kibana.json index e47968b027cc3..7f85a556faa72 100644 --- a/x-pack/plugins/maps/kibana.json +++ b/x-pack/plugins/maps/kibana.json @@ -8,7 +8,7 @@ "features", "inspector", "data", - "fileUpload", + "mapsFileUpload", "uiActions", "navigation", "visualizations", diff --git a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx index a0029c5c64e0b..65b6106a6f7f2 100644 --- a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx +++ b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx @@ -18,7 +18,7 @@ import { GeojsonFileSource } from '../../sources/geojson_file_source'; import { VectorLayer } from '../../layers/vector_layer/vector_layer'; import { createDefaultLayerDescriptor } from '../../sources/es_search_source'; import { RenderWizardArguments } from '../../layers/layer_wizard_registry'; -import { FileUploadComponentProps } from '../../../../../file_upload/public'; +import { FileUploadComponentProps } from '../../../../../maps_file_upload/public'; export const INDEX_SETUP_STEP_ID = 'INDEX_SETUP_STEP_ID'; export const INDEXING_STEP_ID = 'INDEXING_STEP_ID'; diff --git a/x-pack/plugins/maps/public/kibana_services.ts b/x-pack/plugins/maps/public/kibana_services.ts index 02b875257a5ac..99c9311a2a454 100644 --- a/x-pack/plugins/maps/public/kibana_services.ts +++ b/x-pack/plugins/maps/public/kibana_services.ts @@ -25,7 +25,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.fileUpload.getFileUploadComponent(); + return await pluginsStart.mapsFileUpload.getFileUploadComponent(); }; export const getUiSettings = () => coreStart.uiSettings; export const getIsDarkMode = () => getUiSettings().get('theme:darkMode', false); diff --git a/x-pack/plugins/maps/public/plugin.ts b/x-pack/plugins/maps/public/plugin.ts index 8bffea3ce5a87..762283f1b8139 100644 --- a/x-pack/plugins/maps/public/plugin.ts +++ b/x-pack/plugins/maps/public/plugin.ts @@ -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 '../../file_upload/public'; +import { StartContract as FileUploadStartContract } from '../../maps_file_upload/public'; import { SavedObjectsStart } from '../../../../src/plugins/saved_objects/public'; import { getIsEnterprisePlus, @@ -77,7 +77,7 @@ export interface MapsPluginSetupDependencies { export interface MapsPluginStartDependencies { data: DataPublicPluginStart; embeddable: EmbeddableStart; - fileUpload: FileUploadStartContract; + mapsFileUpload: FileUploadStartContract; inspector: InspectorStartContract; licensing: LicensingPluginStart; navigation: NavigationPublicPluginStart; diff --git a/x-pack/plugins/maps_file_upload/README.md b/x-pack/plugins/maps_file_upload/README.md new file mode 100644 index 0000000000000..1e3343664afb8 --- /dev/null +++ b/x-pack/plugins/maps_file_upload/README.md @@ -0,0 +1,3 @@ +# Maps File upload + +Deprecated - plugin targeted for removal and will get merged into file_upload plugin diff --git a/x-pack/plugins/file_upload/common/constants/file_import.ts b/x-pack/plugins/maps_file_upload/common/constants/file_import.ts similarity index 100% rename from x-pack/plugins/file_upload/common/constants/file_import.ts rename to x-pack/plugins/maps_file_upload/common/constants/file_import.ts diff --git a/x-pack/plugins/file_upload/jest.config.js b/x-pack/plugins/maps_file_upload/jest.config.js similarity index 84% rename from x-pack/plugins/file_upload/jest.config.js rename to x-pack/plugins/maps_file_upload/jest.config.js index 6a042a4cc5c1e..2893da079141c 100644 --- a/x-pack/plugins/file_upload/jest.config.js +++ b/x-pack/plugins/maps_file_upload/jest.config.js @@ -7,5 +7,5 @@ module.exports = { preset: '@kbn/test', rootDir: '../../..', - roots: ['/x-pack/plugins/file_upload'], + roots: ['/x-pack/plugins/maps_file_upload'], }; diff --git a/x-pack/plugins/file_upload/kibana.json b/x-pack/plugins/maps_file_upload/kibana.json similarity index 83% rename from x-pack/plugins/file_upload/kibana.json rename to x-pack/plugins/maps_file_upload/kibana.json index 7676a01d0b0f9..f544c56cba517 100644 --- a/x-pack/plugins/file_upload/kibana.json +++ b/x-pack/plugins/maps_file_upload/kibana.json @@ -1,5 +1,5 @@ { - "id": "fileUpload", + "id": "mapsFileUpload", "version": "8.0.0", "kibanaVersion": "kibana", "server": true, diff --git a/x-pack/plugins/file_upload/mappings.ts b/x-pack/plugins/maps_file_upload/mappings.ts similarity index 100% rename from x-pack/plugins/file_upload/mappings.ts rename to x-pack/plugins/maps_file_upload/mappings.ts diff --git a/x-pack/plugins/file_upload/public/components/index_settings.js b/x-pack/plugins/maps_file_upload/public/components/index_settings.js similarity index 82% rename from x-pack/plugins/file_upload/public/components/index_settings.js rename to x-pack/plugins/maps_file_upload/public/components/index_settings.js index cb1e639e0fede..3102c00dd8290 100644 --- a/x-pack/plugins/file_upload/public/components/index_settings.js +++ b/x-pack/plugins/maps_file_upload/public/components/index_settings.js @@ -78,7 +78,7 @@ export class IndexSettings extends Component { if (nameAlreadyInUse) { return ( ); @@ -88,7 +88,7 @@ export class IndexSettings extends Component { if (!indexPatternValid) { return ( ); @@ -105,7 +105,7 @@ export class IndexSettings extends Component { } @@ -123,7 +123,7 @@ export class IndexSettings extends Component { } @@ -133,13 +133,13 @@ export class IndexSettings extends Component { @@ -148,41 +148,41 @@ export class IndexSettings extends Component {
  • - {i18n.translate('xpack.fileUpload.indexSettings.guidelines.mustBeNewIndex', { + {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.mustBeNewIndex', { defaultMessage: 'Must be a new index', })}
  • - {i18n.translate('xpack.fileUpload.indexSettings.guidelines.lowercaseOnly', { + {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.lowercaseOnly', { defaultMessage: 'Lowercase only', })}
  • - {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotInclude', { + {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.cannotInclude', { defaultMessage: 'Cannot include \\\\, /, *, ?, ", <, >, |, \ " " (space character), , (comma), #', })}
  • - {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotStartWith', { + {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.cannotStartWith', { defaultMessage: 'Cannot start with -, _, +', })}
  • - {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotBe', { + {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.cannotBe', { defaultMessage: 'Cannot be . or ..', })}
  • - {i18n.translate('xpack.fileUpload.indexSettings.guidelines.length', { + {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.length', { defaultMessage: 'Cannot be longer than 255 bytes (note it is bytes, \ so multi-byte characters will count towards the 255 \ diff --git a/x-pack/plugins/file_upload/public/components/json_import_progress.js b/x-pack/plugins/maps_file_upload/public/components/json_import_progress.js similarity index 91% rename from x-pack/plugins/file_upload/public/components/json_import_progress.js rename to x-pack/plugins/maps_file_upload/public/components/json_import_progress.js index 23ca4550e1744..754c3021b4dca 100644 --- a/x-pack/plugins/file_upload/public/components/json_import_progress.js +++ b/x-pack/plugins/maps_file_upload/public/components/json_import_progress.js @@ -60,7 +60,7 @@ export class JsonImportProgress extends Component {

    @@ -74,7 +74,7 @@ export class JsonImportProgress extends Component {

    @@ -94,7 +94,7 @@ export class JsonImportProgress extends Component {

    @@ -111,7 +111,7 @@ export class JsonImportProgress extends Component { ) : null}
    - {i18n.translate('xpack.fileUpload.jsonImport.indexModsMsg', { + {i18n.translate('xpack.mapsFileUpload.jsonImport.indexModsMsg', { defaultMessage: 'Further index modifications can be made using\n', })} - {i18n.translate('xpack.fileUpload.jsonImport.indexMgmtLink', { + {i18n.translate('xpack.mapsFileUpload.jsonImport.indexMgmtLink', { defaultMessage: 'Index Management', })} diff --git a/x-pack/plugins/file_upload/public/components/json_index_file_picker.js b/x-pack/plugins/maps_file_upload/public/components/json_index_file_picker.js similarity index 85% rename from x-pack/plugins/file_upload/public/components/json_index_file_picker.js rename to x-pack/plugins/maps_file_upload/public/components/json_index_file_picker.js index d69a964a0b49e..d026d0bc4e9cf 100644 --- a/x-pack/plugins/file_upload/public/components/json_index_file_picker.js +++ b/x-pack/plugins/maps_file_upload/public/components/json_index_file_picker.js @@ -67,7 +67,7 @@ export class JsonIndexFilePicker extends Component { const humanReadableSize = bytesToSize(size); const humanReadableMaxSize = bytesToSize(MAX_FILE_SIZE); throw new Error( - i18n.translate('xpack.fileUpload.jsonIndexFilePicker.acceptableFileSize', { + i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.acceptableFileSize', { defaultMessage: 'File size {fileSize} exceeds max file size of {maxFileSize}', values: { fileSize: humanReadableSize, @@ -78,7 +78,7 @@ export class JsonIndexFilePicker extends Component { } } catch (error) { this.setState({ - fileUploadError: i18n.translate('xpack.fileUpload.jsonIndexFilePicker.fileSizeError', { + fileUploadError: i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.fileSizeError', { defaultMessage: 'File size error: {errorMessage}', values: { errorMessage: error.message, @@ -95,7 +95,7 @@ export class JsonIndexFilePicker extends Component { try { if (!name) { throw new Error( - i18n.translate('xpack.fileUpload.jsonIndexFilePicker.noFileNameError', { + i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.noFileNameError', { defaultMessage: 'No file name provided', }) ); @@ -106,7 +106,7 @@ export class JsonIndexFilePicker extends Component { if (!ACCEPTABLE_FILETYPES.includes(fileType)) { //should only occur if browser does not accept the accept parameter throw new Error( - i18n.translate('xpack.fileUpload.jsonIndexFilePicker.acceptableTypesError', { + i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.acceptableTypesError', { defaultMessage: 'File is not one of acceptable types: {types}', values: { types: ACCEPTABLE_FILETYPES.join(', '), @@ -119,7 +119,7 @@ export class JsonIndexFilePicker extends Component { } catch (error) { this.setState({ fileUploadError: i18n.translate( - 'xpack.fileUpload.jsonIndexFilePicker.fileProcessingError', + 'xpack.mapsFileUpload.jsonIndexFilePicker.fileProcessingError', { defaultMessage: 'File processing error: {errorMessage}', values: { @@ -173,7 +173,7 @@ export class JsonIndexFilePicker extends Component { featuresProcessed: 0, fileUploadError: ( @@ -235,7 +235,7 @@ export class JsonIndexFilePicker extends Component { } @@ -243,7 +243,7 @@ export class JsonIndexFilePicker extends Component { error={[fileUploadError]} helpText={ percentageProcessed ? ( - i18n.translate('xpack.fileUpload.jsonIndexFilePicker.parsingFile', { + i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.parsingFile', { defaultMessage: '{featuresProcessed} features parsed...', values: { featuresProcessed, @@ -251,7 +251,7 @@ export class JsonIndexFilePicker extends Component { }) ) : ( - {i18n.translate('xpack.fileUpload.jsonIndexFilePicker.formatsAccepted', { + {i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.formatsAccepted', { defaultMessage: 'Formats accepted: {acceptedFileTypeStringMessage}', values: { acceptedFileTypeStringMessage, @@ -259,16 +259,19 @@ export class JsonIndexFilePicker extends Component { })}{' '}

    - {i18n.translate('xpack.fileUpload.jsonIndexFilePicker.coordinateSystemAccepted', { - defaultMessage: 'Coordinates must be in EPSG:4326 coordinate reference system.', - })}{' '} + {i18n.translate( + 'xpack.mapsFileUpload.jsonIndexFilePicker.coordinateSystemAccepted', + { + defaultMessage: 'Coordinates must be in EPSG:4326 coordinate reference system.', + } + )}{' '}
    ) } @@ -276,7 +279,7 @@ export class JsonIndexFilePicker extends Component { } diff --git a/x-pack/plugins/file_upload/public/components/json_upload_and_parse.js b/x-pack/plugins/maps_file_upload/public/components/json_upload_and_parse.js similarity index 93% rename from x-pack/plugins/file_upload/public/components/json_upload_and_parse.js rename to x-pack/plugins/maps_file_upload/public/components/json_upload_and_parse.js index 453d4f84f7e0e..7cd9d54f9ac8b 100644 --- a/x-pack/plugins/file_upload/public/components/json_upload_and_parse.js +++ b/x-pack/plugins/maps_file_upload/public/components/json_upload_and_parse.js @@ -16,27 +16,27 @@ import { JsonImportProgress } from './json_import_progress'; import _ from 'lodash'; const INDEXING_STAGE = { - INDEXING_STARTED: i18n.translate('xpack.fileUpload.jsonUploadAndParse.dataIndexingStarted', { + INDEXING_STARTED: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.dataIndexingStarted', { defaultMessage: 'Data indexing started', }), - WRITING_TO_INDEX: i18n.translate('xpack.fileUpload.jsonUploadAndParse.writingToIndex', { + WRITING_TO_INDEX: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.writingToIndex', { defaultMessage: 'Writing to index', }), - INDEXING_COMPLETE: i18n.translate('xpack.fileUpload.jsonUploadAndParse.indexingComplete', { + INDEXING_COMPLETE: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.indexingComplete', { defaultMessage: 'Indexing complete', }), CREATING_INDEX_PATTERN: i18n.translate( - 'xpack.fileUpload.jsonUploadAndParse.creatingIndexPattern', + 'xpack.mapsFileUpload.jsonUploadAndParse.creatingIndexPattern', { defaultMessage: 'Creating index pattern' } ), INDEX_PATTERN_COMPLETE: i18n.translate( - 'xpack.fileUpload.jsonUploadAndParse.indexPatternComplete', + 'xpack.mapsFileUpload.jsonUploadAndParse.indexPatternComplete', { defaultMessage: 'Index pattern complete' } ), - INDEXING_ERROR: i18n.translate('xpack.fileUpload.jsonUploadAndParse.dataIndexingError', { + INDEXING_ERROR: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.dataIndexingError', { defaultMessage: 'Data indexing error', }), - INDEX_PATTERN_ERROR: i18n.translate('xpack.fileUpload.jsonUploadAndParse.indexPatternError', { + INDEX_PATTERN_ERROR: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.indexPatternError', { defaultMessage: 'Index pattern error', }), }; diff --git a/x-pack/plugins/file_upload/public/get_file_upload_component.ts b/x-pack/plugins/maps_file_upload/public/get_file_upload_component.ts similarity index 100% rename from x-pack/plugins/file_upload/public/get_file_upload_component.ts rename to x-pack/plugins/maps_file_upload/public/get_file_upload_component.ts diff --git a/x-pack/plugins/file_upload/public/index.ts b/x-pack/plugins/maps_file_upload/public/index.ts similarity index 100% rename from x-pack/plugins/file_upload/public/index.ts rename to x-pack/plugins/maps_file_upload/public/index.ts diff --git a/x-pack/plugins/file_upload/public/kibana_services.js b/x-pack/plugins/maps_file_upload/public/kibana_services.js similarity index 100% rename from x-pack/plugins/file_upload/public/kibana_services.js rename to x-pack/plugins/maps_file_upload/public/kibana_services.js diff --git a/x-pack/plugins/file_upload/public/plugin.ts b/x-pack/plugins/maps_file_upload/public/plugin.ts similarity index 100% rename from x-pack/plugins/file_upload/public/plugin.ts rename to x-pack/plugins/maps_file_upload/public/plugin.ts diff --git a/x-pack/plugins/file_upload/public/util/file_parser.js b/x-pack/plugins/maps_file_upload/public/util/file_parser.js similarity index 92% rename from x-pack/plugins/file_upload/public/util/file_parser.js rename to x-pack/plugins/maps_file_upload/public/util/file_parser.js index 2a504f46f598a..2437cae7a2763 100644 --- a/x-pack/plugins/file_upload/public/util/file_parser.js +++ b/x-pack/plugins/maps_file_upload/public/util/file_parser.js @@ -20,7 +20,7 @@ export const fileHandler = async ({ if (!file) { reject( new Error( - i18n.translate('xpack.fileUpload.fileParser.noFileProvided', { + i18n.translate('xpack.mapsFileUpload.fileParser.noFileProvided', { defaultMessage: 'Error, no file provided', }) ) @@ -66,7 +66,7 @@ export const fileHandler = async ({ boolGeometryErrs = true; errors.push( new Error( - i18n.translate('xpack.fileUpload.fileParser.featuresOmitted', { + i18n.translate('xpack.mapsFileUpload.fileParser.featuresOmitted', { defaultMessage: 'Some features without geometry omitted', }) ) @@ -92,7 +92,7 @@ export const fileHandler = async ({ if (!featuresProcessed && getFileParseActive()) { reject( new Error( - i18n.translate('xpack.fileUpload.fileParser.noFeaturesDetected', { + i18n.translate('xpack.mapsFileUpload.fileParser.noFeaturesDetected', { defaultMessage: 'Error, no features detected', }) ) @@ -133,7 +133,7 @@ export async function parseFile({ cleanAndValidate = geoJsonCleanAndValidate; break; default: - throw i18n.translate('xpack.fileUpload.fileParser.transformDetailsNotDefined', { + throw i18n.translate('xpack.mapsFileUpload.fileParser.transformDetailsNotDefined', { defaultMessage: 'Index options for {transformDetails} not defined', values: { transformDetails }, }); diff --git a/x-pack/plugins/file_upload/public/util/file_parser.test.js b/x-pack/plugins/maps_file_upload/public/util/file_parser.test.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/file_parser.test.js rename to x-pack/plugins/maps_file_upload/public/util/file_parser.test.js diff --git a/x-pack/plugins/file_upload/public/util/geo_json_clean_and_validate.js b/x-pack/plugins/maps_file_upload/public/util/geo_json_clean_and_validate.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/geo_json_clean_and_validate.js rename to x-pack/plugins/maps_file_upload/public/util/geo_json_clean_and_validate.js diff --git a/x-pack/plugins/file_upload/public/util/geo_json_clean_and_validate.test.js b/x-pack/plugins/maps_file_upload/public/util/geo_json_clean_and_validate.test.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/geo_json_clean_and_validate.test.js rename to x-pack/plugins/maps_file_upload/public/util/geo_json_clean_and_validate.test.js diff --git a/x-pack/plugins/file_upload/public/util/geo_processing.js b/x-pack/plugins/maps_file_upload/public/util/geo_processing.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/geo_processing.js rename to x-pack/plugins/maps_file_upload/public/util/geo_processing.js diff --git a/x-pack/plugins/file_upload/public/util/geo_processing.test.js b/x-pack/plugins/maps_file_upload/public/util/geo_processing.test.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/geo_processing.test.js rename to x-pack/plugins/maps_file_upload/public/util/geo_processing.test.js diff --git a/x-pack/plugins/file_upload/public/util/http_service.js b/x-pack/plugins/maps_file_upload/public/util/http_service.js similarity index 89% rename from x-pack/plugins/file_upload/public/util/http_service.js rename to x-pack/plugins/maps_file_upload/public/util/http_service.js index 4bf9ec2d4c6d5..cbb3466ef7054 100644 --- a/x-pack/plugins/file_upload/public/util/http_service.js +++ b/x-pack/plugins/maps_file_upload/public/util/http_service.js @@ -9,7 +9,7 @@ import { kbnFetch } from '../kibana_services'; export async function http(options) { if (!(options && options.url)) { - throw i18n.translate('xpack.fileUpload.httpService.noUrl', { + throw i18n.translate('xpack.mapsFileUpload.httpService.noUrl', { defaultMessage: 'No URL provided', }); } @@ -41,7 +41,7 @@ async function doFetch(url, payload) { } catch (err) { return { failures: [ - i18n.translate('xpack.fileUpload.httpService.fetchError', { + i18n.translate('xpack.mapsFileUpload.httpService.fetchError', { defaultMessage: 'Error performing fetch: {error}', values: { error: err.message }, }), diff --git a/x-pack/plugins/file_upload/public/util/indexing_service.js b/x-pack/plugins/maps_file_upload/public/util/indexing_service.js similarity index 89% rename from x-pack/plugins/file_upload/public/util/indexing_service.js rename to x-pack/plugins/maps_file_upload/public/util/indexing_service.js index 28cdb602455b5..e02d2a9ce770f 100644 --- a/x-pack/plugins/file_upload/public/util/indexing_service.js +++ b/x-pack/plugins/maps_file_upload/public/util/indexing_service.js @@ -14,7 +14,7 @@ const fileType = 'json'; export async function indexData(parsedFile, transformDetails, indexName, dataType, appName) { if (!parsedFile) { - throw i18n.translate('xpack.fileUpload.indexingService.noFileImported', { + throw i18n.translate('xpack.mapsFileUpload.indexingService.noFileImported', { defaultMessage: 'No file imported.', }); } @@ -22,7 +22,7 @@ export async function indexData(parsedFile, transformDetails, indexName, dataTyp // Perform any processing required on file prior to indexing const transformResult = transformDataByFormatForIndexing(transformDetails, parsedFile, dataType); if (!transformResult.success) { - throw i18n.translate('xpack.fileUpload.indexingService.transformResultError', { + throw i18n.translate('xpack.mapsFileUpload.indexingService.transformResultError', { defaultMessage: 'Error transforming data: {error}', values: { error: transformResult.error }, }); @@ -40,7 +40,7 @@ export async function indexData(parsedFile, transformDetails, indexName, dataTyp const id = createdIndex && createdIndex.id; try { if (!id) { - throw i18n.translate('xpack.fileUpload.indexingService.errorCreatingIndex', { + throw i18n.translate('xpack.mapsFileUpload.indexingService.errorCreatingIndex', { defaultMessage: 'Error creating index', }); } @@ -67,7 +67,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { if (!transform) { return { success: false, - error: i18n.translate('xpack.fileUpload.indexingService.noTransformDefined', { + error: i18n.translate('xpack.mapsFileUpload.indexingService.noTransformDefined', { defaultMessage: 'No transform defined', }), }; @@ -80,7 +80,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { default: return { success: false, - error: i18n.translate('xpack.fileUpload.indexingService.noHandlingForTransform', { + error: i18n.translate('xpack.mapsFileUpload.indexingService.noHandlingForTransform', { defaultMessage: 'No handling defined for transform: {transform}', values: { transform }, }), @@ -98,7 +98,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { } else if (indexingDetails && indexingDetails.data) { return { success: false, - error: i18n.translate('xpack.fileUpload.indexingService.noIndexingDetailsForDatatype', { + error: i18n.translate('xpack.mapsFileUpload.indexingService.noIndexingDetailsForDatatype', { defaultMessage: `No indexing details defined for datatype: {dataType}`, values: { dataType }, }), @@ -106,7 +106,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { } else { return { success: false, - error: i18n.translate('xpack.fileUpload.indexingService.unknownTransformError', { + error: i18n.translate('xpack.mapsFileUpload.indexingService.unknownTransformError', { defaultMessage: 'Unknown error performing transform: {transform}', values: { transform }, }), @@ -138,7 +138,7 @@ async function chunkDataAndWriteToIndex({ id, index, data, mappings, settings }) if (!index) { return { success: false, - error: i18n.translate('xpack.fileUpload.noIndexSuppliedErrorMessage', { + error: i18n.translate('xpack.mapsFileUpload.noIndexSuppliedErrorMessage', { defaultMessage: 'No index provided.', }), }; diff --git a/x-pack/plugins/file_upload/public/util/indexing_service.test.js b/x-pack/plugins/maps_file_upload/public/util/indexing_service.test.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/indexing_service.test.js rename to x-pack/plugins/maps_file_upload/public/util/indexing_service.test.js diff --git a/x-pack/plugins/file_upload/public/util/size_limited_chunking.js b/x-pack/plugins/maps_file_upload/public/util/size_limited_chunking.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/size_limited_chunking.js rename to x-pack/plugins/maps_file_upload/public/util/size_limited_chunking.js diff --git a/x-pack/plugins/file_upload/public/util/size_limited_chunking.test.js b/x-pack/plugins/maps_file_upload/public/util/size_limited_chunking.test.js similarity index 100% rename from x-pack/plugins/file_upload/public/util/size_limited_chunking.test.js rename to x-pack/plugins/maps_file_upload/public/util/size_limited_chunking.test.js diff --git a/x-pack/plugins/file_upload/server/client/errors.js b/x-pack/plugins/maps_file_upload/server/client/errors.js similarity index 100% rename from x-pack/plugins/file_upload/server/client/errors.js rename to x-pack/plugins/maps_file_upload/server/client/errors.js diff --git a/x-pack/plugins/file_upload/server/index.js b/x-pack/plugins/maps_file_upload/server/index.js similarity index 100% rename from x-pack/plugins/file_upload/server/index.js rename to x-pack/plugins/maps_file_upload/server/index.js diff --git a/x-pack/plugins/file_upload/server/kibana_server_services.js b/x-pack/plugins/maps_file_upload/server/kibana_server_services.js similarity index 100% rename from x-pack/plugins/file_upload/server/kibana_server_services.js rename to x-pack/plugins/maps_file_upload/server/kibana_server_services.js diff --git a/x-pack/plugins/file_upload/server/models/import_data/import_data.js b/x-pack/plugins/maps_file_upload/server/models/import_data/import_data.js similarity index 100% rename from x-pack/plugins/file_upload/server/models/import_data/import_data.js rename to x-pack/plugins/maps_file_upload/server/models/import_data/import_data.js diff --git a/x-pack/plugins/file_upload/server/models/import_data/index.js b/x-pack/plugins/maps_file_upload/server/models/import_data/index.js similarity index 100% rename from x-pack/plugins/file_upload/server/models/import_data/index.js rename to x-pack/plugins/maps_file_upload/server/models/import_data/index.js diff --git a/x-pack/plugins/file_upload/server/plugin.js b/x-pack/plugins/maps_file_upload/server/plugin.js similarity index 100% rename from x-pack/plugins/file_upload/server/plugin.js rename to x-pack/plugins/maps_file_upload/server/plugin.js diff --git a/x-pack/plugins/file_upload/server/routes/file_upload.js b/x-pack/plugins/maps_file_upload/server/routes/file_upload.js similarity index 100% rename from x-pack/plugins/file_upload/server/routes/file_upload.js rename to x-pack/plugins/maps_file_upload/server/routes/file_upload.js diff --git a/x-pack/plugins/file_upload/server/routes/file_upload.test.js b/x-pack/plugins/maps_file_upload/server/routes/file_upload.test.js similarity index 100% rename from x-pack/plugins/file_upload/server/routes/file_upload.test.js rename to x-pack/plugins/maps_file_upload/server/routes/file_upload.test.js diff --git a/x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts b/x-pack/plugins/maps_file_upload/server/telemetry/file_upload_usage_collector.ts similarity index 100% rename from x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts rename to x-pack/plugins/maps_file_upload/server/telemetry/file_upload_usage_collector.ts diff --git a/x-pack/plugins/file_upload/server/telemetry/index.ts b/x-pack/plugins/maps_file_upload/server/telemetry/index.ts similarity index 100% rename from x-pack/plugins/file_upload/server/telemetry/index.ts rename to x-pack/plugins/maps_file_upload/server/telemetry/index.ts diff --git a/x-pack/plugins/file_upload/server/telemetry/mappings.ts b/x-pack/plugins/maps_file_upload/server/telemetry/mappings.ts similarity index 100% rename from x-pack/plugins/file_upload/server/telemetry/mappings.ts rename to x-pack/plugins/maps_file_upload/server/telemetry/mappings.ts diff --git a/x-pack/plugins/file_upload/server/telemetry/telemetry.test.ts b/x-pack/plugins/maps_file_upload/server/telemetry/telemetry.test.ts similarity index 100% rename from x-pack/plugins/file_upload/server/telemetry/telemetry.test.ts rename to x-pack/plugins/maps_file_upload/server/telemetry/telemetry.test.ts diff --git a/x-pack/plugins/file_upload/server/telemetry/telemetry.ts b/x-pack/plugins/maps_file_upload/server/telemetry/telemetry.ts similarity index 100% rename from x-pack/plugins/file_upload/server/telemetry/telemetry.ts rename to x-pack/plugins/maps_file_upload/server/telemetry/telemetry.ts From 005170b613406ac4ac32090c12c3ee4e6d2be438 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 25 Jan 2021 14:16:54 -0700 Subject: [PATCH 02/19] update plugins list --- docs/developer/plugin-list.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index ef3492a545b6a..7efccd0929ca3 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -77,7 +77,7 @@ by the user. The final output of the expression pipeline can be rendered using one of the *renderers* registered in `expressions` plugin. All the arguments to expression functions need to be serializable, as well as input and output. -Expression functions should try to stay 'pure'. This makes functions easy to reuse and also +Expression functions should try to stay 'pure'. This makes functions easy to reuse and also make it possible to serialize the whole chain as well as output at every step of execution. Expressions power visualizations in Dashboard and Lens, as well as, every @@ -380,7 +380,7 @@ and actions. |The features plugin enhance Kibana with a per-feature privilege system. -|{kib-repo}blob/{branch}/x-pack/plugins/file_upload/README.md[fileUpload] +|{kib-repo}blob/{branch}/x-pack/plugins/maps_file_upload/README.md[mapsFileUpload] |Backend and core front-end react-components for GeoJson file upload. Only supports the Maps plugin. From be1e122e5fceae1c0e3d2ae5c954b9c63dbad949 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 25 Jan 2021 14:40:39 -0700 Subject: [PATCH 03/19] migrate ml import endpoint --- .../common/constants.ts} | 0 x-pack/plugins/file_upload/common/index.ts | 7 ++ x-pack/plugins/file_upload/jest.config.js | 11 +++ x-pack/plugins/file_upload/kibana.json | 8 ++ .../file_upload/server/error_wrapper.ts | 23 +++++ .../server}/import_data.ts | 5 +- x-pack/plugins/file_upload/server/index.ts | 9 ++ x-pack/plugins/file_upload/server/plugin.ts | 16 ++++ x-pack/plugins/file_upload/server/routes.ts | 85 ++++++++++++++++++ x-pack/plugins/file_upload/server/schemas.ts | 24 +++++ .../file_error_callouts.tsx | 2 +- .../file_based/components/utils/utils.ts | 2 +- .../ml/server/lib/register_settings.ts | 2 +- .../data_frame_analytics/analytics_manager.ts | 2 +- .../models/file_data_visualizer/index.ts | 2 - .../ml/server/routes/file_data_visualizer.ts | 89 +------------------ 16 files changed, 194 insertions(+), 93 deletions(-) rename x-pack/plugins/{ml/common/constants/file_datavisualizer.ts => file_upload/common/constants.ts} (100%) create mode 100644 x-pack/plugins/file_upload/common/index.ts create mode 100644 x-pack/plugins/file_upload/jest.config.js create mode 100644 x-pack/plugins/file_upload/kibana.json create mode 100644 x-pack/plugins/file_upload/server/error_wrapper.ts rename x-pack/plugins/{ml/server/models/file_data_visualizer => file_upload/server}/import_data.ts (98%) create mode 100644 x-pack/plugins/file_upload/server/index.ts create mode 100644 x-pack/plugins/file_upload/server/plugin.ts create mode 100644 x-pack/plugins/file_upload/server/routes.ts create mode 100644 x-pack/plugins/file_upload/server/schemas.ts diff --git a/x-pack/plugins/ml/common/constants/file_datavisualizer.ts b/x-pack/plugins/file_upload/common/constants.ts similarity index 100% rename from x-pack/plugins/ml/common/constants/file_datavisualizer.ts rename to x-pack/plugins/file_upload/common/constants.ts diff --git a/x-pack/plugins/file_upload/common/index.ts b/x-pack/plugins/file_upload/common/index.ts new file mode 100644 index 0000000000000..358d0d5b7e076 --- /dev/null +++ b/x-pack/plugins/file_upload/common/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './constants'; diff --git a/x-pack/plugins/file_upload/jest.config.js b/x-pack/plugins/file_upload/jest.config.js new file mode 100644 index 0000000000000..6a042a4cc5c1e --- /dev/null +++ b/x-pack/plugins/file_upload/jest.config.js @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/x-pack/plugins/file_upload'], +}; diff --git a/x-pack/plugins/file_upload/kibana.json b/x-pack/plugins/file_upload/kibana.json new file mode 100644 index 0000000000000..7676a01d0b0f9 --- /dev/null +++ b/x-pack/plugins/file_upload/kibana.json @@ -0,0 +1,8 @@ +{ + "id": "fileUpload", + "version": "8.0.0", + "kibanaVersion": "kibana", + "server": true, + "ui": true, + "requiredPlugins": ["data", "usageCollection"] +} diff --git a/x-pack/plugins/file_upload/server/error_wrapper.ts b/x-pack/plugins/file_upload/server/error_wrapper.ts new file mode 100644 index 0000000000000..fb41d30e34fae --- /dev/null +++ b/x-pack/plugins/file_upload/server/error_wrapper.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { boomify, isBoom } from '@hapi/boom'; +import { ResponseError, CustomHttpResponseOptions } from 'kibana/server'; + +export function wrapError(error: any): CustomHttpResponseOptions { + const boom = isBoom(error) + ? error + : boomify(error, { statusCode: error.status ?? error.statusCode }); + const statusCode = boom.output.statusCode; + return { + body: { + message: boom, + ...(statusCode !== 500 && error.body ? { attributes: { body: error.body } } : {}), + }, + headers: boom.output.headers as { [key: string]: string }, + statusCode, + }; +} diff --git a/x-pack/plugins/ml/server/models/file_data_visualizer/import_data.ts b/x-pack/plugins/file_upload/server/import_data.ts similarity index 98% rename from x-pack/plugins/ml/server/models/file_data_visualizer/import_data.ts rename to x-pack/plugins/file_upload/server/import_data.ts index 26dba7c2f00c1..3d7a516e1474c 100644 --- a/x-pack/plugins/ml/server/models/file_data_visualizer/import_data.ts +++ b/x-pack/plugins/file_upload/server/import_data.ts @@ -5,7 +5,7 @@ */ import { IScopedClusterClient } from 'kibana/server'; -import { INDEX_META_DATA_CREATED_BY } from '../../../common/constants/file_datavisualizer'; +import { INDEX_META_DATA_CREATED_BY } from '../../../common/constants'; import { ImportResponse, ImportFailure, @@ -13,7 +13,8 @@ import { Mappings, IngestPipelineWrapper, } from '../../../common/types/file_datavisualizer'; -import { InputData } from './file_data_visualizer'; + +export type InputData = any[]; export function importDataProvider({ asCurrentUser }: IScopedClusterClient) { async function importData( diff --git a/x-pack/plugins/file_upload/server/index.ts b/x-pack/plugins/file_upload/server/index.ts new file mode 100644 index 0000000000000..d9d0b4bf4d69e --- /dev/null +++ b/x-pack/plugins/file_upload/server/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { PluginInitializerContext } from 'src/core/server'; +import { FileUploadPlugin } from './plugin'; + +export const plugin = (ctx: PluginInitializerContext) => new FileUploadPlugin(ctx); diff --git a/x-pack/plugins/file_upload/server/plugin.ts b/x-pack/plugins/file_upload/server/plugin.ts new file mode 100644 index 0000000000000..8f36de013fb37 --- /dev/null +++ b/x-pack/plugins/file_upload/server/plugin.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from 'src/core/server'; +import { fileUploadRoutes } from './routes'; + +export class FileUploadPlugin implements Plugin { + async setup(core: CoreSetup, plugins: SetupDeps) { + fileUploadRoutes(coreSetup.http.createRouter()); + } + + start(core: CoreStart) {} +} diff --git a/x-pack/plugins/file_upload/server/routes.ts b/x-pack/plugins/file_upload/server/routes.ts new file mode 100644 index 0000000000000..aff84dd37d1d0 --- /dev/null +++ b/x-pack/plugins/file_upload/server/routes.ts @@ -0,0 +1,85 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { IRouter, IScopedClusterClient } from 'kibana/server'; +import { MAX_FILE_SIZE_BYTES } from '../../common/constants'; +import { wrapError } from './error_wrapper'; +import { InputData, importDataProvider } from './import_data'; + +import { RouteInitialization } from '../types'; +import { updateTelemetry } from '../lib/telemetry'; +import { importFileBodySchema, importFileQuerySchema } from './schemas'; + +function importData( + client: IScopedClusterClient, + id: string, + index: string, + settings: Settings, + mappings: Mappings, + ingestPipeline: IngestPipelineWrapper, + data: InputData +) { + const { importData: importDataFunc } = importDataProvider(client); + return importDataFunc(id, index, settings, mappings, ingestPipeline, data); +} + +/** + * Routes for the file upload. + */ +export function fileUploadRoutes(router: IRouter) { + /** + * @apiGroup FileDataVisualizer + * + * @api {post} /api/ml/file_data_visualizer/import Import file data + * @apiName ImportFile + * @apiDescription Imports file data into elasticsearch index. + * + * @apiSchema (query) importFileQuerySchema + * @apiSchema (body) importFileBodySchema + */ + router.post( + { + path: '/api/ml/file_data_visualizer/import', + validate: { + query: importFileQuerySchema, + body: importFileBodySchema, + }, + options: { + body: { + accepts: ['application/json'], + maxBytes: MAX_FILE_SIZE_BYTES, + }, + tags: ['access:ml:canFindFileStructure'], + }, + }, + async ({ context, request, response }) => { + try { + const { id } = request.query; + const { index, data, settings, mappings, ingestPipeline } = request.body; + + // `id` being `undefined` tells us that this is a new import due to create a new index. + // follow-up import calls to just add additional data will include the `id` of the created + // index, we'll ignore those and don't increment the counter. + if (id === undefined) { + await updateTelemetry(); + } + + const result = await importData( + context.core.elasticsearch.client, + id, + index, + settings, + mappings, + ingestPipeline, + data + ); + return response.ok({ body: result }); + } catch (e) { + return response.customError(wrapError(e)); + } + } + ); +} diff --git a/x-pack/plugins/file_upload/server/schemas.ts b/x-pack/plugins/file_upload/server/schemas.ts new file mode 100644 index 0000000000000..f0799065e0d61 --- /dev/null +++ b/x-pack/plugins/file_upload/server/schemas.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { schema } from '@kbn/config-schema'; + +export const importFileQuerySchema = schema.object({ + id: schema.maybe(schema.string()), +}); + +export const importFileBodySchema = schema.object({ + index: schema.maybe(schema.string()), + data: schema.arrayOf(schema.any()), + settings: schema.maybe(schema.any()), + /** Mappings */ + mappings: schema.any(), + /** Ingest pipeline definition */ + ingestPipeline: schema.object({ + id: schema.maybe(schema.string()), + pipeline: schema.maybe(schema.any()), + }), +}); diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.tsx b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.tsx index d869676e48827..0c853493293ca 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.tsx @@ -11,7 +11,7 @@ import { EuiCallOut, EuiSpacer, EuiButtonEmpty, EuiHorizontalRule } from '@elast import numeral from '@elastic/numeral'; import { ErrorResponse } from '../../../../../../common/types/errors'; -import { FILE_SIZE_DISPLAY_FORMAT } from '../../../../../../common/constants/file_datavisualizer'; +import { FILE_SIZE_DISPLAY_FORMAT } from '../../../../../../../file_upload/common'; interface FileTooLargeProps { fileSize: number; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.ts b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.ts index 781f400180b10..ce15fb9a03fca 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.ts +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.ts @@ -14,7 +14,7 @@ import { MAX_FILE_SIZE_BYTES, ABSOLUTE_MAX_FILE_SIZE_BYTES, FILE_SIZE_DISPLAY_FORMAT, -} from '../../../../../../common/constants/file_datavisualizer'; +} from '../../../../../../../file_upload/common'; import { getUiSettings } from '../../../../util/dependency_cache'; import { FILE_DATA_VISUALIZER_MAX_FILE_SIZE } from '../../../../../../common/constants/settings'; diff --git a/x-pack/plugins/ml/server/lib/register_settings.ts b/x-pack/plugins/ml/server/lib/register_settings.ts index 0cdaaadf7f172..4db2f80633480 100644 --- a/x-pack/plugins/ml/server/lib/register_settings.ts +++ b/x-pack/plugins/ml/server/lib/register_settings.ts @@ -14,7 +14,7 @@ import { DEFAULT_AD_RESULTS_TIME_FILTER, DEFAULT_ENABLE_AD_RESULTS_TIME_FILTER, } from '../../common/constants/settings'; -import { MAX_FILE_SIZE } from '../../common/constants/file_datavisualizer'; +import { MAX_FILE_SIZE } from '../../../file_upload/common'; export function registerKibanaSettings(coreSetup: CoreSetup) { coreSetup.uiSettings.register({ diff --git a/x-pack/plugins/ml/server/models/data_frame_analytics/analytics_manager.ts b/x-pack/plugins/ml/server/models/data_frame_analytics/analytics_manager.ts index ea41fb3ae427b..3f9587749d33d 100644 --- a/x-pack/plugins/ml/server/models/data_frame_analytics/analytics_manager.ts +++ b/x-pack/plugins/ml/server/models/data_frame_analytics/analytics_manager.ts @@ -18,7 +18,7 @@ import { DataFrameAnalyticsStats, MapElements, } from '../../../common/types/data_frame_analytics'; -import { INDEX_META_DATA_CREATED_BY } from '../../../common/constants/file_datavisualizer'; +import { INDEX_META_DATA_CREATED_BY } from '../../../../file_upload/common'; import { getAnalysisType } from '../../../common/util/analytics_utils'; import { ExtendAnalyticsMapArgs, diff --git a/x-pack/plugins/ml/server/models/file_data_visualizer/index.ts b/x-pack/plugins/ml/server/models/file_data_visualizer/index.ts index f8a27fdcd7e1a..aa699694e52a3 100644 --- a/x-pack/plugins/ml/server/models/file_data_visualizer/index.ts +++ b/x-pack/plugins/ml/server/models/file_data_visualizer/index.ts @@ -5,5 +5,3 @@ */ export { fileDataVisualizerProvider, InputData } from './file_data_visualizer'; - -export { importDataProvider } from './import_data'; diff --git a/x-pack/plugins/ml/server/routes/file_data_visualizer.ts b/x-pack/plugins/ml/server/routes/file_data_visualizer.ts index c4c449a9e2cb4..9ee19efef13f5 100644 --- a/x-pack/plugins/ml/server/routes/file_data_visualizer.ts +++ b/x-pack/plugins/ml/server/routes/file_data_visualizer.ts @@ -5,28 +5,13 @@ */ import { schema } from '@kbn/config-schema'; -import { IScopedClusterClient } from 'kibana/server'; -import { MAX_FILE_SIZE_BYTES } from '../../common/constants/file_datavisualizer'; -import { - InputOverrides, - Settings, - IngestPipelineWrapper, - Mappings, -} from '../../common/types/file_datavisualizer'; +import { MAX_FILE_SIZE_BYTES } from '../../../file_upload/common'; +import { InputOverrides } from '../../common/types/file_datavisualizer'; import { wrapError } from '../client/error_wrapper'; -import { - InputData, - fileDataVisualizerProvider, - importDataProvider, -} from '../models/file_data_visualizer'; +import { InputData, fileDataVisualizerProvider } from '../models/file_data_visualizer'; import { RouteInitialization } from '../types'; -import { updateTelemetry } from '../lib/telemetry'; -import { - analyzeFileQuerySchema, - importFileBodySchema, - importFileQuerySchema, -} from './schemas/file_data_visualizer_schema'; +import { analyzeFileQuerySchema } from './schemas/file_data_visualizer_schema'; import type { MlClient } from '../lib/ml_client'; function analyzeFiles(mlClient: MlClient, data: InputData, overrides: InputOverrides) { @@ -34,19 +19,6 @@ function analyzeFiles(mlClient: MlClient, data: InputData, overrides: InputOverr return analyzeFile(data, overrides); } -function importData( - client: IScopedClusterClient, - id: string, - index: string, - settings: Settings, - mappings: Mappings, - ingestPipeline: IngestPipelineWrapper, - data: InputData -) { - const { importData: importDataFunc } = importDataProvider(client); - return importDataFunc(id, index, settings, mappings, ingestPipeline, data); -} - /** * Routes for the file data visualizer. */ @@ -84,57 +56,4 @@ export function fileDataVisualizerRoutes({ router, routeGuard }: RouteInitializa } }) ); - - /** - * @apiGroup FileDataVisualizer - * - * @api {post} /api/ml/file_data_visualizer/import Import file data - * @apiName ImportFile - * @apiDescription Imports file data into elasticsearch index. - * - * @apiSchema (query) importFileQuerySchema - * @apiSchema (body) importFileBodySchema - */ - router.post( - { - path: '/api/ml/file_data_visualizer/import', - validate: { - query: importFileQuerySchema, - body: importFileBodySchema, - }, - options: { - body: { - accepts: ['application/json'], - maxBytes: MAX_FILE_SIZE_BYTES, - }, - tags: ['access:ml:canFindFileStructure'], - }, - }, - routeGuard.basicLicenseAPIGuard(async ({ client, request, response }) => { - try { - const { id } = request.query; - const { index, data, settings, mappings, ingestPipeline } = request.body; - - // `id` being `undefined` tells us that this is a new import due to create a new index. - // follow-up import calls to just add additional data will include the `id` of the created - // index, we'll ignore those and don't increment the counter. - if (id === undefined) { - await updateTelemetry(); - } - - const result = await importData( - client, - id, - index, - settings, - mappings, - ingestPipeline, - data - ); - return response.ok({ body: result }); - } catch (e) { - return response.customError(wrapError(e)); - } - }) - ); } From 179e7ff23b6d9184fed66f7327b75a1a6d4e5364 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 27 Jan 2021 14:12:20 -0700 Subject: [PATCH 04/19] migrate ml telemetry to file_upload plugin --- x-pack/plugins/file_upload/kibana.json | 8 ++++++++ .../plugins/file_upload/server/import_data.ts | 2 +- x-pack/plugins/file_upload/server/plugin.ts | 3 +++ x-pack/plugins/file_upload/server/routes.ts | 9 ++++----- .../telemetry/file_upload_usage_collector.ts} | 18 +++++++++--------- .../server}/telemetry/index.ts | 2 +- .../server}/telemetry/internal_repository.ts | 0 .../server}/telemetry/mappings.ts | 4 ++-- .../server}/telemetry/telemetry.test.ts | 2 +- .../server}/telemetry/telemetry.ts | 8 ++++---- x-pack/plugins/ml/server/plugin.ts | 2 -- 11 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 x-pack/plugins/file_upload/kibana.json rename x-pack/plugins/{ml/server/lib/telemetry/ml_usage_collector.ts => file_upload/server/telemetry/file_upload_usage_collector.ts} (63%) rename x-pack/plugins/{ml/server/lib => file_upload/server}/telemetry/index.ts (83%) rename x-pack/plugins/{ml/server/lib => file_upload/server}/telemetry/internal_repository.ts (100%) rename x-pack/plugins/{ml/server/lib => file_upload/server}/telemetry/mappings.ts (86%) rename x-pack/plugins/{ml/server/lib => file_upload/server}/telemetry/telemetry.test.ts (97%) rename x-pack/plugins/{ml/server/lib => file_upload/server}/telemetry/telemetry.ts (91%) diff --git a/x-pack/plugins/file_upload/kibana.json b/x-pack/plugins/file_upload/kibana.json new file mode 100644 index 0000000000000..8479142704f14 --- /dev/null +++ b/x-pack/plugins/file_upload/kibana.json @@ -0,0 +1,8 @@ +{ + "id": "fileUpload", + "version": "8.0.0", + "kibanaVersion": "kibana", + "server": true, + "ui": true, + "requiredPlugins": ["usageCollection"] +} diff --git a/x-pack/plugins/file_upload/server/import_data.ts b/x-pack/plugins/file_upload/server/import_data.ts index 3d7a516e1474c..051ce75f94962 100644 --- a/x-pack/plugins/file_upload/server/import_data.ts +++ b/x-pack/plugins/file_upload/server/import_data.ts @@ -5,7 +5,7 @@ */ import { IScopedClusterClient } from 'kibana/server'; -import { INDEX_META_DATA_CREATED_BY } from '../../../common/constants'; +import { INDEX_META_DATA_CREATED_BY } from '../common/constants'; import { ImportResponse, ImportFailure, diff --git a/x-pack/plugins/file_upload/server/plugin.ts b/x-pack/plugins/file_upload/server/plugin.ts index 8f36de013fb37..51a175666113c 100644 --- a/x-pack/plugins/file_upload/server/plugin.ts +++ b/x-pack/plugins/file_upload/server/plugin.ts @@ -6,10 +6,13 @@ import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from 'src/core/server'; import { fileUploadRoutes } from './routes'; +import { initTelemetry } from './telemetry'; export class FileUploadPlugin implements Plugin { async setup(core: CoreSetup, plugins: SetupDeps) { fileUploadRoutes(coreSetup.http.createRouter()); + + initTelemetry(coreSetup, plugins.usageCollection); } start(core: CoreStart) {} diff --git a/x-pack/plugins/file_upload/server/routes.ts b/x-pack/plugins/file_upload/server/routes.ts index aff84dd37d1d0..681fc7a94abb5 100644 --- a/x-pack/plugins/file_upload/server/routes.ts +++ b/x-pack/plugins/file_upload/server/routes.ts @@ -5,12 +5,11 @@ */ import { IRouter, IScopedClusterClient } from 'kibana/server'; -import { MAX_FILE_SIZE_BYTES } from '../../common/constants'; +import { MAX_FILE_SIZE_BYTES } from '../common/constants'; import { wrapError } from './error_wrapper'; import { InputData, importDataProvider } from './import_data'; -import { RouteInitialization } from '../types'; -import { updateTelemetry } from '../lib/telemetry'; +import { updateTelemetry } from './telemetry'; import { importFileBodySchema, importFileQuerySchema } from './schemas'; function importData( @@ -33,7 +32,7 @@ export function fileUploadRoutes(router: IRouter) { /** * @apiGroup FileDataVisualizer * - * @api {post} /api/ml/file_data_visualizer/import Import file data + * @api {post} /api/file_upload/import Import file data * @apiName ImportFile * @apiDescription Imports file data into elasticsearch index. * @@ -42,7 +41,7 @@ export function fileUploadRoutes(router: IRouter) { */ router.post( { - path: '/api/ml/file_data_visualizer/import', + path: '/api/file_upload/import', validate: { query: importFileQuerySchema, body: importFileBodySchema, diff --git a/x-pack/plugins/ml/server/lib/telemetry/ml_usage_collector.ts b/x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts similarity index 63% rename from x-pack/plugins/ml/server/lib/telemetry/ml_usage_collector.ts rename to x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts index 35c6936598c40..09a3779a818c9 100644 --- a/x-pack/plugins/ml/server/lib/telemetry/ml_usage_collector.ts +++ b/x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts @@ -8,23 +8,23 @@ import { CoreSetup } from 'kibana/server'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { getTelemetry, initTelemetry, Telemetry } from './telemetry'; -import { mlTelemetryMappingsType } from './mappings'; +import { telemetryMappingsType } from './mappings'; import { setInternalRepository } from './internal_repository'; -export function initMlTelemetry(coreSetup: CoreSetup, usageCollection: UsageCollectionSetup) { - coreSetup.savedObjects.registerType(mlTelemetryMappingsType); - registerMlUsageCollector(usageCollection); +export function initTelemetry(coreSetup: CoreSetup, usageCollection: UsageCollectionSetup) { + coreSetup.savedObjects.registerType(telemetryMappingsType); + registerUsageCollector(usageCollection); coreSetup.getStartServices().then(([core]) => { setInternalRepository(core.savedObjects.createInternalRepository); }); } -function registerMlUsageCollector(usageCollection: UsageCollectionSetup): void { - const mlUsageCollector = usageCollection.makeUsageCollector({ - type: 'mlTelemetry', +function registerUsageCollector(usageCollectionSetup: UsageCollectionSetup): void { + const usageCollector = usageCollectionSetup.makeUsageCollector({ + type: 'fileUpload', isReady: () => true, schema: { - file_data_visualizer: { + file_upload: { index_creation_count: { type: 'long' }, }, }, @@ -38,5 +38,5 @@ function registerMlUsageCollector(usageCollection: UsageCollectionSetup): void { }, }); - usageCollection.registerCollector(mlUsageCollector); + usageCollectionSetup.registerCollector(usageCollector); } diff --git a/x-pack/plugins/ml/server/lib/telemetry/index.ts b/x-pack/plugins/file_upload/server/telemetry/index.ts similarity index 83% rename from x-pack/plugins/ml/server/lib/telemetry/index.ts rename to x-pack/plugins/file_upload/server/telemetry/index.ts index b5ec80daf1787..df798d8e9243b 100644 --- a/x-pack/plugins/ml/server/lib/telemetry/index.ts +++ b/x-pack/plugins/file_upload/server/telemetry/index.ts @@ -4,5 +4,5 @@ * you may not use this file except in compliance with the Elastic License. */ -export { initMlTelemetry } from './ml_usage_collector'; +export { initTelemetry } from './usage_collector'; export { updateTelemetry } from './telemetry'; diff --git a/x-pack/plugins/ml/server/lib/telemetry/internal_repository.ts b/x-pack/plugins/file_upload/server/telemetry/internal_repository.ts similarity index 100% rename from x-pack/plugins/ml/server/lib/telemetry/internal_repository.ts rename to x-pack/plugins/file_upload/server/telemetry/internal_repository.ts diff --git a/x-pack/plugins/ml/server/lib/telemetry/mappings.ts b/x-pack/plugins/file_upload/server/telemetry/mappings.ts similarity index 86% rename from x-pack/plugins/ml/server/lib/telemetry/mappings.ts rename to x-pack/plugins/file_upload/server/telemetry/mappings.ts index 5aaf9f8c79dc0..3d22bcb4162fd 100644 --- a/x-pack/plugins/ml/server/lib/telemetry/mappings.ts +++ b/x-pack/plugins/file_upload/server/telemetry/mappings.ts @@ -7,13 +7,13 @@ import { SavedObjectsType } from 'src/core/server'; import { TELEMETRY_DOC_ID } from './telemetry'; -export const mlTelemetryMappingsType: SavedObjectsType = { +export const telemetryMappingsType: SavedObjectsType = { name: TELEMETRY_DOC_ID, hidden: false, namespaceType: 'agnostic', mappings: { properties: { - file_data_visualizer: { + file_upload: { properties: { index_creation_count: { type: 'long', diff --git a/x-pack/plugins/ml/server/lib/telemetry/telemetry.test.ts b/x-pack/plugins/file_upload/server/telemetry/telemetry.test.ts similarity index 97% rename from x-pack/plugins/ml/server/lib/telemetry/telemetry.test.ts rename to x-pack/plugins/file_upload/server/telemetry/telemetry.test.ts index f41c4fda93a54..2ad36338f4928 100644 --- a/x-pack/plugins/ml/server/lib/telemetry/telemetry.test.ts +++ b/x-pack/plugins/file_upload/server/telemetry/telemetry.test.ts @@ -34,7 +34,7 @@ describe('ml plugin telemetry', () => { it('should update existing telemetry', async () => { const internalRepo = mockInit({ attributes: { - file_data_visualizer: { + file_upload: { index_creation_count: 2, }, }, diff --git a/x-pack/plugins/ml/server/lib/telemetry/telemetry.ts b/x-pack/plugins/file_upload/server/telemetry/telemetry.ts similarity index 91% rename from x-pack/plugins/ml/server/lib/telemetry/telemetry.ts rename to x-pack/plugins/file_upload/server/telemetry/telemetry.ts index 06577d6937101..f273d2bbe4498 100644 --- a/x-pack/plugins/ml/server/lib/telemetry/telemetry.ts +++ b/x-pack/plugins/file_upload/server/telemetry/telemetry.ts @@ -12,7 +12,7 @@ import { getInternalRepository } from './internal_repository'; export const TELEMETRY_DOC_ID = 'ml-telemetry'; export interface Telemetry { - file_data_visualizer: { + file_upload: { index_creation_count: number; }; } @@ -23,7 +23,7 @@ export interface TelemetrySavedObject { export function initTelemetry(): Telemetry { return { - file_data_visualizer: { + file_upload: { index_creation_count: 0, }, }; @@ -74,8 +74,8 @@ export async function updateTelemetry(internalRepo?: ISavedObjectsRepository) { function incrementCounts(telemetry: Telemetry) { return { - file_data_visualizer: { - index_creation_count: telemetry.file_data_visualizer.index_creation_count + 1, + file_upload: { + index_creation_count: telemetry.file_upload.index_creation_count + 1, }, }; } diff --git a/x-pack/plugins/ml/server/plugin.ts b/x-pack/plugins/ml/server/plugin.ts index e48983c1c5365..3c82f2131e25f 100644 --- a/x-pack/plugins/ml/server/plugin.ts +++ b/x-pack/plugins/ml/server/plugin.ts @@ -23,7 +23,6 @@ import { SpacesPluginSetup } from '../../spaces/server'; import { PLUGIN_ID } from '../common/constants/app'; import { MlCapabilities } from '../common/types/capabilities'; -import { initMlTelemetry } from './lib/telemetry'; import { initMlServerLog } from './lib/log'; import { initSampleDataSets } from './lib/sample_data_sets'; @@ -190,7 +189,6 @@ export class MlServerPlugin trainedModelsRoutes(routeInit); initMlServerLog({ log: this.log }); - initMlTelemetry(coreSetup, plugins.usageCollection); return { ...createSharedServices( From 1da202324a354b62b64f73ee39b2df94f13ea899 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 27 Jan 2021 14:50:48 -0700 Subject: [PATCH 05/19] add fileUpload plugin to ml --- x-pack/plugins/ml/kibana.json | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/ml/kibana.json b/x-pack/plugins/ml/kibana.json index 1c47512e0b3de..f3e91efb5c6b0 100644 --- a/x-pack/plugins/ml/kibana.json +++ b/x-pack/plugins/ml/kibana.json @@ -10,6 +10,7 @@ "data", "cloud", "features", + "fileUpload", "licensing", "usageCollection", "share", From 4d9680c63835f0fd8b11014d45b3914422944ff0 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 27 Jan 2021 15:15:53 -0700 Subject: [PATCH 06/19] add TS project --- x-pack/plugins/file_upload/jest.config.js | 11 +++++++++++ x-pack/plugins/file_upload/kibana.json | 2 +- x-pack/plugins/file_upload/server/plugin.ts | 8 ++++---- .../plugins/file_upload/server/telemetry/index.ts | 2 +- ...load_usage_collector.ts => usage_collector.ts} | 5 ++++- x-pack/plugins/file_upload/tsconfig.json | 15 +++++++++++++++ x-pack/tsconfig.json | 2 ++ x-pack/tsconfig.refs.json | 1 + 8 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 x-pack/plugins/file_upload/jest.config.js rename x-pack/plugins/file_upload/server/telemetry/{file_upload_usage_collector.ts => usage_collector.ts} (92%) create mode 100644 x-pack/plugins/file_upload/tsconfig.json diff --git a/x-pack/plugins/file_upload/jest.config.js b/x-pack/plugins/file_upload/jest.config.js new file mode 100644 index 0000000000000..6a042a4cc5c1e --- /dev/null +++ b/x-pack/plugins/file_upload/jest.config.js @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/x-pack/plugins/file_upload'], +}; diff --git a/x-pack/plugins/file_upload/kibana.json b/x-pack/plugins/file_upload/kibana.json index 8479142704f14..7ca024174ec6a 100644 --- a/x-pack/plugins/file_upload/kibana.json +++ b/x-pack/plugins/file_upload/kibana.json @@ -3,6 +3,6 @@ "version": "8.0.0", "kibanaVersion": "kibana", "server": true, - "ui": true, + "ui": false, "requiredPlugins": ["usageCollection"] } diff --git a/x-pack/plugins/file_upload/server/plugin.ts b/x-pack/plugins/file_upload/server/plugin.ts index 51a175666113c..cb538d1953a1a 100644 --- a/x-pack/plugins/file_upload/server/plugin.ts +++ b/x-pack/plugins/file_upload/server/plugin.ts @@ -4,15 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from 'src/core/server'; +import { CoreSetup, CoreStart, Plugin } from 'src/core/server'; import { fileUploadRoutes } from './routes'; -import { initTelemetry } from './telemetry'; +import { initFileUploadTelemetry } from './telemetry'; export class FileUploadPlugin implements Plugin { - async setup(core: CoreSetup, plugins: SetupDeps) { + async setup(coreSetup: CoreSetup, plugins: SetupDeps) { fileUploadRoutes(coreSetup.http.createRouter()); - initTelemetry(coreSetup, plugins.usageCollection); + initFileUploadTelemetry(coreSetup, plugins.usageCollection); } start(core: CoreStart) {} diff --git a/x-pack/plugins/file_upload/server/telemetry/index.ts b/x-pack/plugins/file_upload/server/telemetry/index.ts index df798d8e9243b..92d8ab425a773 100644 --- a/x-pack/plugins/file_upload/server/telemetry/index.ts +++ b/x-pack/plugins/file_upload/server/telemetry/index.ts @@ -4,5 +4,5 @@ * you may not use this file except in compliance with the Elastic License. */ -export { initTelemetry } from './usage_collector'; +export { initFileUploadTelemetry } from './usage_collector'; export { updateTelemetry } from './telemetry'; diff --git a/x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts b/x-pack/plugins/file_upload/server/telemetry/usage_collector.ts similarity index 92% rename from x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts rename to x-pack/plugins/file_upload/server/telemetry/usage_collector.ts index 09a3779a818c9..4a1334ef53d95 100644 --- a/x-pack/plugins/file_upload/server/telemetry/file_upload_usage_collector.ts +++ b/x-pack/plugins/file_upload/server/telemetry/usage_collector.ts @@ -11,7 +11,10 @@ import { getTelemetry, initTelemetry, Telemetry } from './telemetry'; import { telemetryMappingsType } from './mappings'; import { setInternalRepository } from './internal_repository'; -export function initTelemetry(coreSetup: CoreSetup, usageCollection: UsageCollectionSetup) { +export function initFileUploadTelemetry( + coreSetup: CoreSetup, + usageCollection: UsageCollectionSetup +) { coreSetup.savedObjects.registerType(telemetryMappingsType); registerUsageCollector(usageCollection); coreSetup.getStartServices().then(([core]) => { diff --git a/x-pack/plugins/file_upload/tsconfig.json b/x-pack/plugins/file_upload/tsconfig.json new file mode 100644 index 0000000000000..f985a4599d5fe --- /dev/null +++ b/x-pack/plugins/file_upload/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["common/**/*", "public/**/*", "server/**/*"], + "references": [ + { "path": "../../../src/core/tsconfig.json" }, + { "path": "../../../src/plugins/usage_collection/tsconfig.json" } + ] +} diff --git a/x-pack/tsconfig.json b/x-pack/tsconfig.json index 4975dcfe885ab..04b33324c8a5b 100644 --- a/x-pack/tsconfig.json +++ b/x-pack/tsconfig.json @@ -15,6 +15,7 @@ "plugins/global_search_providers/**/*", "plugins/graph/**/*", "plugins/features/**/*", + "plugins/file_upload/**/*", "plugins/embeddable_enhanced/**/*", "plugins/event_log/**/*", "plugins/licensing/**/*", @@ -84,6 +85,7 @@ { "path": "./plugins/global_search/tsconfig.json" }, { "path": "./plugins/global_search_providers/tsconfig.json" }, { "path": "./plugins/features/tsconfig.json" }, + { "path": "./plugins/file_upload/tsconfig.json" }, { "path": "./plugins/graph/tsconfig.json" }, { "path": "./plugins/embeddable_enhanced/tsconfig.json" }, { "path": "./plugins/event_log/tsconfig.json" }, diff --git a/x-pack/tsconfig.refs.json b/x-pack/tsconfig.refs.json index fcbc4d40530e1..b36af959d3748 100644 --- a/x-pack/tsconfig.refs.json +++ b/x-pack/tsconfig.refs.json @@ -13,6 +13,7 @@ { "path": "./plugins/global_search_providers/tsconfig.json" }, { "path": "./plugins/event_log/tsconfig.json"}, { "path": "./plugins/features/tsconfig.json" }, + { "path": "./plugins/file_upload/tsconfig.json" }, { "path": "./plugins/graph/tsconfig.json" }, { "path": "./plugins/embeddable_enhanced/tsconfig.json" }, { "path": "./plugins/maps/tsconfig.json" }, From 044ec4f62881767a4ede2e04908d6974eaa8817d Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 13:36:06 -0700 Subject: [PATCH 07/19] update ML to use file_upload endpoint --- x-pack/plugins/file_upload/server/routes.ts | 2 +- x-pack/plugins/maps_file_upload/public/util/indexing_service.js | 2 +- x-pack/plugins/maps_file_upload/server/routes/file_upload.js | 2 +- .../application/services/ml_api_service/datavisualizer.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/file_upload/server/routes.ts b/x-pack/plugins/file_upload/server/routes.ts index 681fc7a94abb5..c90b44fed722b 100644 --- a/x-pack/plugins/file_upload/server/routes.ts +++ b/x-pack/plugins/file_upload/server/routes.ts @@ -54,7 +54,7 @@ export function fileUploadRoutes(router: IRouter) { tags: ['access:ml:canFindFileStructure'], }, }, - async ({ context, request, response }) => { + async (context, request, response) => { try { const { id } = request.query; const { index, data, settings, mappings, ingestPipeline } = request.body; diff --git a/x-pack/plugins/maps_file_upload/public/util/indexing_service.js b/x-pack/plugins/maps_file_upload/public/util/indexing_service.js index e02d2a9ce770f..f6b5a1c1891e1 100644 --- a/x-pack/plugins/maps_file_upload/public/util/indexing_service.js +++ b/x-pack/plugins/maps_file_upload/public/util/indexing_service.js @@ -119,7 +119,7 @@ async function writeToIndex(indexingDetails) { const { appName, index, data, settings, mappings, ingestPipeline } = indexingDetails; return await httpService({ - url: `/api/fileupload/import`, + url: `/api/maps/fileupload/import`, method: 'POST', ...(query ? { query } : {}), data: { diff --git a/x-pack/plugins/maps_file_upload/server/routes/file_upload.js b/x-pack/plugins/maps_file_upload/server/routes/file_upload.js index 3935d4ca5fe8e..0323f23a51df5 100644 --- a/x-pack/plugins/maps_file_upload/server/routes/file_upload.js +++ b/x-pack/plugins/maps_file_upload/server/routes/file_upload.js @@ -9,7 +9,7 @@ import { updateTelemetry } from '../telemetry/telemetry'; import { MAX_BYTES } from '../../common/constants/file_import'; import { schema } from '@kbn/config-schema'; -export const IMPORT_ROUTE = '/api/fileupload/import'; +export const IMPORT_ROUTE = '/api/maps/fileupload/import'; export const querySchema = schema.maybe( schema.object({ diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts index 20332546d9cde..81455718f034f 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts @@ -45,7 +45,7 @@ export const fileDatavisualizer = { }); return http({ - path: `${basePath()}/file_data_visualizer/import`, + path: `/api/file_upload/import`, method: 'POST', query, body, From de0ce16d3a4cb960218a4b13c5e19e87bc60dcdc Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 14:03:50 -0700 Subject: [PATCH 08/19] move types to file_upload plugin --- x-pack/plugins/file_upload/common/index.ts | 1 + x-pack/plugins/file_upload/common/types.ts | 54 +++++++++++++++++++ .../plugins/file_upload/server/import_data.ts | 6 +-- x-pack/plugins/file_upload/server/index.ts | 4 +- x-pack/plugins/file_upload/server/plugin.ts | 5 ++ x-pack/plugins/file_upload/server/routes.ts | 4 +- x-pack/plugins/file_upload/server/schemas.ts | 6 +-- .../ml/common/types/file_datavisualizer.ts | 49 ----------------- .../components/combined_fields/utils.ts | 7 +-- .../import_view/importer/importer.ts | 2 +- .../import_view/importer/message_importer.ts | 6 +-- .../services/ml_api_service/datavisualizer.ts | 2 +- 12 files changed, 76 insertions(+), 70 deletions(-) create mode 100644 x-pack/plugins/file_upload/common/types.ts diff --git a/x-pack/plugins/file_upload/common/index.ts b/x-pack/plugins/file_upload/common/index.ts index 358d0d5b7e076..6c1725d61c059 100644 --- a/x-pack/plugins/file_upload/common/index.ts +++ b/x-pack/plugins/file_upload/common/index.ts @@ -5,3 +5,4 @@ */ export * from './constants'; +export * from './types'; diff --git a/x-pack/plugins/file_upload/common/types.ts b/x-pack/plugins/file_upload/common/types.ts new file mode 100644 index 0000000000000..229983f1c535a --- /dev/null +++ b/x-pack/plugins/file_upload/common/types.ts @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export interface ImportResponse { + success: boolean; + id: string; + index?: string; + pipelineId?: string; + docCount: number; + failures: ImportFailure[]; + error?: any; + ingestError?: boolean; +} + +export interface ImportFailure { + item: number; + reason: string; + doc: ImportDoc; +} + +export interface Doc { + message: string; +} + +export type ImportDoc = Doc | string; + +export interface Settings { + pipeline?: string; + index: string; + body: any[]; + [key: string]: any; +} + +export interface Mappings { + _meta?: { + created_by: string; + }; + properties: { + [key: string]: any; + }; +} + +export interface IngestPipelineWrapper { + id: string; + pipeline: IngestPipeline; +} + +export interface IngestPipeline { + description: string; + processors: any[]; +} diff --git a/x-pack/plugins/file_upload/server/import_data.ts b/x-pack/plugins/file_upload/server/import_data.ts index 051ce75f94962..1eb495d6570c2 100644 --- a/x-pack/plugins/file_upload/server/import_data.ts +++ b/x-pack/plugins/file_upload/server/import_data.ts @@ -12,13 +12,13 @@ import { Settings, Mappings, IngestPipelineWrapper, -} from '../../../common/types/file_datavisualizer'; +} from '../common'; export type InputData = any[]; export function importDataProvider({ asCurrentUser }: IScopedClusterClient) { async function importData( - id: string, + id: string | undefined, index: string, settings: Settings, mappings: Mappings, @@ -78,7 +78,7 @@ export function importDataProvider({ asCurrentUser }: IScopedClusterClient) { } catch (error) { return { success: false, - id, + id: id!, index: createdIndex, pipelineId: createdPipelineId, error: error.body !== undefined ? error.body : error, diff --git a/x-pack/plugins/file_upload/server/index.ts b/x-pack/plugins/file_upload/server/index.ts index d9d0b4bf4d69e..44a208b7924bc 100644 --- a/x-pack/plugins/file_upload/server/index.ts +++ b/x-pack/plugins/file_upload/server/index.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { PluginInitializerContext } from 'src/core/server'; + import { FileUploadPlugin } from './plugin'; -export const plugin = (ctx: PluginInitializerContext) => new FileUploadPlugin(ctx); +export const plugin = () => new FileUploadPlugin(); diff --git a/x-pack/plugins/file_upload/server/plugin.ts b/x-pack/plugins/file_upload/server/plugin.ts index cb538d1953a1a..eea3239e52d1c 100644 --- a/x-pack/plugins/file_upload/server/plugin.ts +++ b/x-pack/plugins/file_upload/server/plugin.ts @@ -7,6 +7,11 @@ import { CoreSetup, CoreStart, Plugin } from 'src/core/server'; import { fileUploadRoutes } from './routes'; import { initFileUploadTelemetry } from './telemetry'; +import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server'; + +interface SetupDeps { + usageCollection: UsageCollectionSetup; +} export class FileUploadPlugin implements Plugin { async setup(coreSetup: CoreSetup, plugins: SetupDeps) { diff --git a/x-pack/plugins/file_upload/server/routes.ts b/x-pack/plugins/file_upload/server/routes.ts index c90b44fed722b..f2f4463552a9b 100644 --- a/x-pack/plugins/file_upload/server/routes.ts +++ b/x-pack/plugins/file_upload/server/routes.ts @@ -5,7 +5,7 @@ */ import { IRouter, IScopedClusterClient } from 'kibana/server'; -import { MAX_FILE_SIZE_BYTES } from '../common/constants'; +import { MAX_FILE_SIZE_BYTES, IngestPipelineWrapper, Mappings, Settings } from '../common'; import { wrapError } from './error_wrapper'; import { InputData, importDataProvider } from './import_data'; @@ -14,7 +14,7 @@ import { importFileBodySchema, importFileQuerySchema } from './schemas'; function importData( client: IScopedClusterClient, - id: string, + id: string | undefined, index: string, settings: Settings, mappings: Mappings, diff --git a/x-pack/plugins/file_upload/server/schemas.ts b/x-pack/plugins/file_upload/server/schemas.ts index f0799065e0d61..e5eda5d5ea706 100644 --- a/x-pack/plugins/file_upload/server/schemas.ts +++ b/x-pack/plugins/file_upload/server/schemas.ts @@ -11,14 +11,14 @@ export const importFileQuerySchema = schema.object({ }); export const importFileBodySchema = schema.object({ - index: schema.maybe(schema.string()), + index: schema.string(), data: schema.arrayOf(schema.any()), settings: schema.maybe(schema.any()), /** Mappings */ mappings: schema.any(), /** Ingest pipeline definition */ ingestPipeline: schema.object({ - id: schema.maybe(schema.string()), - pipeline: schema.maybe(schema.any()), + id: schema.string(), + pipeline: schema.any(), }), }); diff --git a/x-pack/plugins/ml/common/types/file_datavisualizer.ts b/x-pack/plugins/ml/common/types/file_datavisualizer.ts index b1967cfe83f3c..8ba30111c4c8c 100644 --- a/x-pack/plugins/ml/common/types/file_datavisualizer.ts +++ b/x-pack/plugins/ml/common/types/file_datavisualizer.ts @@ -68,52 +68,3 @@ export interface FindFileStructureResponse { timestamp_field?: string; should_trim_fields?: boolean; } - -export interface ImportResponse { - success: boolean; - id: string; - index?: string; - pipelineId?: string; - docCount: number; - failures: ImportFailure[]; - error?: any; - ingestError?: boolean; -} - -export interface ImportFailure { - item: number; - reason: string; - doc: ImportDoc; -} - -export interface Doc { - message: string; -} - -export type ImportDoc = Doc | string; - -export interface Settings { - pipeline?: string; - index: string; - body: any[]; - [key: string]: any; -} - -export interface Mappings { - _meta?: { - created_by: string; - }; - properties: { - [key: string]: any; - }; -} - -export interface IngestPipelineWrapper { - id: string; - pipeline: IngestPipeline; -} - -export interface IngestPipeline { - description: string; - processors: any[]; -} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.ts b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.ts index 1cc513e778b2f..25d5373b6dc7c 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.ts +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.ts @@ -8,11 +8,8 @@ import { i18n } from '@kbn/i18n'; import { cloneDeep } from 'lodash'; import uuid from 'uuid/v4'; import { CombinedField } from './types'; -import { - FindFileStructureResponse, - IngestPipeline, - Mappings, -} from '../../../../../../common/types/file_datavisualizer'; +import { FindFileStructureResponse } from '../../../../../../common/types/file_datavisualizer'; +import { IngestPipeline, Mappings } from '../../../../../../../file_upload/common'; const COMMON_LAT_NAMES = ['latitude', 'lat']; const COMMON_LON_NAMES = ['longitude', 'long', 'lon']; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer.ts b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer.ts index 718587ad15ad5..ab0e83846661f 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer.ts +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer.ts @@ -15,7 +15,7 @@ import { Mappings, Settings, IngestPipeline, -} from '../../../../../../../common/types/file_datavisualizer'; +} from '../../../../../../../../file_upload/common'; const CHUNK_SIZE = 5000; const MAX_CHUNK_CHAR_COUNT = 1000000; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/message_importer.ts b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/message_importer.ts index 65be24d9e7be4..a74249ea758a8 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/message_importer.ts +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/message_importer.ts @@ -5,10 +5,8 @@ */ import { Importer, ImportConfig, CreateDocsResponse } from './importer'; -import { - Doc, - FindFileStructureResponse, -} from '../../../../../../../common/types/file_datavisualizer'; +import { FindFileStructureResponse } from '../../../../../../../common/types/file_datavisualizer'; +import { Doc } from '../../../../../../../../file_upload/common'; export class MessageImporter extends Importer { private _excludeLinesRegex: RegExp | null; diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts index 81455718f034f..27d9b78725bef 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/datavisualizer.ts @@ -7,7 +7,7 @@ import { http } from '../http_service'; import { basePath } from './index'; -import { ImportResponse } from '../../../../common/types/file_datavisualizer'; +import { ImportResponse } from '../../../../../file_upload/common'; export const fileDatavisualizer = { analyzeFile(file: string, params: Record = {}) { From 8e1c90eb67a2a6efaa30e56cadfa5a3b659e4677 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 14:16:42 -0700 Subject: [PATCH 09/19] ignore error --- x-pack/plugins/file_upload/server/routes.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/file_upload/server/routes.ts b/x-pack/plugins/file_upload/server/routes.ts index f2f4463552a9b..c98f413caba64 100644 --- a/x-pack/plugins/file_upload/server/routes.ts +++ b/x-pack/plugins/file_upload/server/routes.ts @@ -72,6 +72,7 @@ export function fileUploadRoutes(router: IRouter) { index, settings, mappings, + // @ts-expect-error ingestPipeline, data ); From dd57ecd498d59906ef3c43cb0b92e2927280c958 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 14:26:25 -0700 Subject: [PATCH 10/19] clean up --- .../public/components/index_settings.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/maps_file_upload/public/components/index_settings.js b/x-pack/plugins/maps_file_upload/public/components/index_settings.js index 3102c00dd8290..cb1e639e0fede 100644 --- a/x-pack/plugins/maps_file_upload/public/components/index_settings.js +++ b/x-pack/plugins/maps_file_upload/public/components/index_settings.js @@ -78,7 +78,7 @@ export class IndexSettings extends Component { if (nameAlreadyInUse) { return ( ); @@ -88,7 +88,7 @@ export class IndexSettings extends Component { if (!indexPatternValid) { return ( ); @@ -105,7 +105,7 @@ export class IndexSettings extends Component { } @@ -123,7 +123,7 @@ export class IndexSettings extends Component { } @@ -133,13 +133,13 @@ export class IndexSettings extends Component { @@ -148,41 +148,41 @@ export class IndexSettings extends Component {
    • - {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.mustBeNewIndex', { + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.mustBeNewIndex', { defaultMessage: 'Must be a new index', })}
    • - {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.lowercaseOnly', { + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.lowercaseOnly', { defaultMessage: 'Lowercase only', })}
    • - {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.cannotInclude', { + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotInclude', { defaultMessage: 'Cannot include \\\\, /, *, ?, ", <, >, |, \ " " (space character), , (comma), #', })}
    • - {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.cannotStartWith', { + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotStartWith', { defaultMessage: 'Cannot start with -, _, +', })}
    • - {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.cannotBe', { + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotBe', { defaultMessage: 'Cannot be . or ..', })}
    • - {i18n.translate('xpack.mapsFileUpload.indexSettings.guidelines.length', { + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.length', { defaultMessage: 'Cannot be longer than 255 bytes (note it is bytes, \ so multi-byte characters will count towards the 255 \ From 7edbade363d062cbc81f865849899202be902b06 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 14:28:39 -0700 Subject: [PATCH 11/19] i18n clean-up --- .../public/components/json_import_progress.js | 10 +++--- .../components/json_index_file_picker.js | 33 +++++++++---------- .../components/json_upload_and_parse.js | 14 ++++---- .../public/util/file_parser.js | 8 ++--- .../public/util/http_service.js | 4 +-- .../public/util/indexing_service.js | 16 ++++----- 6 files changed, 41 insertions(+), 44 deletions(-) diff --git a/x-pack/plugins/maps_file_upload/public/components/json_import_progress.js b/x-pack/plugins/maps_file_upload/public/components/json_import_progress.js index 754c3021b4dca..23ca4550e1744 100644 --- a/x-pack/plugins/maps_file_upload/public/components/json_import_progress.js +++ b/x-pack/plugins/maps_file_upload/public/components/json_import_progress.js @@ -60,7 +60,7 @@ export class JsonImportProgress extends Component {

      @@ -74,7 +74,7 @@ export class JsonImportProgress extends Component {

      @@ -94,7 +94,7 @@ export class JsonImportProgress extends Component {

      @@ -111,7 +111,7 @@ export class JsonImportProgress extends Component { ) : null}
      - {i18n.translate('xpack.mapsFileUpload.jsonImport.indexModsMsg', { + {i18n.translate('xpack.fileUpload.jsonImport.indexModsMsg', { defaultMessage: 'Further index modifications can be made using\n', })} - {i18n.translate('xpack.mapsFileUpload.jsonImport.indexMgmtLink', { + {i18n.translate('xpack.fileUpload.jsonImport.indexMgmtLink', { defaultMessage: 'Index Management', })} diff --git a/x-pack/plugins/maps_file_upload/public/components/json_index_file_picker.js b/x-pack/plugins/maps_file_upload/public/components/json_index_file_picker.js index d026d0bc4e9cf..d69a964a0b49e 100644 --- a/x-pack/plugins/maps_file_upload/public/components/json_index_file_picker.js +++ b/x-pack/plugins/maps_file_upload/public/components/json_index_file_picker.js @@ -67,7 +67,7 @@ export class JsonIndexFilePicker extends Component { const humanReadableSize = bytesToSize(size); const humanReadableMaxSize = bytesToSize(MAX_FILE_SIZE); throw new Error( - i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.acceptableFileSize', { + i18n.translate('xpack.fileUpload.jsonIndexFilePicker.acceptableFileSize', { defaultMessage: 'File size {fileSize} exceeds max file size of {maxFileSize}', values: { fileSize: humanReadableSize, @@ -78,7 +78,7 @@ export class JsonIndexFilePicker extends Component { } } catch (error) { this.setState({ - fileUploadError: i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.fileSizeError', { + fileUploadError: i18n.translate('xpack.fileUpload.jsonIndexFilePicker.fileSizeError', { defaultMessage: 'File size error: {errorMessage}', values: { errorMessage: error.message, @@ -95,7 +95,7 @@ export class JsonIndexFilePicker extends Component { try { if (!name) { throw new Error( - i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.noFileNameError', { + i18n.translate('xpack.fileUpload.jsonIndexFilePicker.noFileNameError', { defaultMessage: 'No file name provided', }) ); @@ -106,7 +106,7 @@ export class JsonIndexFilePicker extends Component { if (!ACCEPTABLE_FILETYPES.includes(fileType)) { //should only occur if browser does not accept the accept parameter throw new Error( - i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.acceptableTypesError', { + i18n.translate('xpack.fileUpload.jsonIndexFilePicker.acceptableTypesError', { defaultMessage: 'File is not one of acceptable types: {types}', values: { types: ACCEPTABLE_FILETYPES.join(', '), @@ -119,7 +119,7 @@ export class JsonIndexFilePicker extends Component { } catch (error) { this.setState({ fileUploadError: i18n.translate( - 'xpack.mapsFileUpload.jsonIndexFilePicker.fileProcessingError', + 'xpack.fileUpload.jsonIndexFilePicker.fileProcessingError', { defaultMessage: 'File processing error: {errorMessage}', values: { @@ -173,7 +173,7 @@ export class JsonIndexFilePicker extends Component { featuresProcessed: 0, fileUploadError: ( @@ -235,7 +235,7 @@ export class JsonIndexFilePicker extends Component { } @@ -243,7 +243,7 @@ export class JsonIndexFilePicker extends Component { error={[fileUploadError]} helpText={ percentageProcessed ? ( - i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.parsingFile', { + i18n.translate('xpack.fileUpload.jsonIndexFilePicker.parsingFile', { defaultMessage: '{featuresProcessed} features parsed...', values: { featuresProcessed, @@ -251,7 +251,7 @@ export class JsonIndexFilePicker extends Component { }) ) : ( - {i18n.translate('xpack.mapsFileUpload.jsonIndexFilePicker.formatsAccepted', { + {i18n.translate('xpack.fileUpload.jsonIndexFilePicker.formatsAccepted', { defaultMessage: 'Formats accepted: {acceptedFileTypeStringMessage}', values: { acceptedFileTypeStringMessage, @@ -259,19 +259,16 @@ export class JsonIndexFilePicker extends Component { })}{' '}

      - {i18n.translate( - 'xpack.mapsFileUpload.jsonIndexFilePicker.coordinateSystemAccepted', - { - defaultMessage: 'Coordinates must be in EPSG:4326 coordinate reference system.', - } - )}{' '} + {i18n.translate('xpack.fileUpload.jsonIndexFilePicker.coordinateSystemAccepted', { + defaultMessage: 'Coordinates must be in EPSG:4326 coordinate reference system.', + })}{' '}
      ) } @@ -279,7 +276,7 @@ export class JsonIndexFilePicker extends Component { } diff --git a/x-pack/plugins/maps_file_upload/public/components/json_upload_and_parse.js b/x-pack/plugins/maps_file_upload/public/components/json_upload_and_parse.js index 7cd9d54f9ac8b..453d4f84f7e0e 100644 --- a/x-pack/plugins/maps_file_upload/public/components/json_upload_and_parse.js +++ b/x-pack/plugins/maps_file_upload/public/components/json_upload_and_parse.js @@ -16,27 +16,27 @@ import { JsonImportProgress } from './json_import_progress'; import _ from 'lodash'; const INDEXING_STAGE = { - INDEXING_STARTED: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.dataIndexingStarted', { + INDEXING_STARTED: i18n.translate('xpack.fileUpload.jsonUploadAndParse.dataIndexingStarted', { defaultMessage: 'Data indexing started', }), - WRITING_TO_INDEX: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.writingToIndex', { + WRITING_TO_INDEX: i18n.translate('xpack.fileUpload.jsonUploadAndParse.writingToIndex', { defaultMessage: 'Writing to index', }), - INDEXING_COMPLETE: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.indexingComplete', { + INDEXING_COMPLETE: i18n.translate('xpack.fileUpload.jsonUploadAndParse.indexingComplete', { defaultMessage: 'Indexing complete', }), CREATING_INDEX_PATTERN: i18n.translate( - 'xpack.mapsFileUpload.jsonUploadAndParse.creatingIndexPattern', + 'xpack.fileUpload.jsonUploadAndParse.creatingIndexPattern', { defaultMessage: 'Creating index pattern' } ), INDEX_PATTERN_COMPLETE: i18n.translate( - 'xpack.mapsFileUpload.jsonUploadAndParse.indexPatternComplete', + 'xpack.fileUpload.jsonUploadAndParse.indexPatternComplete', { defaultMessage: 'Index pattern complete' } ), - INDEXING_ERROR: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.dataIndexingError', { + INDEXING_ERROR: i18n.translate('xpack.fileUpload.jsonUploadAndParse.dataIndexingError', { defaultMessage: 'Data indexing error', }), - INDEX_PATTERN_ERROR: i18n.translate('xpack.mapsFileUpload.jsonUploadAndParse.indexPatternError', { + INDEX_PATTERN_ERROR: i18n.translate('xpack.fileUpload.jsonUploadAndParse.indexPatternError', { defaultMessage: 'Index pattern error', }), }; diff --git a/x-pack/plugins/maps_file_upload/public/util/file_parser.js b/x-pack/plugins/maps_file_upload/public/util/file_parser.js index 2437cae7a2763..2a504f46f598a 100644 --- a/x-pack/plugins/maps_file_upload/public/util/file_parser.js +++ b/x-pack/plugins/maps_file_upload/public/util/file_parser.js @@ -20,7 +20,7 @@ export const fileHandler = async ({ if (!file) { reject( new Error( - i18n.translate('xpack.mapsFileUpload.fileParser.noFileProvided', { + i18n.translate('xpack.fileUpload.fileParser.noFileProvided', { defaultMessage: 'Error, no file provided', }) ) @@ -66,7 +66,7 @@ export const fileHandler = async ({ boolGeometryErrs = true; errors.push( new Error( - i18n.translate('xpack.mapsFileUpload.fileParser.featuresOmitted', { + i18n.translate('xpack.fileUpload.fileParser.featuresOmitted', { defaultMessage: 'Some features without geometry omitted', }) ) @@ -92,7 +92,7 @@ export const fileHandler = async ({ if (!featuresProcessed && getFileParseActive()) { reject( new Error( - i18n.translate('xpack.mapsFileUpload.fileParser.noFeaturesDetected', { + i18n.translate('xpack.fileUpload.fileParser.noFeaturesDetected', { defaultMessage: 'Error, no features detected', }) ) @@ -133,7 +133,7 @@ export async function parseFile({ cleanAndValidate = geoJsonCleanAndValidate; break; default: - throw i18n.translate('xpack.mapsFileUpload.fileParser.transformDetailsNotDefined', { + throw i18n.translate('xpack.fileUpload.fileParser.transformDetailsNotDefined', { defaultMessage: 'Index options for {transformDetails} not defined', values: { transformDetails }, }); diff --git a/x-pack/plugins/maps_file_upload/public/util/http_service.js b/x-pack/plugins/maps_file_upload/public/util/http_service.js index cbb3466ef7054..4bf9ec2d4c6d5 100644 --- a/x-pack/plugins/maps_file_upload/public/util/http_service.js +++ b/x-pack/plugins/maps_file_upload/public/util/http_service.js @@ -9,7 +9,7 @@ import { kbnFetch } from '../kibana_services'; export async function http(options) { if (!(options && options.url)) { - throw i18n.translate('xpack.mapsFileUpload.httpService.noUrl', { + throw i18n.translate('xpack.fileUpload.httpService.noUrl', { defaultMessage: 'No URL provided', }); } @@ -41,7 +41,7 @@ async function doFetch(url, payload) { } catch (err) { return { failures: [ - i18n.translate('xpack.mapsFileUpload.httpService.fetchError', { + i18n.translate('xpack.fileUpload.httpService.fetchError', { defaultMessage: 'Error performing fetch: {error}', values: { error: err.message }, }), diff --git a/x-pack/plugins/maps_file_upload/public/util/indexing_service.js b/x-pack/plugins/maps_file_upload/public/util/indexing_service.js index f6b5a1c1891e1..14d02ce881cda 100644 --- a/x-pack/plugins/maps_file_upload/public/util/indexing_service.js +++ b/x-pack/plugins/maps_file_upload/public/util/indexing_service.js @@ -14,7 +14,7 @@ const fileType = 'json'; export async function indexData(parsedFile, transformDetails, indexName, dataType, appName) { if (!parsedFile) { - throw i18n.translate('xpack.mapsFileUpload.indexingService.noFileImported', { + throw i18n.translate('xpack.fileUpload.indexingService.noFileImported', { defaultMessage: 'No file imported.', }); } @@ -22,7 +22,7 @@ export async function indexData(parsedFile, transformDetails, indexName, dataTyp // Perform any processing required on file prior to indexing const transformResult = transformDataByFormatForIndexing(transformDetails, parsedFile, dataType); if (!transformResult.success) { - throw i18n.translate('xpack.mapsFileUpload.indexingService.transformResultError', { + throw i18n.translate('xpack.fileUpload.indexingService.transformResultError', { defaultMessage: 'Error transforming data: {error}', values: { error: transformResult.error }, }); @@ -40,7 +40,7 @@ export async function indexData(parsedFile, transformDetails, indexName, dataTyp const id = createdIndex && createdIndex.id; try { if (!id) { - throw i18n.translate('xpack.mapsFileUpload.indexingService.errorCreatingIndex', { + throw i18n.translate('xpack.fileUpload.indexingService.errorCreatingIndex', { defaultMessage: 'Error creating index', }); } @@ -67,7 +67,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { if (!transform) { return { success: false, - error: i18n.translate('xpack.mapsFileUpload.indexingService.noTransformDefined', { + error: i18n.translate('xpack.fileUpload.indexingService.noTransformDefined', { defaultMessage: 'No transform defined', }), }; @@ -80,7 +80,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { default: return { success: false, - error: i18n.translate('xpack.mapsFileUpload.indexingService.noHandlingForTransform', { + error: i18n.translate('xpack.fileUpload.indexingService.noHandlingForTransform', { defaultMessage: 'No handling defined for transform: {transform}', values: { transform }, }), @@ -98,7 +98,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { } else if (indexingDetails && indexingDetails.data) { return { success: false, - error: i18n.translate('xpack.mapsFileUpload.indexingService.noIndexingDetailsForDatatype', { + error: i18n.translate('xpack.fileUpload.indexingService.noIndexingDetailsForDatatype', { defaultMessage: `No indexing details defined for datatype: {dataType}`, values: { dataType }, }), @@ -106,7 +106,7 @@ function transformDataByFormatForIndexing(transform, parsedFile, dataType) { } else { return { success: false, - error: i18n.translate('xpack.mapsFileUpload.indexingService.unknownTransformError', { + error: i18n.translate('xpack.fileUpload.indexingService.unknownTransformError', { defaultMessage: 'Unknown error performing transform: {transform}', values: { transform }, }), @@ -138,7 +138,7 @@ async function chunkDataAndWriteToIndex({ id, index, data, mappings, settings }) if (!index) { return { success: false, - error: i18n.translate('xpack.mapsFileUpload.noIndexSuppliedErrorMessage', { + error: i18n.translate('xpack.fileUpload.noIndexSuppliedErrorMessage', { defaultMessage: 'No index provided.', }), }; From 1079c41e0e681b1a26578cd78a5c6a2a25730b55 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 14:31:54 -0700 Subject: [PATCH 12/19] remove schemas from ml --- .../schemas/file_data_visualizer_schema.ts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/x-pack/plugins/ml/server/routes/schemas/file_data_visualizer_schema.ts b/x-pack/plugins/ml/server/routes/schemas/file_data_visualizer_schema.ts index 9a80cf795cabf..685f06f839ee3 100644 --- a/x-pack/plugins/ml/server/routes/schemas/file_data_visualizer_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/file_data_visualizer_schema.ts @@ -24,20 +24,3 @@ export const analyzeFileQuerySchema = schema.maybe( timestamp_format: schema.maybe(schema.string()), }) ); - -export const importFileQuerySchema = schema.object({ - id: schema.maybe(schema.string()), -}); - -export const importFileBodySchema = schema.object({ - index: schema.maybe(schema.string()), - data: schema.arrayOf(schema.any()), - settings: schema.maybe(schema.any()), - /** Mappings */ - mappings: schema.any(), - /** Ingest pipeline definition */ - ingestPipeline: schema.object({ - id: schema.maybe(schema.string()), - pipeline: schema.maybe(schema.any()), - }), -}); From ed0e4773cd0273fa013812d1db73a62a1bb3ea3e Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 14:40:46 -0700 Subject: [PATCH 13/19] remove usageCollection from ml --- x-pack/plugins/ml/kibana.json | 1 - x-pack/plugins/ml/public/plugin.ts | 3 --- x-pack/plugins/ml/server/types.ts | 2 -- 3 files changed, 6 deletions(-) diff --git a/x-pack/plugins/ml/kibana.json b/x-pack/plugins/ml/kibana.json index f3e91efb5c6b0..ede6b8abbd09c 100644 --- a/x-pack/plugins/ml/kibana.json +++ b/x-pack/plugins/ml/kibana.json @@ -12,7 +12,6 @@ "features", "fileUpload", "licensing", - "usageCollection", "share", "embeddable", "uiActions", diff --git a/x-pack/plugins/ml/public/plugin.ts b/x-pack/plugins/ml/public/plugin.ts index 3ba79e0eb9187..ef3de1a5ce65c 100644 --- a/x-pack/plugins/ml/public/plugin.ts +++ b/x-pack/plugins/ml/public/plugin.ts @@ -21,7 +21,6 @@ import type { SharePluginStart, UrlGeneratorContract, } from 'src/plugins/share/public'; -import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import type { DataPublicPluginStart } from 'src/plugins/data/public'; import type { HomePublicPluginSetup } from 'src/plugins/home/public'; import type { IndexPatternManagementSetup } from 'src/plugins/index_pattern_management/public'; @@ -60,7 +59,6 @@ export interface MlSetupDependencies { security?: SecurityPluginSetup; licensing: LicensingPluginSetup; management?: ManagementSetup; - usageCollection: UsageCollectionSetup; licenseManagement?: LicenseManagementUIPluginSetup; home?: HomePublicPluginSetup; embeddable: EmbeddableSetup; @@ -102,7 +100,6 @@ export class MlPlugin implements Plugin { security: pluginsSetup.security, licensing: pluginsSetup.licensing, management: pluginsSetup.management, - usageCollection: pluginsSetup.usageCollection, licenseManagement: pluginsSetup.licenseManagement, home: pluginsSetup.home, embeddable: { ...pluginsSetup.embeddable, ...pluginsStart.embeddable }, diff --git a/x-pack/plugins/ml/server/types.ts b/x-pack/plugins/ml/server/types.ts index 780a4284312e7..f3e3ee22f3817 100644 --- a/x-pack/plugins/ml/server/types.ts +++ b/x-pack/plugins/ml/server/types.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import type { HomeServerPluginSetup } from 'src/plugins/home/server'; import type { IRouter } from 'kibana/server'; import type { CloudSetup } from '../../cloud/server'; @@ -43,7 +42,6 @@ export interface PluginsSetup { licensing: LicensingPluginSetup; security?: SecurityPluginSetup; spaces?: SpacesPluginSetup; - usageCollection: UsageCollectionSetup; } export interface PluginsStart { From 3bc38e29bcca79b8bafface6089ccc52881096aa Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 15:03:40 -0700 Subject: [PATCH 14/19] node scripts/build_plugin_list_docs --- docs/developer/plugin-list.asciidoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 472f7fa8e091f..7f9d4dcd0a01d 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -77,7 +77,7 @@ by the user. The final output of the expression pipeline can be rendered using one of the *renderers* registered in `expressions` plugin. All the arguments to expression functions need to be serializable, as well as input and output. -Expression functions should try to stay 'pure'. This makes functions easy to reuse and also +Expression functions should try to stay 'pure'. This makes functions easy to reuse and also make it possible to serialize the whole chain as well as output at every step of execution. Expressions power visualizations in Dashboard and Lens, as well as, every @@ -370,8 +370,8 @@ and actions. |The features plugin enhance Kibana with a per-feature privilege system. -|{kib-repo}blob/{branch}/x-pack/plugins/maps_file_upload/README.md[mapsFileUpload] -|Backend and core front-end react-components for GeoJson file upload. Only supports the Maps plugin. +|{kib-repo}blob/{branch}/x-pack/plugins/file_upload[fileUpload] +|WARNING: Missing README. |{kib-repo}blob/{branch}/x-pack/plugins/fleet/README.md[fleet] From 3b87cbfdd751afe64feac44d6b149d4c8574268a Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 28 Jan 2021 16:54:05 -0700 Subject: [PATCH 15/19] update telemety collector --- src/plugins/telemetry/schema/oss_plugins.json | 6 ++-- .../schema/xpack_plugins.json | 28 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 950fdf9405b75..14cd7141ac9e2 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -4097,6 +4097,9 @@ "xpackDashboardMode:roles": { "type": "keyword" }, + "securitySolution:ipReputationLinks": { + "type": "keyword" + }, "visualize:enableLabs": { "type": "boolean" }, @@ -4115,9 +4118,6 @@ "visualization:tileMap:maxPrecision": { "type": "long" }, - "securitySolution:ipReputationLinks": { - "type": "keyword" - }, "csv:separator": { "type": "keyword" }, diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 4ca373d9260b7..c1674f8a92669 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -1771,10 +1771,14 @@ } } }, - "fileUploadTelemetry": { + "fileUpload": { "properties": { - "filesUploadedTotalCount": { - "type": "long" + "file_upload": { + "properties": { + "index_creation_count": { + "type": "long" + } + } } } }, @@ -2215,6 +2219,13 @@ } } }, + "fileUploadTelemetry": { + "properties": { + "filesUploadedTotalCount": { + "type": "long" + } + } + }, "maps": { "properties": { "settings": { @@ -2308,17 +2319,6 @@ } } }, - "mlTelemetry": { - "properties": { - "file_data_visualizer": { - "properties": { - "index_creation_count": { - "type": "long" - } - } - } - } - }, "monitoring": { "properties": { "hasMonitoringData": { From 0b315126f123104c4caaa3a7353b6e400808f564 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Fri, 29 Jan 2021 10:53:46 -0700 Subject: [PATCH 16/19] revert changes to ingestPipeline schema --- x-pack/plugins/file_upload/server/schemas.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/file_upload/server/schemas.ts b/x-pack/plugins/file_upload/server/schemas.ts index e5eda5d5ea706..79db26cdb8c05 100644 --- a/x-pack/plugins/file_upload/server/schemas.ts +++ b/x-pack/plugins/file_upload/server/schemas.ts @@ -18,7 +18,7 @@ export const importFileBodySchema = schema.object({ mappings: schema.any(), /** Ingest pipeline definition */ ingestPipeline: schema.object({ - id: schema.string(), - pipeline: schema.any(), + id: schema.maybe(schema.string()), + pipeline: schema.maybe(schema.any()), }), }); From 26e05b270abb10cbaa89fba995485054452168c0 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Fri, 29 Jan 2021 12:59:42 -0700 Subject: [PATCH 17/19] change name of TELEMETRY_DOC_ID to unique value --- x-pack/plugins/file_upload/server/telemetry/telemetry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/file_upload/server/telemetry/telemetry.ts b/x-pack/plugins/file_upload/server/telemetry/telemetry.ts index f273d2bbe4498..aac45d5d0f871 100644 --- a/x-pack/plugins/file_upload/server/telemetry/telemetry.ts +++ b/x-pack/plugins/file_upload/server/telemetry/telemetry.ts @@ -9,7 +9,7 @@ import { ISavedObjectsRepository } from 'kibana/server'; import { getInternalRepository } from './internal_repository'; -export const TELEMETRY_DOC_ID = 'ml-telemetry'; +export const TELEMETRY_DOC_ID = 'file-upload-usage-collection-telemetry'; export interface Telemetry { file_upload: { From 0473f5a4b46c3f8536c470701eef0142a60e0272 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Fri, 29 Jan 2021 13:05:17 -0700 Subject: [PATCH 18/19] remove ImportFile from ml/server/routes/apidoc.json --- x-pack/plugins/ml/server/routes/apidoc.json | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/ml/server/routes/apidoc.json b/x-pack/plugins/ml/server/routes/apidoc.json index 015ec6e4ec9c0..ef684a8c31284 100644 --- a/x-pack/plugins/ml/server/routes/apidoc.json +++ b/x-pack/plugins/ml/server/routes/apidoc.json @@ -43,7 +43,6 @@ "FileDataVisualizer", "AnalyzeFile", - "ImportFile", "ResultsService", "GetAnomaliesTableData", From 6d3bf3a0ff95c14f6192493f73bc7cbb0668b99f Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 1 Feb 2021 08:50:59 -0700 Subject: [PATCH 19/19] fix typo in x=pack/tsconfig.json --- x-pack/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/tsconfig.json b/x-pack/tsconfig.json index ad2ae8d075ea5..31a3e55d2e36d 100644 --- a/x-pack/tsconfig.json +++ b/x-pack/tsconfig.json @@ -97,7 +97,7 @@ { "path": "./plugins/enterprise_search/tsconfig.json" }, { "path": "./plugins/event_log/tsconfig.json" }, { "path": "./plugins/features/tsconfig.json" }, - { "path": "./plugins/file_uplaod/tsconfig.json" }, + { "path": "./plugins/file_upload/tsconfig.json" }, { "path": "./plugins/global_search_bar/tsconfig.json" }, { "path": "./plugins/global_search_providers/tsconfig.json" }, { "path": "./plugins/global_search/tsconfig.json" },