Skip to content

Commit

Permalink
Merge branch 'master' into alerting/consumer-based-rbac
Browse files Browse the repository at this point in the history
* master:
  Update known-plugins.asciidoc (elastic#69370)
  [ML] Anomaly Explorer swim lane pagination (elastic#70063)
  [Ingest Manager] Update asset paths to use _ instead of - (elastic#70320)
  Fix discover, tsvb and Lens chart theming issues (elastic#69695)
  Allow Saved Object type mappings to set a field's `doc_values` property (elastic#70433)
  [S&R] Support data streams (elastic#68078)
  [Maps] Add styling and tooltip support to mapbox mvt vector tile sources (elastic#64488)
  redirect to default app if hash can not be forwarded (elastic#70417)
  [APM] Don't fetch dynamic index pattern in setupRequest (elastic#70308)
  [Security_Solution][Endpoint] Leveraging msearch and ancestry array for resolver (elastic#70134)
  Update docs for api authentication usage (elastic#66819)
  chore(NA): disable alerts_detection_rules cypress suites (elastic#70577)
  add getVisibleTypes API to SO type registry (elastic#70559)
  • Loading branch information
gmmorris committed Jul 2, 2020
2 parents ae38572 + 3c56371 commit a67950e
Show file tree
Hide file tree
Showing 264 changed files with 7,312 additions and 3,187 deletions.
2 changes: 1 addition & 1 deletion docs/api/using-api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NOTE: The {kib} Console supports only Elasticsearch APIs. You are unable to inte
[float]
[[api-authentication]]
=== Authentication
{kib} supports token-based authentication with the same username and password that you use to log into the {kib} Console.
{kib} supports token-based authentication with the same username and password that you use to log into the {kib} Console. In a given HTTP tool, and when available, you can select to use its 'Basic Authentication' option, which is where the username and password are stored in order to be passed as part of the call.

[float]
[[api-calls]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) &gt; [doc\_values](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.doc_values.md)

## SavedObjectsComplexFieldMapping.doc\_values property

<b>Signature:</b>

```typescript
doc_values?: boolean;
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface SavedObjectsComplexFieldMapping

| Property | Type | Description |
| --- | --- | --- |
| [doc\_values](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.doc_values.md) | <code>boolean</code> | |
| [properties](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.properties.md) | <code>SavedObjectsMappingProperties</code> | |
| [type](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.type.md) | <code>string</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [doc\_values](./kibana-plugin-core-server.savedobjectscorefieldmapping.doc_values.md)

## SavedObjectsCoreFieldMapping.doc\_values property

<b>Signature:</b>

```typescript
doc_values?: boolean;
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface SavedObjectsCoreFieldMapping

| Property | Type | Description |
| --- | --- | --- |
| [doc\_values](./kibana-plugin-core-server.savedobjectscorefieldmapping.doc_values.md) | <code>boolean</code> | |
| [enabled](./kibana-plugin-core-server.savedobjectscorefieldmapping.enabled.md) | <code>boolean</code> | |
| [fields](./kibana-plugin-core-server.savedobjectscorefieldmapping.fields.md) | <code>{</code><br/><code> [subfield: string]: {</code><br/><code> type: string;</code><br/><code> ignore_above?: number;</code><br/><code> };</code><br/><code> }</code> | |
| [index](./kibana-plugin-core-server.savedobjectscorefieldmapping.index.md) | <code>boolean</code> | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

## SavedObjectTypeRegistry.getAllTypes() method

Return all [types](./kibana-plugin-core-server.savedobjectstype.md) currently registered.
Return all [types](./kibana-plugin-core-server.savedobjectstype.md) currently registered, including the hidden ones.

To only get the visible types (which is the most common use case), use `getVisibleTypes` instead.

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectTypeRegistry](./kibana-plugin-core-server.savedobjecttyperegistry.md) &gt; [getVisibleTypes](./kibana-plugin-core-server.savedobjecttyperegistry.getvisibletypes.md)

## SavedObjectTypeRegistry.getVisibleTypes() method

Returns all visible [types](./kibana-plugin-core-server.savedobjectstype.md)<!-- -->.

A visible type is a type that doesn't explicitly define `hidden=true` during registration.

<b>Signature:</b>

```typescript
getVisibleTypes(): SavedObjectsType[];
```
<b>Returns:</b>

`SavedObjectsType[]`

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export declare class SavedObjectTypeRegistry

| Method | Modifiers | Description |
| --- | --- | --- |
| [getAllTypes()](./kibana-plugin-core-server.savedobjecttyperegistry.getalltypes.md) | | Return all [types](./kibana-plugin-core-server.savedobjectstype.md) currently registered. |
| [getAllTypes()](./kibana-plugin-core-server.savedobjecttyperegistry.getalltypes.md) | | Return all [types](./kibana-plugin-core-server.savedobjectstype.md) currently registered, including the hidden ones.<!-- -->To only get the visible types (which is the most common use case), use <code>getVisibleTypes</code> instead. |
| [getImportableAndExportableTypes()](./kibana-plugin-core-server.savedobjecttyperegistry.getimportableandexportabletypes.md) | | Return all [types](./kibana-plugin-core-server.savedobjectstype.md) currently registered that are importable/exportable. |
| [getIndex(type)](./kibana-plugin-core-server.savedobjecttyperegistry.getindex.md) | | Returns the <code>indexPattern</code> property for given type, or <code>undefined</code> if the type is not registered. |
| [getType(type)](./kibana-plugin-core-server.savedobjecttyperegistry.gettype.md) | | Return the [type](./kibana-plugin-core-server.savedobjectstype.md) definition for given type name. |
| [getVisibleTypes()](./kibana-plugin-core-server.savedobjecttyperegistry.getvisibletypes.md) | | Returns all visible [types](./kibana-plugin-core-server.savedobjectstype.md)<!-- -->.<!-- -->A visible type is a type that doesn't explicitly define <code>hidden=true</code> during registration. |
| [isHidden(type)](./kibana-plugin-core-server.savedobjecttyperegistry.ishidden.md) | | Returns the <code>hidden</code> property for given type, or <code>false</code> if the type is not registered. |
| [isImportableAndExportable(type)](./kibana-plugin-core-server.savedobjecttyperegistry.isimportableandexportable.md) | | Returns the <code>management.importableAndExportable</code> property for given type, or <code>false</code> if the type is not registered or does not define a management section. |
| [isMultiNamespace(type)](./kibana-plugin-core-server.savedobjecttyperegistry.ismultinamespace.md) | | Returns whether the type is multi-namespace (shareable); resolves to <code>false</code> if the type is not registered |
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/known-plugins.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ This list of plugins is not guaranteed to work on your version of Kibana. Instea
* https://github.com/sbeyn/kibana-plugin-traffic-sg[Traffic] (sbeyn)
* https://github.com/PhaedrusTheGreek/transform_vis[Transform Visualization] (PhaedrusTheGreek)
* https://github.com/nyurik/kibana-vega-vis[Vega-based visualizations] (nyurik) - Support for user-defined graphs, external data sources, maps, images, and user-defined interactivity.
* https://github.com/Camichan/kbn_aframe[VR Graph Visualizations] (Camichan)

[float]
=== Other
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/register": "^7.10.1",
"@elastic/apm-rum": "^5.2.0",
"@elastic/charts": "19.5.2",
"@elastic/charts": "19.6.3",
"@elastic/datemath": "5.0.3",
"@elastic/ems-client": "7.9.3",
"@elastic/eui": "24.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@elastic/charts": "19.5.2",
"@elastic/charts": "19.6.3",
"@elastic/eui": "24.1.0",
"@elastic/numeral": "^2.5.0",
"@kbn/i18n": "1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/saved_objects/mappings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export interface SavedObjectsCoreFieldMapping {
type: string;
null_value?: number | boolean | string;
index?: boolean;
doc_values?: boolean;
enabled?: boolean;
fields?: {
[subfield: string]: {
Expand All @@ -153,6 +154,7 @@ export interface SavedObjectsCoreFieldMapping {
* @public
*/
export interface SavedObjectsComplexFieldMapping {
doc_values?: boolean;
type?: string;
properties: SavedObjectsMappingProperties;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const createRegistryMock = (): jest.Mocked<
const mock = {
registerType: jest.fn(),
getType: jest.fn(),
getVisibleTypes: jest.fn(),
getAllTypes: jest.fn(),
getImportableAndExportableTypes: jest.fn(),
isNamespaceAgnostic: jest.fn(),
Expand All @@ -35,6 +36,7 @@ const createRegistryMock = (): jest.Mocked<
isImportableAndExportable: jest.fn(),
};

mock.getVisibleTypes.mockReturnValue([]);
mock.getAllTypes.mockReturnValue([]);
mock.getImportableAndExportableTypes.mockReturnValue([]);
mock.getIndex.mockReturnValue('.kibana-test');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,37 @@ describe('SavedObjectTypeRegistry', () => {
});
});

describe('#getVisibleTypes', () => {
it('returns only visible registered types', () => {
const typeA = createType({ name: 'typeA', hidden: false });
const typeB = createType({ name: 'typeB', hidden: true });
const typeC = createType({ name: 'typeC', hidden: false });
registry.registerType(typeA);
registry.registerType(typeB);
registry.registerType(typeC);

const registered = registry.getVisibleTypes();
expect(registered.length).toEqual(2);
expect(registered).toContainEqual(typeA);
expect(registered).toContainEqual(typeC);
});

it('does not mutate the registered types when altering the list', () => {
registry.registerType(createType({ name: 'typeA', hidden: false }));
registry.registerType(createType({ name: 'typeB', hidden: true }));
registry.registerType(createType({ name: 'typeC', hidden: false }));

const types = registry.getVisibleTypes();
types.splice(0, 2);

expect(registry.getVisibleTypes().length).toEqual(2);
});
});

describe('#getAllTypes', () => {
it('returns all registered types', () => {
const typeA = createType({ name: 'typeA' });
const typeB = createType({ name: 'typeB' });
const typeB = createType({ name: 'typeB', hidden: true });
const typeC = createType({ name: 'typeC' });
registry.registerType(typeA);
registry.registerType(typeB);
Expand Down
13 changes: 12 additions & 1 deletion src/core/server/saved_objects/saved_objects_type_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ export class SavedObjectTypeRegistry {
}

/**
* Return all {@link SavedObjectsType | types} currently registered.
* Returns all visible {@link SavedObjectsType | types}.
*
* A visible type is a type that doesn't explicitly define `hidden=true` during registration.
*/
public getVisibleTypes() {
return [...this.types.values()].filter((type) => !this.isHidden(type.name));
}

/**
* Return all {@link SavedObjectsType | types} currently registered, including the hidden ones.
*
* To only get the visible types (which is the most common use case), use `getVisibleTypes` instead.
*/
public getAllTypes() {
return [...this.types.values()];
Expand Down
5 changes: 5 additions & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,8 @@ export interface SavedObjectsClientWrapperOptions {

// @public
export interface SavedObjectsComplexFieldMapping {
// (undocumented)
doc_values?: boolean;
// (undocumented)
properties: SavedObjectsMappingProperties;
// (undocumented)
Expand All @@ -1986,6 +1988,8 @@ export interface SavedObjectsComplexFieldMapping {

// @public
export interface SavedObjectsCoreFieldMapping {
// (undocumented)
doc_values?: boolean;
// (undocumented)
enabled?: boolean;
// (undocumented)
Expand Down Expand Up @@ -2468,6 +2472,7 @@ export class SavedObjectTypeRegistry {
getImportableAndExportableTypes(): SavedObjectsType[];
getIndex(type: string): string | undefined;
getType(type: string): SavedObjectsType | undefined;
getVisibleTypes(): SavedObjectsType[];
isHidden(type: string): boolean;
isImportableAndExportable(type: string): boolean;
isMultiNamespace(type: string): boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/server/saved_objects/saved_objects_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export function savedObjectsMixin(kbnServer, server) {
const typeRegistry = kbnServer.newPlatform.start.core.savedObjects.getTypeRegistry();
const mappings = migrator.getActiveMappings();
const allTypes = typeRegistry.getAllTypes().map((t) => t.name);
const visibleTypes = typeRegistry.getVisibleTypes().map((t) => t.name);
const schema = new SavedObjectsSchema(convertTypesToLegacySchema(typeRegistry.getAllTypes()));
const visibleTypes = allTypes.filter((type) => !schema.isHiddenType(type));

server.decorate('server', 'kibanaMigrator', migrator);

Expand Down
72 changes: 2 additions & 70 deletions src/plugins/charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,80 +18,12 @@ Color mappings in `value`/`text` form

### `getHeatmapColors`

Funciton to retrive heatmap related colors based on `value` and `colorSchemaName`
Function to retrieve heatmap related colors based on `value` and `colorSchemaName`

### `truncatedColorSchemas`

Truncated color mappings in `value`/`text` form

## Theme

the `theme` service offers utilities to interact with theme of kibana. EUI provides a light and dark theme object to work with Elastic-Charts. However, every instance of a Chart would need to pass down this the correctly EUI theme depending on Kibana's light or dark mode. There are several ways you can use the `theme` service to get the correct theme.

> The current theme (light or dark) of Kibana is typically taken into account for the functions below.
### `useChartsTheme`

The simple fetching of the correct EUI theme; a **React hook**.

```js
import { npStart } from 'ui/new_platform';
import { Chart, Settings } from '@elastic/charts';

export const YourComponent = () => (
<Chart>
<Settings theme={npStart.plugins.charts.theme.useChartsTheme()} />
</Chart>
);
```

### `chartsTheme$`

An **observable** of the current charts theme. Use this implementation for more flexible updates to the chart theme without full page refreshes.

```tsx
import { npStart } from 'ui/new_platform';
import { EuiChartThemeType } from '@elastic/eui/src/themes/charts/themes';
import { Subscription } from 'rxjs';
import { Chart, Settings } from '@elastic/charts';

interface YourComponentProps {};

interface YourComponentState {
chartsTheme: EuiChartThemeType['theme'];
}

export class YourComponent extends Component<YourComponentProps, YourComponentState> {
private subscription?: Subscription;
public state = {
chartsTheme: npStart.plugins.charts.theme.chartsDefaultTheme,
};

componentDidMount() {
this.subscription = npStart.plugins.charts.theme
.chartsTheme$
.subscribe(chartsTheme => this.setState({ chartsTheme }));
}

componentWillUnmount() {
if (this.subscription) {
this.subscription.unsubscribe();
this.subscription = undefined;
}
}

public render() {
const { chartsTheme } = this.state;

return (
<Chart>
<Settings theme={chartsTheme} />
</Chart>
);
}
}
```

### `chartsDefaultTheme`

Returns default charts theme (i.e. light).
See Theme service [docs](public/services/theme/README.md)
Loading

0 comments on commit a67950e

Please sign in to comment.