Skip to content

Commit a045b9c

Browse files
committed
Merge branch 'master' into dynamic-action
2 parents a25cf30 + bb86bf2 commit a045b9c

File tree

173 files changed

+3964
-3943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+3964
-3943
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# App
66
/x-pack/legacy/plugins/lens/ @elastic/kibana-app
77
/x-pack/legacy/plugins/graph/ @elastic/kibana-app
8-
/src/plugins/share/ @elastic/kibana-app
98
/src/legacy/server/url_shortening/ @elastic/kibana-app
109
/src/legacy/server/sample_data/ @elastic/kibana-app
1110
/src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app
@@ -27,6 +26,7 @@
2726
/src/plugins/kibana_legacy/ @elastic/kibana-app
2827
/src/plugins/timelion/ @elastic/kibana-app
2928
/src/plugins/dev_tools/ @elastic/kibana-app
29+
/src/plugins/dashboard_embeddable_container/ @elastic/kibana-app
3030

3131
# App Architecture
3232
/packages/kbn-interpreter/ @elastic/kibana-app-arch
@@ -42,7 +42,6 @@
4242
/src/legacy/core_plugins/visualizations/ @elastic/kibana-app-arch
4343
/src/legacy/server/index_patterns/ @elastic/kibana-app-arch
4444
/src/plugins/bfetch/ @elastic/kibana-app-arch
45-
/src/plugins/dashboard_embeddable_container/ @elastic/kibana-app-arch
4645
/src/plugins/data/ @elastic/kibana-app-arch
4746
/src/plugins/embeddable/ @elastic/kibana-app-arch
4847
/src/plugins/expressions/ @elastic/kibana-app-arch
@@ -53,6 +52,9 @@
5352
/src/plugins/navigation/ @elastic/kibana-app-arch
5453
/src/plugins/ui_actions/ @elastic/kibana-app-arch
5554
/src/plugins/visualizations/ @elastic/kibana-app-arch
55+
/src/plugins/share/ @elastic/kibana-app-arch
56+
/examples/url_generators_examples/ @elastic/kibana-app-arch
57+
/examples/url_generators_explorer/ @elastic/kibana-app-arch
5658
/x-pack/plugins/advanced_ui_actions/ @elastic/kibana-app-arch
5759
/x-pack/plugins/drilldowns/ @elastic/kibana-app-arch
5860

