Skip to content

Commit

Permalink
Merge branch 'master' into reporting/page-exit-error-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Mar 5, 2020
2 parents 9c7812c + 4883d4b commit 3e1e145
Show file tree
Hide file tree
Showing 503 changed files with 10,548 additions and 11,933 deletions.
6 changes: 4 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# App
/x-pack/legacy/plugins/lens/ @elastic/kibana-app
/x-pack/legacy/plugins/graph/ @elastic/kibana-app
/src/plugins/share/ @elastic/kibana-app
/src/legacy/server/url_shortening/ @elastic/kibana-app
/src/legacy/server/sample_data/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app
Expand All @@ -27,6 +26,7 @@
/src/plugins/kibana_legacy/ @elastic/kibana-app
/src/plugins/timelion/ @elastic/kibana-app
/src/plugins/dev_tools/ @elastic/kibana-app
/src/plugins/dashboard_embeddable_container/ @elastic/kibana-app

# App Architecture
/packages/kbn-interpreter/ @elastic/kibana-app-arch
Expand All @@ -42,7 +42,6 @@
/src/legacy/core_plugins/visualizations/ @elastic/kibana-app-arch
/src/legacy/server/index_patterns/ @elastic/kibana-app-arch
/src/plugins/bfetch/ @elastic/kibana-app-arch
/src/plugins/dashboard_embeddable_container/ @elastic/kibana-app-arch
/src/plugins/data/ @elastic/kibana-app-arch
/src/plugins/embeddable/ @elastic/kibana-app-arch
/src/plugins/expressions/ @elastic/kibana-app-arch
Expand All @@ -53,6 +52,9 @@
/src/plugins/navigation/ @elastic/kibana-app-arch
/src/plugins/ui_actions/ @elastic/kibana-app-arch
/src/plugins/visualizations/ @elastic/kibana-app-arch
/src/plugins/share/ @elastic/kibana-app-arch
/examples/url_generators_examples/ @elastic/kibana-app-arch
/examples/url_generators_explorer/ @elastic/kibana-app-arch
/x-pack/plugins/advanced_ui_actions/ @elastic/kibana-app-arch
/x-pack/plugins/drilldowns/ @elastic/kibana-app-arch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface CoreSetup<TPluginsStart extends object = object>
| [context](./kibana-plugin-server.coresetup.context.md) | <code>ContextSetup</code> | [ContextSetup](./kibana-plugin-server.contextsetup.md) |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>ElasticsearchServiceSetup</code> | [ElasticsearchServiceSetup](./kibana-plugin-server.elasticsearchservicesetup.md) |
| [http](./kibana-plugin-server.coresetup.http.md) | <code>HttpServiceSetup</code> | [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) |
| [metrics](./kibana-plugin-server.coresetup.metrics.md) | <code>MetricsServiceSetup</code> | [MetricsServiceSetup](./kibana-plugin-server.metricsservicesetup.md) |
| [savedObjects](./kibana-plugin-server.coresetup.savedobjects.md) | <code>SavedObjectsServiceSetup</code> | [SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md) |
| [uiSettings](./kibana-plugin-server.coresetup.uisettings.md) | <code>UiSettingsServiceSetup</code> | [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) |
| [uuid](./kibana-plugin-server.coresetup.uuid.md) | <code>UuidServiceSetup</code> | [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [CoreSetup](./kibana-plugin-server.coresetup.md) &gt; [metrics](./kibana-plugin-server.coresetup.metrics.md)

## CoreSetup.metrics property

[MetricsServiceSetup](./kibana-plugin-server.metricsservicesetup.md)

<b>Signature:</b>

```typescript
metrics: MetricsServiceSetup;
```
4 changes: 0 additions & 4 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,6 @@ deprecation warning at startup. This setting cannot end in a slash (`/`).
proxy sitting in front of it. This determines whether HTTP compression may be used for responses, based on the request's `Referer` header.
This setting may not be used when `server.compression.enabled` is set to `false`.

[[server-cors]]`server.cors:`:: *Default: `false`* Set to `true` to enable CORS support. This setting is required to configure `server.cors.origin`.

`server.cors.origin:`:: *Default: none* Specifies origins. "origin" must be an array. To use this setting, you must set `server.cors` to `true`. To accept all origins, use `server.cors.origin: ["*"]`.

`server.customResponseHeaders:`:: *Default: `{}`* Header names and values to
send on all responses to the client from the Kibana server.

Expand Down
7 changes: 1 addition & 6 deletions examples/search_explorer/public/es_strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import {
import { DoSearch } from './do_search';
import { GuideSection } from './guide_section';

// @ts-ignore
import serverPlugin from '!!raw-loader!./../../../src/plugins/data/server/search/es_search/es_search_service';
// @ts-ignore
import serverStrategy from '!!raw-loader!./../../../src/plugins/data/server/search/es_search/es_search_strategy';

Expand Down Expand Up @@ -127,10 +125,7 @@ export class EsSearchTest extends React.Component<Props, State> {
},
{
title: 'Server',
code: [
{ description: 'es_search_service.ts', snippet: serverPlugin },
{ description: 'es_search_strategy.ts', snippet: serverStrategy },
],
code: [{ description: 'es_search_strategy.ts', snippet: serverStrategy }],
},
]}
demo={this.renderDemo()}
Expand Down
7 changes: 7 additions & 0 deletions examples/url_generators_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Access links examples

