Skip to content

Commit d762903

Browse files
Merge branch 'master' into codeowners-observability
2 parents d855c72 + 62e3189 commit d762903

821 files changed

Lines changed: 13666 additions & 7256 deletions

File tree

Some content is hidden

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

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ bower_components
1111
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
1212
/src/legacy/core_plugins/vis_type_timelion/public/_generated_/**
1313
src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data
14-
/src/legacy/ui/public/angular-bootstrap
1514
/src/legacy/ui/public/flot-charts
1615
/test/fixtures/scenarios
1716
/src/legacy/core_plugins/console/public/webpackShims

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ module.exports = {
302302
'test/plugin_functional/plugins/**/public/np_ready/**/*',
303303
'test/plugin_functional/plugins/**/server/np_ready/**/*',
304304
'src/legacy/core_plugins/**/public/np_ready/**/*',
305+
'src/legacy/core_plugins/vis_type_*/public/**/*',
306+
'!src/legacy/core_plugins/vis_type_*/public/legacy*',
305307
'src/legacy/core_plugins/**/server/np_ready/**/*',
306308
'x-pack/legacy/plugins/**/public/np_ready/**/*',
307309
'x-pack/legacy/plugins/**/server/np_ready/**/*',

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ A high level overview of our contributing guidelines.
2727
- [Instrumenting with Elastic APM](#instrumenting-with-elastic-apm)
2828
- [Debugging Unit Tests](#debugging-unit-tests)
2929
- [Unit Testing Plugins](#unit-testing-plugins)
30+
- [Automated Accessibility Testing](#automated-accessibility-testing)
3031
- [Cross-browser compatibility](#cross-browser-compatibility)
3132
- [Testing compatibility locally](#testing-compatibility-locally)
3233
- [Running Browser Automation Tests](#running-browser-automation-tests)
@@ -553,6 +554,23 @@ yarn test:mocha
553554
yarn test:browser --dev # remove the --dev flag to run them once and close
554555
```
555556

557+
### Automated Accessibility Testing
558+
559+
To run the tests locally:
560+
561+
1. In one terminal window run `node scripts/functional_tests_server --config test/accessibility/config.ts`
562+
2. In another terminal window run `node scripts/functional_test_runner.js --config test/accessibility/config.ts`
563+
564+
To run the x-pack tests, swap the config file out for `x-pack/test/accessibility/config.ts`.
565+
566+
After the server is up, you can go to this instance of Kibana at `localhost:5620`.
567+
568+
The testing is done using [axe](https://github.com/dequelabs/axe-core). The same thing that runs in CI,
569+
can be run locally using their browser plugins:
570+
571+
- [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)
572+
- [Firefox](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/)
573+
556574
### Cross-browser Compatibility
557575

558576
#### Testing Compatibility Locally

STYLEGUIDE.md

Lines changed: 83 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ recommended for the development of all Kibana plugins.
66
Besides the content in this style guide, the following style guides may also apply
77
to all development within the Kibana project. Please make sure to also read them:
88

9-
- [Accessibility style guide](style_guides/accessibility_guide.md)
9+
- [Accessibility style guide](https://elastic.github.io/eui/#/guidelines/accessibility)
1010
- [SASS style guide](https://elastic.github.io/eui/#/guidelines/sass)
1111

1212
## General
@@ -45,10 +45,7 @@ This part contains style guide rules around general (framework agnostic) HTML us
4545
Use camel case for the values of attributes such as `id` and `data-test-subj` selectors.
4646

4747
```html
48-
<button
49-
id="veryImportantButton"
50-
data-test-subj="clickMeButton"
51-
>
48+
<button id="veryImportantButton" data-test-subj="clickMeButton">
5249
Click me
5350
</button>
5451
```
@@ -74,6 +71,59 @@ It's important that when you write CSS/SASS selectors using classes, IDs, and at
7471
capitalization in the CSS matches that used in the HTML. HTML and CSS follow different case sensitivity rules, and we can avoid subtle gotchas by ensuring we use the
7572
same capitalization in both of them.
7673
74+
### How to generate ids?
75+
76+
When labeling elements (and for some other accessibility tasks) you will often need
77+
ids. Ids must be unique within the page i.e. no duplicate ids in the rendered DOM
78+
at any time.
79+
80+
Since we have some components that are used multiple times on the page, you must
81+
make sure every instance of that component has a unique `id`. To make the generation
82+
of those `id`s easier, you can use the `htmlIdGenerator` service in the `@elastic/eui`.
83+
84+
A React component could use it as follows:
85+
86+
```jsx
87+
import { htmlIdGenerator } from '@elastic/eui';
88+
89+
render() {
90+
// Create a new generator that will create ids deterministic
91+
const htmlId = htmlIdGenerator();
92+
return (<div>
93+
<label htmlFor={htmlId('agg')}>Aggregation</label>
94+
<input id={htmlId('agg')}/>
95+
</div>);
96+
}
97+
```
98+
99+
Each id generator you create by calling `htmlIdGenerator()` will generate unique but
100+
deterministic ids. As you can see in the above example, that single generator
101+
created the same id in the label's `htmlFor` as well as the input's `id`.
102+
103+
A single generator instance will create the same id when passed the same argument
104+
to the function multiple times. But two different generators will produce two different
105+
ids for the same argument to the function, as you can see in the following example:
106+
107+
```js
108+
const generatorOne = htmlIdGenerator();
109+
const generatorTwo = htmlIdGenerator();
110+
111+
// Those statements are always true:
112+
// Same generator
113+
generatorOne('foo') === generatorOne('foo');
114+
generatorOne('foo') !== generatorOne('bar');
115+
116+
// Different generator
117+
generatorOne('foo') !== generatorTwo('foo');
118+
```
119+
120+
This allows multiple instances of a single React component to now have different ids.
121+
If you include the above React component multiple times in the same page,
122+
each component instance will have a unique id, because each render method will use a different
123+
id generator.
124+
125+
You can also use this service outside of React.
126+
77127
## API endpoints
78128
79129
The following style guide rules are targeting development of server side API endpoints.
@@ -90,7 +140,8 @@ API routes must start with the `/api/` path segment, and should be followed by t
90140
91141
Kibana uses `snake_case` for the entire API, just like Elasticsearch. All urls, paths, query string parameters, values, and bodies should be `snake_case` formatted.
92142
93-
*Right:*
143+
_Right:_
144+
94145
```
95146
POST /api/kibana/index_patterns
96147
{
@@ -108,19 +159,19 @@ The following style guide rules apply for working with TypeScript/JavaScript fil
108159
109160
### TypeScript vs. JavaScript
110161
111-
Whenever possible, write code in TypeScript instead of JavaScript, especially if it's new code.
162+
Whenever possible, write code in TypeScript instead of JavaScript, especially if it's new code.
112163
Check out [TYPESCRIPT.md](TYPESCRIPT.md) for help with this process.
113164
114165
### Prefer modern JavaScript/TypeScript syntax
115166
116167
You should prefer modern language features in a lot of cases, e.g.:
117168
118-
* Prefer `class` over `prototype` inheritance
119-
* Prefer arrow function over function expressions
120-
* Prefer arrow function over storing `this` (no `const self = this;`)
121-
* Prefer template strings over string concatenation
122-
* Prefer the spread operator for copying arrays (`[...arr]`) over `arr.slice()`
123-
* Use optional chaining (`?.`) and nullish Coalescing (`??`) over `lodash.get` (and similar utilities)
169+
- Prefer `class` over `prototype` inheritance
170+
- Prefer arrow function over function expressions
171+
- Prefer arrow function over storing `this` (no `const self = this;`)
172+
- Prefer template strings over string concatenation
173+
- Prefer the spread operator for copying arrays (`[...arr]`) over `arr.slice()`
174+
- Use optional chaining (`?.`) and nullish Coalescing (`??`) over `lodash.get` (and similar utilities)
124175
125176
### Avoid mutability and state
126177
@@ -131,7 +182,7 @@ Instead, create new variables, and shallow copies of objects and arrays:
131182
```js
132183
// good
133184
function addBar(foos, foo) {
134-
const newFoo = {...foo, name: 'bar'};
185+
const newFoo = { ...foo, name: 'bar' };
135186
return [...foos, newFoo];
136187
}
137188

@@ -250,8 +301,8 @@ const second = arr[1];
250301
251302
### Magic numbers/strings
252303
253-
These are numbers (or other values) simply used in line in your code. *Do not
254-
use these*, give them a variable name so they can be understood and changed
304+
These are numbers (or other values) simply used in line in your code. _Do not
305+
use these_, give them a variable name so they can be understood and changed
255306
easily.
256307
257308
```js
@@ -325,19 +376,18 @@ import inSibling from '../foo/child';
325376
Don't do this. Everything should be wrapped in a module that can be depended on
326377
by other modules. Even things as simple as a single value should be a module.
327378
328-
329379
### Only use ternary operators for small, simple code
330380
331-
And *never* use multiple ternaries together, because they make it more
381+
And _never_ use multiple ternaries together, because they make it more
332382
difficult to reason about how different values flow through the conditions
333383
involved. Instead, structure the logic for maximum readability.
334384
335385
```js
336386
// good, a situation where only 1 ternary is needed
337-
const foo = (a === b) ? 1 : 2;
387+
const foo = a === b ? 1 : 2;
338388

339389
// bad
340-
const foo = (a === b) ? 1 : (a === c) ? 2 : 3;
390+
const foo = a === b ? 1 : a === c ? 2 : 3;
341391
```
342392
343393
### Use descriptive conditions
@@ -475,13 +525,12 @@ setTimeout(() => {
475525
476526
Use slashes for both single line and multi line comments. Try to write
477527
comments that explain higher level mechanisms or clarify difficult
478-
segments of your code. *Don't use comments to restate trivial things*.
528+
segments of your code. _Don't use comments to restate trivial things_.
479529
480-
*Exception:* Comment blocks describing a function and its arguments
530+
_Exception:_ Comment blocks describing a function and its arguments
481531
(docblock) should start with `/**`, contain a single `*` at the beginning of
482532
each line, and end with `*/`.
483533
484-
485534
```js
486535
// good
487536

@@ -546,11 +595,17 @@ You can read more about these two ngReact methods [here](https://github.com/ngRe
546595
Using `react-component` means adding a bunch of components into angular, while `reactDirective` keeps them isolated, and is also a more succinct syntax.
547596
548597
**Good:**
598+
549599
```html
550-
<hello-component fname="person.fname" lname="person.lname" watch-depth="reference"></hello-component>
600+
<hello-component
601+
fname="person.fname"
602+
lname="person.lname"
603+
watch-depth="reference"
604+
></hello-component>
551605
```
552606
553607
**Bad:**
608+
554609
```html
555610
<react-component name="HelloComponent" props="person" watch-depth="reference" />
556611
```
@@ -564,9 +619,9 @@ Name action functions in the form of a strong verb and passed properties in the
564619
<pagerButton onPageNext={action.turnToNextPage} />
565620
```
566621
567-
## Attribution
622+
## Attribution
568623
569-
Parts of the JavaScript style guide were initially forked from the
570-
[node style guide](https://github.com/felixge/node-style-guide) created by [Felix Geisendörfer](http://felixge.de/) which is
571-
licensed under the [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/)
624+
Parts of the JavaScript style guide were initially forked from the
625+
[node style guide](https://github.com/felixge/node-style-guide) created by [Felix Geisendörfer](http://felixge.de/) which is
626+
licensed under the [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/)
572627
license.

docs/api/spaces-management/get_all.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ The API returns the following:
4242
"color": "#aabbcc",
4343
"disabledFeatures": ["apm"],
4444
"initials": "MK",
45-
"imageUrl": "data:image/png;base64,iVBORw0KGgoAAAANSU",
45+
"imageUrl": "data:image/png;base64,iVBORw0KGgoAAAANSU"
4646
},
4747
{
4848
"id": "sales",
4949
"name": "Sales",
5050
"initials": "MK",
5151
"disabledFeatures": ["discover", "timelion"],
5252
"imageUrl": ""
53-
},
53+
}
5454
]
5555
--------------------------------------------------

docs/apm/troubleshooting.asciidoc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ your proposed changes at https://github.com/elastic/kibana.
66

77
Also check out the https://discuss.elastic.co/c/apm[APM discussion forum].
88

9+
[[no-apm-data-found]]
910
==== No APM data found
1011

1112
This section can help with any of the following:
@@ -69,3 +70,41 @@ or because something is happening to the request that the Agent doesn't understa
6970
To resolve this, you'll need to head over to the relevant {apm-agents-ref}[Agent documentation].
7071
Specifically, view the Agent's supported technologies page.
7172
You can also use the Agent's public API to manually set a name for the transaction.
73+
74+
==== Fields are not searchable
75+
76+
In Elasticsearch, index patterns are used to define settings and mappings that determine how fields should be analyzed.
77+
The recommended index template file for APM Server is installed when Kibana starts.
78+
This template defines which fields are available in Kibana for features like the Kuery bar,
79+
or for linking to other plugins like Logs, Uptime, and Discover.
80+
81+
As an example, some agents store cookie values in `http.request.cookies`.
82+
Since `http.request` has disabled dynamic indexing, and `http.request.cookies` is not declared in a custom mapping,
83+
the values in `http.request.cookies` are not indexed and thus not searchable.
84+
85+
*Ensure an index pattern exists*
86+
As a first step, you should ensure the correct index pattern exists.
87+
In Kibana, navigate to *Management > Kibana > Index Patterns*.
88+
In the pattern list, you should see an apm index pattern; The default is `apm-*`.
89+
If you don't, the index pattern doesn't exist. See <<no-apm-data-found>> for information on how to fix this problem.
90+
91+
Selecting the `apm-*` index pattern shows a listing of every field defined in the pattern.
92+
93+
*Ensure a field is searchable*
94+
There are two things you can do to if you'd like to ensure a field is searchable:
95+
96+
1. Index your additional data as {apm-overview-ref}/metadata.html[labels] instead.
97+
These are dynamic by default, which means they will be indexed and become searchable and aggregatable.
98+
99+
2. Use the {apm-server-ref}/configuration-template.html[`append_fields`] feature. As an example,
100+
adding the following to `apm-server.yml` will enable dynamic indexing for `http.request.cookies`:
101+
102+
[source,yml]
103+
----
104+
setup.template.enabled: true
105+
setup.template.overwrite: true
106+
setup.template.append_fields:
107+
- name: http.request.cookies
108+
type: object
109+
dynamic: true
110+
----

docs/canvas/canvas-elements.asciidoc

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ When you add elements to your workpad, you can:
2020
[[add-canvas-element]]
2121
=== Add elements to your workpad
2222

23-
Choose the elements to display on your workpad, then familiarize yourself with the element using the preconfigured demo data. By default, every element you add to a workpad uses demo data until you change the data source. The demo data includes a small sample data set that you can use to experiment with your element.
23+
Choose the elements to display on your workpad, then familiarize yourself with the element using the preconfigured demo data. By default, most elements use demo data until you change the data source. The demo data includes a small sample data set that you can use to experiment with your element.
24+
25+
To add a Canvas element:
2426

2527
. Click *Add element*.
2628

@@ -31,13 +33,26 @@ image::images/canvas-element-select.gif[Canvas elements]
3133

3234
. Play around with the default settings and see what the element can do.
3335

34-
TIP: Want to use a different element? You can delete the element by selecting it, clicking the *Element options* icon in the top right, then selecting *Delete*.
36+
To add a map:
37+
38+
. Click *Embed object*.
39+
40+
. Select the map you want to add to the workpad.
41+
+
42+
[role="screenshot"]
43+
image::images/canvas-map-embed.gif[]
44+
45+
NOTE: Demo data is only supported on Canvas elements. Maps do not support demo data.
46+
47+
Want to use a different element? You can delete the element by selecting it, clicking the *Element options* icon in the top right, then selecting *Delete*.
3548

3649
[float]
3750
[[connect-element-data]]
38-
=== Connect the element to your data
51+
=== Connect the Canvas element to your data
3952

40-
When you have finished using the demo data, connect the element to a data source.
53+
When you have finished using the demo data, connect the Canvas element to a data source.
54+
55+
NOTE: Maps do not support data sources. To change the map data, refer to <<maps, Elastic Maps>>.
4156

4257
. Make sure that the element is selected, then select *Data*.
4358

@@ -142,7 +157,7 @@ text.align: center;
142157
[[configure-auto-refresh-interval]]
143158
==== Change the data auto-refresh interval
144159

145-
Increase or decrease how often your data refreshes on your workpad.
160+
Increase or decrease how often your Canvas element data refreshes on your workpad.
146161

147162
. In the top left corner, click the *Control settings* icon.
148163

@@ -153,6 +168,17 @@ image::images/canvas-refresh-interval.png[Element data refresh interval]
153168

154169
TIP: To manually refresh the data, click the *Refresh data* icon.
155170

171+
[float]
172+
[[canvas-time-range]]
173+
==== Customize map time ranges
174+
175+
Configure the maps on your workpad for a specific time range.
176+
177+
From the panel menu, select *Customize time range* to expose a time filter dedicated to the map.
178+
179+
[role="screenshot"]
180+
image::images/canvas_map-time-filter.gif[]
181+
156182
[float]
157183
[[organize-element]]
158184
=== Organize the elements on your workpad

0 commit comments

Comments
 (0)