Skip to content

Commit a27f803

Browse files
Merge branch 'master' into feat/ssource-fields
2 parents 84136f6 + cc341b3 commit a27f803

File tree

465 files changed

+8570
-4101
lines changed

Some content is hidden

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

465 files changed

+8570
-4101
lines changed

.github/CODEOWNERS

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,31 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
262262

263263
# Enterprise Search
264264
# Shared
265-
/x-pack/plugins/enterprise_search/ @elastic/enterprise-search-frontend
265+
/x-pack/plugins/enterprise_search/* @elastic/enterprise-search-frontend
266+
/x-pack/plugins/enterprise_search/common/ @elastic/enterprise-search-frontend
267+
/x-pack/plugins/enterprise_search/public/* @elastic/enterprise-search-frontend
268+
/x-pack/plugins/enterprise_search/public/applications/* @elastic/enterprise-search-frontend
269+
/x-pack/plugins/enterprise_search/public/applications/enterprise_search/ @elastic/enterprise-search-frontend
270+
/x-pack/plugins/enterprise_search/public/applications/shared/ @elastic/enterprise-search-frontend
271+
/x-pack/plugins/enterprise_search/public/applications/__mocks__/ @elastic/enterprise-search-frontend
272+
/x-pack/plugins/enterprise_search/server/* @elastic/enterprise-search-frontend
273+
/x-pack/plugins/enterprise_search/server/lib/ @elastic/enterprise-search-frontend
274+
/x-pack/plugins/enterprise_search/server/__mocks__/ @elastic/enterprise-search-frontend
275+
/x-pack/plugins/enterprise_search/server/collectors/enterprise_search/ @elastic/enterprise-search-frontend
276+
/x-pack/plugins/enterprise_search/server/collectors/lib/ @elastic/enterprise-search-frontend
277+
/x-pack/plugins/enterprise_search/server/routes/enterprise_search/ @elastic/enterprise-search-frontend
278+
/x-pack/plugins/enterprise_search/server/saved_objects/enterprise_search/ @elastic/enterprise-search-frontend
266279
/x-pack/test/functional_enterprise_search/ @elastic/enterprise-search-frontend
280+
# App Search
281+
/x-pack/plugins/enterprise_search/public/applications/app_search/ @elastic/app-search-frontend
282+
/x-pack/plugins/enterprise_search/server/routes/app_search/ @elastic/app-search-frontend
283+
/x-pack/plugins/enterprise_search/server/collectors/app_search/ @elastic/app-search-frontend
284+
/x-pack/plugins/enterprise_search/server/saved_objects/app_search/ @elastic/app-search-frontend
285+
# Workplace Search
286+
/x-pack/plugins/enterprise_search/public/applications/workplace_search/ @elastic/workplace-search-frontend
287+
/x-pack/plugins/enterprise_search/server/routes/workplace_search/ @elastic/workplace-search-frontend
288+
/x-pack/plugins/enterprise_search/server/collectors/workplace_search/ @elastic/workplace-search-frontend
289+
/x-pack/plugins/enterprise_search/server/saved_objects/workplace_search/ @elastic/workplace-search-frontend
267290

268291
# Elasticsearch UI
269292
/src/plugins/dev_tools/ @elastic/es-ui

src/plugins/charts/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ Truncated color mappings in `value`/`text` form
2727
## Theme
2828

2929
See Theme service [docs](public/services/theme/README.md)
30+
31+
## Palettes
32+
33+
See palette service [docs](public/services/palettes/README.md)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Palette Service
2+
3+
The `palette` service offers a collection of palettes which implement a uniform interface for assigning colors to charts. The service provides methods for switching palettes
4+
easily. It's used by the x-pack plugins `canvas` and `lens`.
5+
6+
Each palette is allowed to store some state as well which has to be handled by the consumer.
7+
8+
Palettes are integrated with the expression as well using the `system_palette` and `palette` functions.
9+
10+
## Using the palette service
11+
12+
To consume the palette service, use `charts.palettes.getPalettes` to lazily load the async bundle implementing existing palettes. This is recommended to be called in the renderer, not as part of the `setup` or `start` phases of a plugin.
13+
14+
All palette definitions can be loaded using `paletteService.getAll()`. If the id of the palette is known, it can be fetched using `paleteService.get(id)`.
15+
16+
One a palette is loaded, there are two ways to request colors - either by fetching a list of colors (`getColors`) or by specifying the chart object to be colored (`getColor`). If possible, using `getColor` is recommended because it allows the palette implementation to apply custom logic to coloring (e.g. lightening up colors or syncing colors) which has to be implemented by the consumer if `getColors` is used).
17+
18+
### SeriesLayer
19+
20+
If `getColor` is used, an array of `SeriesLayer` objects has to be passed in. These correspond with the current series in the chart a color has to be determined for. An array is necessary as some charts are constructed hierarchically (e.g. pie charts or treemaps). The array of objects represents the current series with all ancestors up to the corresponding root series. For each layer in the series hierarchy, the number of "sibling" series and the position of the current series has to be specified along with the name of the series.
21+
22+
## Custom palette
23+
24+
All palettes are stateless and define their own colors except for the `custom` palette which takes a state of the form
25+
```ts
26+
{ colors: string[]; gradient: boolean }
27+
```
28+
29+
This state has to be passed into the `getColors` and `getColor` function to retrieve specific colors.
30+
31+
## Registering new palettes
32+
33+
Currently palettes can't be extended dynamically.

src/plugins/input_control_vis/public/__snapshots__/input_control_fn.test.ts.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugins/input_control_vis/public/__snapshots__/to_ast.test.ts.snap

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugins/input_control_vis/public/components/editor/_index.scss

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/plugins/input_control_vis/public/components/editor/control_editor.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import { getTitle, ControlParams, CONTROL_TYPES, ControlParamsOptions } from '..
3636
import { IIndexPattern } from '../../../../data/public';
3737
import { InputControlVisDependencies } from '../../plugin';
3838

39+
import './control_editor.scss';
40+
3941
interface ControlEditorUiProps {
4042
controlIndex: number;
4143
controlParams: ControlParams;

src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ import React from 'react';
2121
import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest';
2222
import { findTestSubject } from '@elastic/eui/lib/test';
2323
import { getDepsMock, getIndexPatternMock } from '../../test_utils';
24-
import { ControlsTab, ControlsTabUiProps } from './controls_tab';
24+
import ControlsTab, { ControlsTabProps } from './controls_tab';
2525
import { Vis } from '../../../../visualizations/public';
2626

2727
const indexPatternsMock = {
2828
get: getIndexPatternMock,
2929
};
30-
let props: ControlsTabUiProps;
30+
let props: ControlsTabProps;
3131

3232
beforeEach(() => {
33-
props = {
33+
props = ({
3434
deps: getDepsMock(),
3535
vis: ({
3636
API: {
@@ -78,18 +78,18 @@ beforeEach(() => {
7878
},
7979
setValue: jest.fn(),
8080
intl: null as any,
81-
};
81+
} as unknown) as ControlsTabProps;
8282
});
8383

8484
test('renders ControlsTab', () => {
85-
const component = shallowWithIntl(<ControlsTab.WrappedComponent {...props} />);
85+
const component = shallowWithIntl(<ControlsTab {...props} />);
8686

8787
expect(component).toMatchSnapshot();
8888
});
8989

9090
describe('behavior', () => {
9191
test('add control button', () => {
92-
const component = mountWithIntl(<ControlsTab.WrappedComponent {...props} />);
92+
const component = mountWithIntl(<ControlsTab {...props} />);
9393

9494
findTestSubject(component, 'inputControlEditorAddBtn').simulate('click');
9595

@@ -102,7 +102,7 @@ describe('behavior', () => {
102102
});
103103

104104
test('remove control button', () => {
105-
const component = mountWithIntl(<ControlsTab.WrappedComponent {...props} />);
105+
const component = mountWithIntl(<ControlsTab {...props} />);
106106
findTestSubject(component, 'inputControlEditorRemoveControl0').simulate('click');
107107
const expectedParams = [
108108
'controls',
@@ -125,7 +125,7 @@ describe('behavior', () => {
125125
});
126126

127127
test('move down control button', () => {
128-
const component = mountWithIntl(<ControlsTab.WrappedComponent {...props} />);
128+
const component = mountWithIntl(<ControlsTab {...props} />);
129129
findTestSubject(component, 'inputControlEditorMoveDownControl0').simulate('click');
130130
const expectedParams = [
131131
'controls',
@@ -162,7 +162,7 @@ describe('behavior', () => {
162162
});
163163

164164
test('move up control button', () => {
165-
const component = mountWithIntl(<ControlsTab.WrappedComponent {...props} />);
165+
const component = mountWithIntl(<ControlsTab {...props} />);
166166
findTestSubject(component, 'inputControlEditorMoveUpControl1').simulate('click');
167167
const expectedParams = [
168168
'controls',

src/plugins/input_control_vis/public/components/editor/controls_tab.tsx

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
*/
1919