This example app shows how to:
- Register a direct access link generator.
- Handle migration of legacy generators into a new one.

To run this example, use the command `yarn start --run-examples`. Navigate to the access links explorer app
10 changes: 10 additions & 0 deletions examples/url_generators_examples/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "urlGeneratorsExamples",
"version": "0.0.1",
"kibanaVersion": "kibana",
"configPath": ["url_generators_examples"],
"server": false,
"ui": true,
"requiredPlugins": ["share"],
"optionalPlugins": []
}
17 changes: 17 additions & 0 deletions examples/url_generators_examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "url_generators_examples",
"version": "1.0.0",
"main": "target/examples/url_generators_examples",
"kibana": {
"version": "kibana",
"templateVersion": "1.0.0"
},
"license": "Apache-2.0",
"scripts": {
"kbn": "node ../../scripts/kbn.js",
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.5.3"
}
}
89 changes: 89 additions & 0 deletions examples/url_generators_examples/public/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React from 'react';
import ReactDOM from 'react-dom';

import { EuiPageBody } from '@elastic/eui';
import { EuiPageContent } from '@elastic/eui';
import { EuiPageContentBody } from '@elastic/eui';
import { Route, Switch, Redirect, Router, useLocation } from 'react-router-dom';
import { createBrowserHistory } from 'history';
import { EuiText } from '@elastic/eui';
import { AppMountParameters } from '../../../src/core/public';

function useQuery() {
const { search } = useLocation();
const params = React.useMemo(() => new URLSearchParams(search), [search]);
return params;
}

interface HelloPageProps {
firstName: string;
lastName: string;
}

const HelloPage = ({ firstName, lastName }: HelloPageProps) => (
<EuiText>{`Hello ${firstName} ${lastName}`}</EuiText>
);

export const Routes: React.FC<{}> = () => {
const query = useQuery();

return (
<EuiPageBody>
<EuiPageContent>
<EuiPageContentBody>
<Switch>
<Route path="/hello">
<HelloPage
firstName={query.get('firstName') || ''}
lastName={query.get('lastName') || ''}
/>
</Route>
<Redirect from="/" to="/hello" />
</Switch>
</EuiPageContentBody>
</EuiPageContent>
</EuiPageBody>
);
};

export const LinksExample: React.FC<{
appBasePath: string;
}> = props => {
const history = React.useMemo(
() =>
createBrowserHistory({
basename: props.appBasePath,
}),
[props.appBasePath]
);
return (
<Router history={history}>
<Routes />
</Router>
);
};

