Skip to content

Commit

Permalink
Merge branch 'master' into setup-config-folder-with-env-var-on-fpm-os…
Browse files Browse the repository at this point in the history
…-packages
  • Loading branch information
mistic committed May 26, 2020
2 parents 5c98e27 + 85bdd94 commit 1b4252f
Show file tree
Hide file tree
Showing 7,318 changed files with 36,619 additions and 40,036 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ELASTIC_LICENSE_HEADER = `
`;

const allMochaRulesOff = {};
Object.keys(require('eslint-plugin-mocha').rules).forEach(k => {
Object.keys(require('eslint-plugin-mocha').rules).forEach((k) => {
allMochaRulesOff['mocha/' + k] = 'off';
});

Expand Down
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,14 @@ module.exports = {
};
```

APM [Real User Monitoring agent](https://www.elastic.co/guide/en/apm/agent/rum-js/current/index.html) is not available in the Kibana distributables,
however the agent can be enabled by setting `ELASTIC_APM_ACTIVE` to `true`.
flags
```
ELASTIC_APM_ACTIVE=true yarn start
// activates both Node.js and RUM agent
```

Once the agent is active, it will trace all incoming HTTP requests to Kibana, monitor for errors, and collect process-level metrics.
The collected data will be sent to the APM Server and is viewable in the APM UI in Kibana.

Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

require('./src/setup_node_env');

module.exports = function(grunt) {
module.exports = function (grunt) {
// set the config once before calling load-grunt-config
// and once during so that we have access to it via
// grunt.config.get() within the config files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Returns an URL to a given app, including the global base path. By default, the URL is relative (/basePath/app/my-app). Use the `absolute` option to generate an absolute url (http://host:port/basePath/app/my-app)

Note that when generating absolute urls, the protocol, host and port are determined from the browser location.
Note that when generating absolute urls, the origin (protocol, host and port) are determined from the browser's location.

<b>Signature:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export interface ApplicationStart

| Method | Description |
| --- | --- |
| [getUrlForApp(appId, options)](./kibana-plugin-core-public.applicationstart.geturlforapp.md) | Returns an URL to a given app, including the global base path. By default, the URL is relative (/basePath/app/my-app). Use the <code>absolute</code> option to generate an absolute url (http://host:port/basePath/app/my-app)<!-- -->Note that when generating absolute urls, the protocol, host and port are determined from the browser location. |
| [getUrlForApp(appId, options)](./kibana-plugin-core-public.applicationstart.geturlforapp.md) | Returns an URL to a given app, including the global base path. By default, the URL is relative (/basePath/app/my-app). Use the <code>absolute</code> option to generate an absolute url (http://host:port/basePath/app/my-app)<!-- -->Note that when generating absolute urls, the origin (protocol, host and port) are determined from the browser's location. |
| [navigateToApp(appId, options)](./kibana-plugin-core-public.applicationstart.navigatetoapp.md) | Navigate to a given app |
| [navigateToUrl(url)](./kibana-plugin-core-public.applicationstart.navigatetourl.md) | Navigate to given url, which can either be an absolute url or a relative path, in a SPA friendly way when possible.<!-- -->If all these criteria are true for the given url: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The pathname of the URL starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's <code>appRoute</code> configuration)<!-- -->Then a SPA navigation will be performed using <code>navigateToApp</code> using the corresponding application and path. Otherwise, fallback to a full page reload to navigate to the url using <code>window.location.assign</code> |
| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationstart.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [ApplicationStart](./kibana-plugin-core-public.applicationstart.md) &gt; [navigateToUrl](./kibana-plugin-core-public.applicationstart.navigatetourl.md)

## ApplicationStart.navigateToUrl() method

Navigate to given url, which can either be an absolute url or a relative path, in a SPA friendly way when possible.

If all these criteria are true for the given url: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The pathname of the URL starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's `appRoute` configuration)

Then a SPA navigation will be performed using `navigateToApp` using the corresponding application and path. Otherwise, fallback to a full page reload to navigate to the url using `window.location.assign`

<b>Signature:</b>

```typescript
navigateToUrl(url: string): Promise<void>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| url | <code>string</code> | an absolute url, or a relative path, to navigate to. |

<b>Returns:</b>

`Promise<void>`

## Example


```ts
// current url: `https://kibana:8080/base-path/s/my-space/app/dashboard`

// will call `application.navigateToApp('discover', { path: '/some-path?foo=bar'})`
application.navigateToUrl('https://kibana:8080/base-path/s/my-space/app/discover/some-path?foo=bar')
application.navigateToUrl('/base-path/s/my-space/app/discover/some-path?foo=bar')

// will perform a full page reload using `window.location.assign`
application.navigateToUrl('https://elsewhere:8080/base-path/s/my-space/app/discover/some-path') // origin does not match
application.navigateToUrl('/app/discover/some-path') // does not include the current basePath
application.navigateToUrl('/base-path/s/my-space/app/unknown-app/some-path') // unknown application

```

Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const AlwaysFiringExpression: React.FunctionComponent<AlwaysFiringParamsP
<EuiFieldNumber
name="instances"
value={instances}
onChange={event => {
onChange={(event) => {
setAlertParams('instances', event.target.valueAsNumber);
}}
/>
Expand Down
10 changes: 5 additions & 5 deletions examples/alerting_example/public/alert_types/astros.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface PeopleinSpaceParamsProps {
}

function isValueInEnum(enumeratin: Record<string, any>, value: any): boolean {
return !!Object.values(enumeratin).find(enumVal => enumVal === value);
return !!Object.values(enumeratin).find((enumVal) => enumVal === value);
}

export function getAlertType(): AlertTypeModel {
Expand Down Expand Up @@ -139,7 +139,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam

const errorsCallout = flatten(
Object.entries(errors).map(([field, errs]: [string, string[]]) =>
errs.map(e => (
errs.map((e) => (
<p>
<EuiTextColor color="accent">{field}:</EuiTextColor>`: ${errs}`
</p>
Expand Down Expand Up @@ -189,7 +189,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam
<EuiSelect
compressed
value={craftTrigger.craft}
onChange={event => {
onChange={(event) => {
setAlertParams('craft', event.target.value);
setCraftTrigger({
craft: event.target.value,
Expand Down Expand Up @@ -238,7 +238,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam
<EuiSelect
compressed
value={outerSpaceCapacityTrigger.op}
onChange={event => {
onChange={(event) => {
setAlertParams('op', event.target.value);
setOuterSpaceCapacity({
...outerSpaceCapacityTrigger,
Expand All @@ -258,7 +258,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam
<EuiFieldNumber
compressed
value={outerSpaceCapacityTrigger.outerSpaceCapacity}
onChange={event => {
onChange={(event) => {
setAlertParams('outerSpaceCapacity', event.target.valueAsNumber);
setOuterSpaceCapacity({
...outerSpaceCapacityTrigger,
Expand Down
5 changes: 1 addition & 4 deletions examples/alerting_example/server/alert_types/astros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ export const alertType: AlertType = {

if (getOperator(op)(peopleInCraft.length, outerSpaceCapacity)) {
peopleInCraft.forEach(({ craft, name }) => {
services
.alertInstanceFactory(name)
.replaceState({ craft })
.scheduleActions('default');
services.alertInstanceFactory(name).replaceState({ craft }).scheduleActions('default');
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const CountUntil: React.FC<Props> = ({ fetchStreaming }) => {
<EuiFieldNumber
placeholder="Some integer"
value={data}
onChange={e => setData(Number(e.target.value))}
onChange={(e) => setData(Number(e.target.value))}
/>
</EuiFormRow>
<EuiButton type="submit" fill onClick={handleSubmit}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ export const DoubleIntegers: React.FC<Props> = ({ double }) => {
setShowingResults(true);
const nums = numbers
.split('\n')
.map(num => num.trim())
.map((num) => num.trim())
.filter(Boolean)
.map(Number);
counter.set(nums.length);
nums.forEach(num => {
nums.forEach((num) => {
double({ num }).then(
result => {
(result) => {
if (!isMounted()) return;
counter.dec();
pushResult({ num, result });
},
error => {
(error) => {
if (!isMounted()) return;
counter.dec();
pushResult({ num, error });
Expand Down Expand Up @@ -94,7 +94,7 @@ export const DoubleIntegers: React.FC<Props> = ({ double }) => {
fullWidth
placeholder="Enter numbers in milliseconds separated by new line"
value={numbers}
onChange={e => setNumbers(e.target.value)}
onChange={(e) => setNumbers(e.target.value)}
/>
</EuiFormRow>
<EuiButton type="submit" fill onClick={handleSubmit}>
Expand Down
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/public/containers/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const App: React.FC = () => {
const routeElements: React.ReactElement[] = [];
for (const { items } of routes) {
for (const { id, component } of items) {
routeElements.push(<Route key={id} path={`/${id}`} render={props => component} />);
routeElements.push(<Route key={id} path={`/${id}`} render={(props) => component} />);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const Sidebar: React.FC<SidebarProps> = () => {
id,
name: title,
isSelected: true,
items: items.map(route => ({
items: items.map((route) => ({
id: route.id,
name: route.title,
onClick: () => history.push(`/${route.id}`),
Expand Down
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class BfetchExplorerPlugin implements Plugin {
// Validate inputs.
if (num < 0) throw new Error('Invalid number');
// Wait number of specified milliseconds.
await new Promise(r => setTimeout(r, num));
await new Promise((r) => setTimeout(r, num));
// Double the number and send it back.
return { num: 2 * num };
},
Expand Down
4 changes: 2 additions & 2 deletions examples/demo_search/server/async_demo_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const totalMap = new Map<string, number>();

export const asyncDemoSearchStrategyProvider: TSearchStrategyProvider<typeof ASYNC_DEMO_SEARCH_STRATEGY> = () => {
return {
search: async request => {
search: async (request) => {
const id = request.id ?? generateId();

const loaded = (loadedMap.get(id) ?? 0) + 1;
Expand All @@ -52,7 +52,7 @@ export const asyncDemoSearchStrategyProvider: TSearchStrategyProvider<typeof ASY
const fibonacciSequence = getFibonacciSequence(loaded);
return { id, total, loaded, fibonacciSequence };
},
cancel: async id => {
cancel: async (id) => {
loadedMap.delete(id);
totalMap.delete(id);
},
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_search/server/demo_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DEMO_SEARCH_STRATEGY } from '../common';

export const demoSearchStrategyProvider: TSearchStrategyProvider<typeof DEMO_SEARCH_STRATEGY> = () => {
return {
search: request => {
search: (request) => {
return Promise.resolve({
greeting:
request.mood === 'happy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function renderList(
embeddableServices: EmbeddableStart
) {
let number = 0;
const list = Object.values(panels).map(panel => {
const list = Object.values(panels).map((panel) => {
const child = embeddable.getChild(panel.explicitInput.id);
number++;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function wrapSearchTerms(task: string, search?: string) {
}

function renderTasks(tasks: MultiTaskTodoInput['tasks'], search?: string) {
return tasks.map(task => (
return tasks.map((task) => (
<EuiListGroupItem
key={task}
data-test-subj="multiTaskTodoTask"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function getHasMatch(tasks: string[], title?: string, search?: string) {

if (title && title.match(search)) return true;

const match = tasks.find(task => task.match(search));
const match = tasks.find((task) => task.match(search));
if (match) return true;

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,26 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat

const checked: { [id: string]: boolean } = {};
const hasMatch: { [id: string]: boolean } = {};
props.embeddable.getChildIds().forEach(id => {
props.embeddable.getChildIds().forEach((id) => {
checked[id] = false;
const output = props.embeddable.getChild(id).getOutput();
hasMatch[id] = hasHasMatchOutput(output) && output.hasMatch;
});
props.embeddable.getChildIds().forEach(id => (checked[id] = false));
props.embeddable.getChildIds().forEach((id) => (checked[id] = false));
this.state = {
checked,
hasMatch,
};
}

componentDidMount() {
this.props.embeddable.getChildIds().forEach(id => {
this.props.embeddable.getChildIds().forEach((id) => {
this.subscriptions[id] = this.props.embeddable
.getChild(id)
.getOutput$()
.subscribe(output => {
.subscribe((output) => {
if (hasHasMatchOutput(output)) {
this.setState(prevState => ({
this.setState((prevState) => ({
hasMatch: {
...prevState.hasMatch,
[id]: output.hasMatch,
Expand All @@ -96,15 +96,15 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
}

componentWillUnmount() {
Object.values(this.subscriptions).forEach(sub => sub.unsubscribe());
Object.values(this.subscriptions).forEach((sub) => sub.unsubscribe());
}

private updateSearch = (search: string) => {
this.props.embeddable.updateInput({ search });
};

private deleteChecked = () => {
Object.values(this.props.input.panels).map(panel => {
Object.values(this.props.input.panels).map((panel) => {
if (this.state.checked[panel.explicitInput.id]) {
this.props.embeddable.removeEmbeddable(panel.explicitInput.id);
this.subscriptions[panel.explicitInput.id].unsubscribe();
Expand All @@ -115,7 +115,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
private checkMatching = () => {
const { input, embeddable } = this.props;
const checked: { [key: string]: boolean } = {};
Object.values(input.panels).map(panel => {
Object.values(input.panels).map((panel) => {
const child = embeddable.getChild(panel.explicitInput.id);
const output = child.getOutput();
if (hasHasMatchOutput(output) && output.hasMatch) {
Expand All @@ -126,7 +126,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
};

private toggleCheck = (isChecked: boolean, id: string) => {
this.setState(prevState => ({ checked: { ...prevState.checked, [id]: isChecked } }));
this.setState((prevState) => ({ checked: { ...prevState.checked, [id]: isChecked } }));
};

public renderControls() {
Expand Down Expand Up @@ -156,7 +156,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
<EuiFieldText
data-test-subj="filterTodos"
value={this.props.input.search || ''}
onChange={ev => this.updateSearch(ev.target.value)}
onChange={(ev) => this.updateSearch(ev.target.value)}
/>
</EuiFormRow>
</EuiFlexItem>
Expand All @@ -183,7 +183,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
private renderList() {
const { embeddableServices, input, embeddable } = this.props;
let id = 0;
const list = Object.values(input.panels).map(panel => {
const list = Object.values(input.panels).map((panel) => {
const childEmbeddable = embeddable.getChild(panel.explicitInput.id);
id++;
return childEmbeddable ? (
Expand All @@ -195,7 +195,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
disabled={!childEmbeddable}
id={childEmbeddable ? childEmbeddable.id : ''}
checked={this.state.checked[childEmbeddable.id]}
onChange={e => this.toggleCheck(e.target.checked, childEmbeddable.id)}
onChange={(e) => this.toggleCheck(e.target.checked, childEmbeddable.id)}
/>
</EuiFlexItem>
<EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function TaskInput({ onSave }: { onSave: (task: string) => void }) {
data-test-subj="taskInputField"
value={task}
placeholder="Enter task here"
onChange={e => setTask(e.target.value)}
onChange={(e) => setTask(e.target.value)}
/>
<EuiButton data-test-subj="createTodoEmbeddable" onClick={() => onSave(task)}>
Save
Expand Down Expand Up @@ -69,7 +69,7 @@ export class TodoEmbeddableFactory
*/
public getExplicitInput = async () => {
const { openModal } = await this.getStartServices();
return new Promise<{ task: string }>(resolve => {
return new Promise<{ task: string }>((resolve) => {
const onSave = (task: string) => resolve({ task });
const overlay = openModal(
toMountPoint(
Expand Down
Loading

0 comments on commit 1b4252f

Please sign in to comment.