-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Use np savedObjectsClient in indexing service * Export File Upload UI via start since it requires initialization * Pass services through top level react component props * Handle basePath ref and 'kbn-version' for requests * Bulk of logic for removing hapi server dependencies for server app * Use request obj subset of original request * Move startup logic over to server plugin file and call from index.js * Update server tests * Clean up * Remove old makeUsageCollector export statement * initServicesAndConstants in the start method instead of in the react component * Review feedback
- Loading branch information
Aaron Caldwell
authored
Nov 25, 2019
1 parent
8f1055d
commit a98d5f5
Showing
22 changed files
with
229 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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 const mappings = { | ||
'file-upload-telemetry': { | ||
properties: { | ||
filesUploadedTotalCount: { | ||
type: 'long', | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* 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 { npStart } from 'ui/new_platform'; | ||
import { plugin } from '.'; | ||
|
||
const pluginInstance = plugin(); | ||
|
||
export const start = pluginInstance.start(npStart.core); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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 { Plugin, CoreStart } from 'src/core/public'; | ||
// @ts-ignore | ||
import { initResources } from './util/indexing_service'; | ||
// @ts-ignore | ||
import { JsonUploadAndParse } from './components/json_upload_and_parse'; | ||
// @ts-ignore | ||
import { initServicesAndConstants } from './kibana_services'; | ||
|
||
/** | ||
* These are the interfaces with your public contracts. You should export these | ||
* for other plugins to use in _their_ `SetupDeps`/`StartDeps` interfaces. | ||
* @public | ||
*/ | ||
export type FileUploadPluginSetup = ReturnType<FileUploadPlugin['setup']>; | ||
export type FileUploadPluginStart = ReturnType<FileUploadPlugin['start']>; | ||
|
||
/** @internal */ | ||
export class FileUploadPlugin implements Plugin<FileUploadPluginSetup, FileUploadPluginStart> { | ||
public setup() {} | ||
|
||
public start(core: CoreStart) { | ||
initServicesAndConstants(core); | ||
return { | ||
JsonUploadAndParse, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 { getImportRouteHandler } from './routes/file_upload'; | ||
import { getTelemetry, initTelemetry } from './telemetry/telemetry'; | ||
import { MAX_BYTES } from '../common/constants/file_import'; | ||
|
||
const TELEMETRY_TYPE = 'fileUploadTelemetry'; | ||
|
||
export class FileUploadPlugin { | ||
setup(core, plugins, __LEGACY) { | ||
const elasticsearchPlugin = __LEGACY.plugins.elasticsearch; | ||
const getSavedObjectsRepository = __LEGACY.savedObjects.getSavedObjectsRepository; | ||
const makeUsageCollector = __LEGACY.usage.collectorSet.makeUsageCollector; | ||
|
||
// Set up route | ||
__LEGACY.route({ | ||
method: 'POST', | ||
path: '/api/fileupload/import', | ||
handler: getImportRouteHandler(elasticsearchPlugin, getSavedObjectsRepository), | ||
config: { | ||
payload: { maxBytes: MAX_BYTES }, | ||
} | ||
}); | ||
|
||
// Make usage collector | ||
makeUsageCollector({ | ||
type: TELEMETRY_TYPE, | ||
isReady: () => true, | ||
fetch: async () => (await getTelemetry(elasticsearchPlugin, getSavedObjectsRepository)) || initTelemetry() | ||
}); | ||
} | ||
} |
Oops, something went wrong.