export const renderApp = (props: { appBasePath: string }, { element }: AppMountParameters) => {
ReactDOM.render(<LinksExample {...props} />, element);

return () => ReactDOM.unmountComponentAtNode(element);
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* under the License.
*/

declare module 'ui/time_buckets' {
export const TimeBuckets: any;
}
import { AccessLinksExamplesPlugin } from './plugin';

export const plugin = () => new AccessLinksExamplesPlugin();
76 changes: 76 additions & 0 deletions examples/url_generators_examples/public/plugin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { SharePluginStart, SharePluginSetup } from '../../../src/plugins/share/public';
import { Plugin, CoreSetup, AppMountParameters } from '../../../src/core/public';
import {
HelloLinkGeneratorState,
createHelloPageLinkGenerator,
LegacyHelloLinkGeneratorState,
HELLO_URL_GENERATOR_V1,
HELLO_URL_GENERATOR,
helloPageLinkGeneratorV1,
} from './url_generator';

declare module '../../../src/plugins/share/public' {
export interface UrlGeneratorStateMapping {
[HELLO_URL_GENERATOR_V1]: LegacyHelloLinkGeneratorState;
[HELLO_URL_GENERATOR]: HelloLinkGeneratorState;
}
}

interface StartDeps {
share: SharePluginStart;
}

interface SetupDeps {
share: SharePluginSetup;
}

const APP_ID = 'urlGeneratorsExamples';

export class AccessLinksExamplesPlugin implements Plugin<void, void, SetupDeps, StartDeps> {
public setup(core: CoreSetup<StartDeps>, { share: { urlGenerators } }: SetupDeps) {
urlGenerators.registerUrlGenerator(
createHelloPageLinkGenerator(async () => ({
appBasePath: (await core.getStartServices())[0].application.getUrlForApp(APP_ID),
}))
);

urlGenerators.registerUrlGenerator(helloPageLinkGeneratorV1);

core.application.register({
id: APP_ID,
title: 'Access links examples',
async mount(params: AppMountParameters) {
const { renderApp } = await import('./app');
return renderApp(
{
appBasePath: params.appBasePath,
},
params
);
},
});
}

public start() {}

public stop() {}
}
78 changes: 78 additions & 0 deletions examples/url_generators_examples/public/url_generator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import url from 'url';
import { UrlGeneratorState, UrlGeneratorsDefinition } from '../../../src/plugins/share/public';

/**
* The name of the latest variable can always stay the same so code that
* uses this link generator statically will switch to the latest version.
* Typescript will warn the developer if incorrect state is being passed
* down.
*/
export const HELLO_URL_GENERATOR = 'HELLO_URL_GENERATOR_V2';

export interface HelloLinkState {
firstName: string;
lastName: string;
}

export type HelloLinkGeneratorState = UrlGeneratorState<HelloLinkState>;

export const createHelloPageLinkGenerator = (
getStartServices: () => Promise<{ appBasePath: string }>
): UrlGeneratorsDefinition<typeof HELLO_URL_GENERATOR> => ({
id: HELLO_URL_GENERATOR,
createUrl: async state => {
const startServices = await getStartServices();
const appBasePath = startServices.appBasePath;
const parsedUrl = url.parse(window.location.href);

return url.format({
protocol: parsedUrl.protocol,
host: parsedUrl.host,
pathname: `${appBasePath}/hello`,
query: {
...state,
},
});
},
});

/**
* The name of this legacy generator id changes, but the *value* stays the same.
*/
export const HELLO_URL_GENERATOR_V1 = 'HELLO_URL_GENERATOR';

export interface HelloLinkStateV1 {
name: string;
}

export type LegacyHelloLinkGeneratorState = UrlGeneratorState<
HelloLinkStateV1,
typeof HELLO_URL_GENERATOR,
HelloLinkState
>;

export const helloPageLinkGeneratorV1: UrlGeneratorsDefinition<typeof HELLO_URL_GENERATOR_V1> = {
id: HELLO_URL_GENERATOR_V1,
isDeprecated: true,
migrate: async state => {
return { id: HELLO_URL_GENERATOR, state: { firstName: state.name, lastName: '' } };
},
};
15 changes: 15 additions & 0 deletions examples/url_generators_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
},
"include": [
"index.ts",
"public/**/*.ts",
"public/**/*.tsx",
"server/**/*.ts",
"../../typings/**/*"
],
"exclude": []
}
Loading

0 comments on commit 3e1e145

Please sign in to comment.