Skip to content

Commit

Permalink
[Console] Move out of legacy + migrate server side to New Platform (#…
Browse files Browse the repository at this point in the history
…55690)

* Initial move of public and setup of server skeleton

* Fix public paths and types

* Use new usage stats dependency directly in tracker also mark as an optional dependency

* WiP on getting server side working

* Restore proxy route behaviour for base case, still need to test custom proxy and SSL

* Add new type and lib files

* Clean up legacy start up code and add comment about issue in kibana.yml config for console

* Move console_extensions to new platform and introduce ConsoleSetup API for extending autocomplete
Add TODO regarding exposing legacy ES config

* Re-introduce injected elasticsearch variable and use it in public

* Don't pass stateSetter prop through to checkbox

* Refactor of proxy route (split into separate files). Easier testing for now.
Refactor file name of request.ts -> proxy_request.ts. This is consistent with the exported function now
Started fixing server side tests for the proxy route
  - Migrated away from sinon
  - Completed the body.js -> body.test.ts. Still have to do the rest

* headers.js test -> headers.test.ts and moved some of the proxy route mocking logic to a common space

* Finish migration of rest of proxy route test away from hapi
Add test for custom route validation

* Bring console application in line with https://github.com/elastic/kibana/blob/master/src/core/CONVENTIONS.md#applications
Change log from info level to debug level for console_extensions plugin

* Update i18nrc file for console

* Add setHeaders when passing back error response

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
jloleysens and elasticmachine authored Jan 30, 2020
1 parent 0d03ade commit 952b61e
Show file tree
Hide file tree
Showing 613 changed files with 1,345 additions and 1,081 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@
**/*.scss @elastic/kibana-design

# Elasticsearch UI
/src/legacy/core_plugins/console/ @elastic/es-ui
/src/plugins/console/ @elastic/es-ui
/src/plugins/es_ui_shared/ @elastic/es-ui
/x-pack/legacy/plugins/console_extensions/ @elastic/es-ui
/x-pack/plugins/console_extensions/ @elastic/es-ui
/x-pack/legacy/plugins/cross_cluster_replication/ @elastic/es-ui
/x-pack/legacy/plugins/index_lifecycle_management/ @elastic/es-ui
/x-pack/legacy/plugins/index_management/ @elastic/es-ui
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"paths": {
"common.ui": "src/legacy/ui",
"console": "src/legacy/core_plugins/console",
"console": "src/plugins/console",
"core": "src/core",
"dashboardEmbeddableContainer": "src/plugins/dashboard_embeddable_container",
"data": [
Expand Down
13 changes: 12 additions & 1 deletion src/core/server/http/router/response_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { ResponseObject as HapiResponseObject, ResponseToolkit as HapiResponseToolkit } from 'hapi';
import typeDetect from 'type-detect';
import Boom from 'boom';
import * as stream from 'stream';

import {
HttpResponsePayload,
Expand Down Expand Up @@ -112,8 +113,18 @@ export class HapiResponseAdapter {
return response;
}

private toError(kibanaResponse: KibanaResponse<ResponseError>) {
private toError(kibanaResponse: KibanaResponse<ResponseError | Buffer | stream.Readable>) {
const { payload } = kibanaResponse;

// Special case for when we are proxying requests and want to enable streaming back error responses opaquely.
if (Buffer.isBuffer(payload) || payload instanceof stream.Readable) {
const response = this.responseToolkit
.response(kibanaResponse.payload)
.code(kibanaResponse.status);
setHeaders(response, kibanaResponse.options.headers);
return response;
}

// we use for BWC with Boom payload for error responses - {error: string, message: string, statusCode: string}
const error = new Boom('', {
statusCode: kibanaResponse.status,
Expand Down
75 changes: 0 additions & 75 deletions src/legacy/core_plugins/console/__tests__/index.js

This file was deleted.

187 changes: 0 additions & 187 deletions src/legacy/core_plugins/console/index.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/legacy/core_plugins/console/package.json

This file was deleted.

53 changes: 0 additions & 53 deletions src/legacy/core_plugins/console/public/legacy.ts

This file was deleted.

Loading

0 comments on commit 952b61e

Please sign in to comment.