docs/development/core/server/kibana-plugin-server.coresetup.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface CoreSetup<TPluginsStart extends object = object>
2020
| [context](./kibana-plugin-server.coresetup.context.md) | <code>ContextSetup</code> | [ContextSetup](./kibana-plugin-server.contextsetup.md) |
2121
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>ElasticsearchServiceSetup</code> | [ElasticsearchServiceSetup](./kibana-plugin-server.elasticsearchservicesetup.md) |
2222
| [http](./kibana-plugin-server.coresetup.http.md) | <code>HttpServiceSetup</code> | [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) |
23+
| [metrics](./kibana-plugin-server.coresetup.metrics.md) | <code>MetricsServiceSetup</code> | [MetricsServiceSetup](./kibana-plugin-server.metricsservicesetup.md) |
2324
| [savedObjects](./kibana-plugin-server.coresetup.savedobjects.md) | <code>SavedObjectsServiceSetup</code> | [SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md) |
2425
| [uiSettings](./kibana-plugin-server.coresetup.uisettings.md) | <code>UiSettingsServiceSetup</code> | [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) |
2526
| [uuid](./kibana-plugin-server.coresetup.uuid.md) | <code>UuidServiceSetup</code> | [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[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)
4+
5+
## CoreSetup.metrics property
6+
7+
[MetricsServiceSetup](./kibana-plugin-server.metricsservicesetup.md)
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
metrics: MetricsServiceSetup;
13+
```

docs/setup/settings.asciidoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,6 @@ deprecation warning at startup. This setting cannot end in a slash (`/`).
325325
proxy sitting in front of it. This determines whether HTTP compression may be used for responses, based on the request's `Referer` header.
326326
This setting may not be used when `server.compression.enabled` is set to `false`.
327327

328-
[[server-cors]]`server.cors:`:: *Default: `false`* Set to `true` to enable CORS support. This setting is required to configure `server.cors.origin`.
329-
330-
`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: ["*"]`.
331-
332328
`server.customResponseHeaders:`:: *Default: `{}`* Header names and values to
333329
send on all responses to the client from the Kibana server.
334330

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Access links examples
2+
3+
This example app shows how to:
4+
- Register a direct access link generator.
5+
- Handle migration of legacy generators into a new one.
6+
7+
To run this example, use the command `yarn start --run-examples`. Navigate to the access links explorer app
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"id": "urlGeneratorsExamples",
3+
"version": "0.0.1",
4+
"kibanaVersion": "kibana",
5+
"configPath": ["url_generators_examples"],
6+
"server": false,
7+
"ui": true,
8+
"requiredPlugins": ["share"],
9+
"optionalPlugins": []
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "url_generators_examples",
3+
"version": "1.0.0",
4+
"main": "target/examples/url_generators_examples",
5+
"kibana": {
6+
"version": "kibana",
7+
"templateVersion": "1.0.0"
8+
},
9+
"license": "Apache-2.0",
10+
"scripts": {
11+
"kbn": "node ../../scripts/kbn.js",
12+
"build": "rm -rf './target' && tsc"
13+
},
14+
"devDependencies": {
15+
"typescript": "3.5.3"
16+
}
17+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import React from 'react';
21+
import ReactDOM from 'react-dom';
22+
23+
import { EuiPageBody } from '@elastic/eui';
24+
import { EuiPageContent } from '@elastic/eui';
25+
import { EuiPageContentBody } from '@elastic/eui';
26+
import { Route, Switch, Redirect, Router, useLocation } from 'react-router-dom';
27+
import { createBrowserHistory } from 'history';
28+
import { EuiText } from '@elastic/eui';
29+
import { AppMountParameters } from '../../../src/core/public';
30+
31+
function useQuery() {
32+
const { search } = useLocation();
33+
const params = React.useMemo(() => new URLSearchParams(search), [search]);
34+
return params;
35+
}
36+
37+
interface HelloPageProps {
38+
firstName: string;
39+
lastName: string;
40+
}
41+
42+
const HelloPage = ({ firstName, lastName }: HelloPageProps) => (
43+
<EuiText>{`Hello ${firstName} ${lastName}`}</EuiText>
44+
);
45+
46+
export const Routes: React.FC<{}> = () => {
47+
const query = useQuery();
48+
49+
return (
50+
<EuiPageBody>
51+
<EuiPageContent>
52+
<EuiPageContentBody>
53+
<Switch>
54+
<Route path="/hello">
55+
<HelloPage
56+
firstName={query.get('firstName') || ''}
57+
lastName={query.get('lastName') || ''}
58+
/>
59+
</Route>
60+
<Redirect from="/" to="/hello" />
61+
</Switch>
62+
</EuiPageContentBody>
63+
</EuiPageContent>
64+
</EuiPageBody>
65+
);
66+
};
67+
68+
export const LinksExample: React.FC<{
69+
appBasePath: string;
70+
}> = props => {
71+
const history = React.useMemo(
72+
() =>
73+
createBrowserHistory({
74+
basename: props.appBasePath,
75+
}),
76+
[props.appBasePath]
77+
);
78+
return (
79+
<Router history={history}>
80+
<Routes />
81+
</Router>
82+
);
83+
};
84+
85+
export const renderApp = (props: { appBasePath: string }, { element }: AppMountParameters) => {
86+
ReactDOM.render(<LinksExample {...props} />, element);
87+
88+
return () => ReactDOM.unmountComponentAtNode(element);
89+
};

src/legacy/ui/public/time_buckets/index.d.ts renamed to examples/url_generators_examples/public/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
declare module 'ui/time_buckets' {
21-
export const TimeBuckets: any;
22-
}
20+
import { AccessLinksExamplesPlugin } from './plugin';
21+
22+
export const plugin = () => new AccessLinksExamplesPlugin();
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { SharePluginStart, SharePluginSetup } from '../../../src/plugins/share/public';
21+
import { Plugin, CoreSetup, AppMountParameters } from '../../../src/core/public';
22+
import {
23+
HelloLinkGeneratorState,
24+
createHelloPageLinkGenerator,
25+
LegacyHelloLinkGeneratorState,
26+
HELLO_URL_GENERATOR_V1,
27+
HELLO_URL_GENERATOR,
28+
helloPageLinkGeneratorV1,
29+
} from './url_generator';
30+
31+
declare module '../../../src/plugins/share/public' {
32+
export interface UrlGeneratorStateMapping {
33+
[HELLO_URL_GENERATOR_V1]: LegacyHelloLinkGeneratorState;
34+
[HELLO_URL_GENERATOR]: HelloLinkGeneratorState;
35+
}
36+
}
37+
38+
interface StartDeps {
39+
share: SharePluginStart;
40+
}
41+
42+
interface SetupDeps {
43+
share: SharePluginSetup;
44+
}
45+
46+
const APP_ID = 'urlGeneratorsExamples';
47+
48+
export class AccessLinksExamplesPlugin implements Plugin<void, void, SetupDeps, StartDeps> {
49+
public setup(core: CoreSetup<StartDeps>, { share: { urlGenerators } }: SetupDeps) {
50+
urlGenerators.registerUrlGenerator(
51+
createHelloPageLinkGenerator(async () => ({
52+
appBasePath: (await core.getStartServices())[0].application.getUrlForApp(APP_ID),
53+
}))
54+
);
55+
56+
urlGenerators.registerUrlGenerator(helloPageLinkGeneratorV1);
57+
58+
core.application.register({
59+
id: APP_ID,
60+
title: 'Access links examples',
61+
async mount(params: AppMountParameters) {
62+
const { renderApp } = await import('./app');
63+
return renderApp(
64+
{
65+
appBasePath: params.appBasePath,
66+
},
67+
params
68+
);
69+
},
70+
});
71+
}
72+
73+
public start() {}
74+
75+
public stop() {}
76+
}

0 commit comments

Comments
 (0)