2020
import React, { PureComponent } from 'react';
21-
import { injectI18n, FormattedMessage, InjectedIntlProps } from '@kbn/i18n/react';
21+
import { FormattedMessage } from '@kbn/i18n/react';
22+
import { i18n } from '@kbn/i18n';
2223

2324
import {
2425
EuiButton,
@@ -44,22 +45,17 @@ import {
4445
} from '../../editor_utils';
4546
import { getLineageMap, getParentCandidates } from '../../lineage';
4647
import { InputControlVisDependencies } from '../../plugin';
48+
import { InputControlVisParams } from '../../types';
4749

4850
interface ControlsTabUiState {
4951
type: CONTROL_TYPES;
5052
}
5153

52-
interface ControlsTabUiParams {
53-
controls: ControlParams[];
54-
}
55-
type ControlsTabUiInjectedProps = InjectedIntlProps &
56-
Pick<VisOptionsProps<ControlsTabUiParams>, 'vis' | 'stateParams' | 'setValue'> & {
57-
deps: InputControlVisDependencies;
58-
};
54+
export type ControlsTabProps = VisOptionsProps<InputControlVisParams> & {
55+
deps: InputControlVisDependencies;
56+
};
5957

60-
export type ControlsTabUiProps = ControlsTabUiInjectedProps;
61-
62-
class ControlsTabUi extends PureComponent<ControlsTabUiProps, ControlsTabUiState> {
58+
class ControlsTab extends PureComponent<ControlsTabProps, ControlsTabUiState> {
6359
state = {
6460
type: CONTROL_TYPES.LIST,
6561
};
@@ -161,8 +157,6 @@ class ControlsTabUi extends PureComponent<ControlsTabUiProps, ControlsTabUiState
161157
}
162158

163159
render() {
164-
const { intl } = this.props;
165-
166160
return (
167161
<div>
168162
{this.renderControls()}
@@ -176,25 +170,31 @@ class ControlsTabUi extends PureComponent<ControlsTabUiProps, ControlsTabUiState
176170
options={[
177171
{
178172
value: CONTROL_TYPES.RANGE,
179-
text: intl.formatMessage({
180-
id: 'inputControl.editor.controlsTab.select.rangeDropDownOptionLabel',
181-
defaultMessage: 'Range slider',
182-
}),
173+
text: i18n.translate(
174+
'inputControl.editor.controlsTab.select.rangeDropDownOptionLabel',
175+
{
176+
defaultMessage: 'Range slider',
177+
}
178+
),
183179
},
184180
{
185181
value: CONTROL_TYPES.LIST,
186-
text: intl.formatMessage({
187-
id: 'inputControl.editor.controlsTab.select.listDropDownOptionLabel',
188-
defaultMessage: 'Options list',
189-
}),
182+
text: i18n.translate(
183+
'inputControl.editor.controlsTab.select.listDropDownOptionLabel',
184+
{
185+
defaultMessage: 'Options list',
186+
}
187+
),
190188
},
191189
]}
192190
value={this.state.type}
193191
onChange={(event) => this.setState({ type: event.target.value as CONTROL_TYPES })}
194-
aria-label={intl.formatMessage({
195-
id: 'inputControl.editor.controlsTab.select.controlTypeAriaLabel',
196-
defaultMessage: 'Select control type',
197-
})}
192+
aria-label={i18n.translate(
193+
'inputControl.editor.controlsTab.select.controlTypeAriaLabel',
194+
{
195+
defaultMessage: 'Select control type',
196+
}
197+
)}
198198
/>
199199
</EuiFormRow>
200200
</EuiFlexItem>
@@ -205,10 +205,12 @@ class ControlsTabUi extends PureComponent<ControlsTabUiProps, ControlsTabUiState
205205
onClick={this.handleAddControl}
206206
iconType="plusInCircle"
207207
data-test-subj="inputControlEditorAddBtn"
208-
aria-label={intl.formatMessage({
209-
id: 'inputControl.editor.controlsTab.select.addControlAriaLabel',
210-
defaultMessage: 'Add control',
211-
})}
208+
aria-label={i18n.translate(
209+
'inputControl.editor.controlsTab.select.addControlAriaLabel',
210+
{
211+
defaultMessage: 'Add control',
212+
}
213+
)}
212214
>
213215
<FormattedMessage
214216
id="inputControl.editor.controlsTab.addButtonLabel"
@@ -224,8 +226,6 @@ class ControlsTabUi extends PureComponent<ControlsTabUiProps, ControlsTabUiState
224226
}
225227
}
226228

227-
export const ControlsTab = injectI18n(ControlsTabUi);
228-
229-
export const getControlsTab = (deps: InputControlVisDependencies) => (
230-
props: Omit<ControlsTabUiProps, 'core'>
231-
) => <ControlsTab {...props} deps={deps} />;
229+
// default export required for React.Lazy
230+
// eslint-disable-next-line import/no-default-export
231+
export { ControlsTab as default };

0 commit comments

Comments
 (0)