Skip to content

Commit

Permalink
[Refactor] Move AttributeService from Dashboard to Embeddable plugin (#…
Browse files Browse the repository at this point in the history
…79830)

* [Refactor] Move AttributeService from Dashboard to Embeddable plugin

* Fix wrong import

* Fixing typescript errors

* Make Dashboard a required dependency

* Fixing circular dependency

* Fix label namespace

* Updating docs

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablestart.md
#	docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.md
#	docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md
#	src/plugins/embeddable/public/public.api.md
#	src/plugins/embeddable/server/server.api.md
  • Loading branch information
Maja Grubic committed Oct 12, 2020
1 parent 64251e6 commit 3ecbe5b
Show file tree
Hide file tree
Showing 42 changed files with 1,364 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [ATTRIBUTE\_SERVICE\_KEY](./kibana-plugin-plugins-embeddable-public.attribute_service_key.md)

## ATTRIBUTE\_SERVICE\_KEY variable

The attribute service is a shared, generic service that embeddables can use to provide the functionality required to fulfill the requirements of the ReferenceOrValueEmbeddable interface. The attribute\_service can also be used as a higher level wrapper to transform an embeddable input shape that references a saved object into an embeddable input shape that contains that saved object's attributes by value.

<b>Signature:</b>

```typescript
ATTRIBUTE_SERVICE_KEY = "attributes"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) &gt; [(constructor)](./kibana-plugin-plugins-embeddable-public.attributeservice._constructor_.md)

## AttributeService.(constructor)

Constructs a new instance of the `AttributeService` class

<b>Signature:</b>

```typescript
constructor(type: string, showSaveModal: (saveModal: React.ReactElement, I18nContext: I18nStart['Context']) => void, i18nContext: I18nStart['Context'], toasts: NotificationsStart['toasts'], options: AttributeServiceOptions<SavedObjectAttributes>, getEmbeddableFactory?: (embeddableFactoryId: string) => EmbeddableFactory);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | |
| showSaveModal | <code>(saveModal: React.ReactElement, I18nContext: I18nStart['Context']) =&gt; void</code> | |
| i18nContext | <code>I18nStart['Context']</code> | |
| toasts | <code>NotificationsStart['toasts']</code> | |
| options | <code>AttributeServiceOptions&lt;SavedObjectAttributes&gt;</code> | |
| getEmbeddableFactory | <code>(embeddableFactoryId: string) =&gt; EmbeddableFactory</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) &gt; [getExplicitInputFromEmbeddable](./kibana-plugin-plugins-embeddable-public.attributeservice.getexplicitinputfromembeddable.md)

## AttributeService.getExplicitInputFromEmbeddable() method

<b>Signature:</b>

```typescript
getExplicitInputFromEmbeddable(embeddable: IEmbeddable): ValType | RefType;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| embeddable | <code>IEmbeddable</code> | |

<b>Returns:</b>

`ValType | RefType`

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

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) &gt; [getInputAsRefType](./kibana-plugin-plugins-embeddable-public.attributeservice.getinputasreftype.md)

## AttributeService.getInputAsRefType property

<b>Signature:</b>

```typescript
getInputAsRefType: (input: ValType | RefType, saveOptions?: {
showSaveModal: boolean;
saveModalTitle?: string | undefined;
} | {
title: string;
} | undefined) => Promise<RefType>;
```
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-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) &gt; [getInputAsValueType](./kibana-plugin-plugins-embeddable-public.attributeservice.getinputasvaluetype.md)

## AttributeService.getInputAsValueType property

<b>Signature:</b>

```typescript
getInputAsValueType: (input: ValType | RefType) => Promise<ValType>;
```
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-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) &gt; [inputIsRefType](./kibana-plugin-plugins-embeddable-public.attributeservice.inputisreftype.md)

## AttributeService.inputIsRefType property

<b>Signature:</b>

```typescript
inputIsRefType: (input: ValType | RefType) => input is RefType;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md)

## AttributeService class

<b>Signature:</b>

```typescript
export declare class AttributeService<SavedObjectAttributes extends {
title: string;
}, ValType extends EmbeddableInput & {
[ATTRIBUTE_SERVICE_KEY]: SavedObjectAttributes;
} = EmbeddableInput & {
[ATTRIBUTE_SERVICE_KEY]: SavedObjectAttributes;
}, RefType extends SavedObjectEmbeddableInput = SavedObjectEmbeddableInput>
```

## Constructors

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(type, showSaveModal, i18nContext, toasts, options, getEmbeddableFactory)](./kibana-plugin-plugins-embeddable-public.attributeservice._constructor_.md) | | Constructs a new instance of the <code>AttributeService</code> class |

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [getInputAsRefType](./kibana-plugin-plugins-embeddable-public.attributeservice.getinputasreftype.md) | | <code>(input: ValType &#124; RefType, saveOptions?: {</code><br/><code> showSaveModal: boolean;</code><br/><code> saveModalTitle?: string &#124; undefined;</code><br/><code> } &#124; {</code><br/><code> title: string;</code><br/><code> } &#124; undefined) =&gt; Promise&lt;RefType&gt;</code> | |
| [getInputAsValueType](./kibana-plugin-plugins-embeddable-public.attributeservice.getinputasvaluetype.md) | | <code>(input: ValType &#124; RefType) =&gt; Promise&lt;ValType&gt;</code> | |
| [inputIsRefType](./kibana-plugin-plugins-embeddable-public.attributeservice.inputisreftype.md) | | <code>(input: ValType &#124; RefType) =&gt; input is RefType</code> | |

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [getExplicitInputFromEmbeddable(embeddable)](./kibana-plugin-plugins-embeddable-public.attributeservice.getexplicitinputfromembeddable.md) | | |
| [unwrapAttributes(input)](./kibana-plugin-plugins-embeddable-public.attributeservice.unwrapattributes.md) | | |
| [wrapAttributes(newAttributes, useRefType, input)](./kibana-plugin-plugins-embeddable-public.attributeservice.wrapattributes.md) | | |

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

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) &gt; [unwrapAttributes](./kibana-plugin-plugins-embeddable-public.attributeservice.unwrapattributes.md)

## AttributeService.unwrapAttributes() method

<b>Signature:</b>

```typescript
unwrapAttributes(input: RefType | ValType): Promise<SavedObjectAttributes>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| input | <code>RefType &#124; ValType</code> | |

<b>Returns:</b>

`Promise<SavedObjectAttributes>`

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

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) &gt; [wrapAttributes](./kibana-plugin-plugins-embeddable-public.attributeservice.wrapattributes.md)

## AttributeService.wrapAttributes() method

<b>Signature:</b>

```typescript
wrapAttributes(newAttributes: SavedObjectAttributes, useRefType: boolean, input?: ValType | RefType): Promise<Omit<ValType | RefType, 'id'>>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| newAttributes | <code>SavedObjectAttributes</code> | |
| useRefType | <code>boolean</code> | |
| input | <code>ValType &#124; RefType</code> | |

<b>Returns:</b>

`Promise<Omit<ValType | RefType, 'id'>>`

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

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [EmbeddableStart](./kibana-plugin-plugins-embeddable-public.embeddablestart.md) &gt; [getAttributeService](./kibana-plugin-plugins-embeddable-public.embeddablestart.getattributeservice.md)

## EmbeddableStart.getAttributeService property

<b>Signature:</b>

```typescript
getAttributeService: <A extends {
title: string;
}, V extends EmbeddableInput & {
[ATTRIBUTE_SERVICE_KEY]: A;
} = EmbeddableInput & {
[ATTRIBUTE_SERVICE_KEY]: A;
}, R extends SavedObjectEmbeddableInput = SavedObjectEmbeddableInput>(type: string, options: AttributeServiceOptions<A>) => AttributeService<A, V, R>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [EmbeddableStart](./kibana-plugin-plugins-embeddable-public.embeddablestart.md)

## EmbeddableStart interface

<b>Signature:</b>

```typescript
export interface EmbeddableStart extends PersistableState<EmbeddableInput>
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [EmbeddablePanel](./kibana-plugin-plugins-embeddable-public.embeddablestart.embeddablepanel.md) | <code>EmbeddablePanelHOC</code> | |
| [getAttributeService](./kibana-plugin-plugins-embeddable-public.embeddablestart.getattributeservice.md) | <code>&lt;A extends {</code><br/><code> title: string;</code><br/><code> }, V extends EmbeddableInput &amp; {</code><br/><code> [ATTRIBUTE_SERVICE_KEY]: A;</code><br/><code> } = EmbeddableInput &amp; {</code><br/><code> [ATTRIBUTE_SERVICE_KEY]: A;</code><br/><code> }, R extends SavedObjectEmbeddableInput = SavedObjectEmbeddableInput&gt;(type: string, options: AttributeServiceOptions&lt;A&gt;) =&gt; AttributeService&lt;A, V, R&gt;</code> | |
| [getEmbeddableFactories](./kibana-plugin-plugins-embeddable-public.embeddablestart.getembeddablefactories.md) | <code>() =&gt; IterableIterator&lt;EmbeddableFactory&gt;</code> | |
| [getEmbeddableFactory](./kibana-plugin-plugins-embeddable-public.embeddablestart.getembeddablefactory.md) | <code>&lt;I extends EmbeddableInput = EmbeddableInput, O extends EmbeddableOutput = EmbeddableOutput, E extends IEmbeddable&lt;I, O&gt; = IEmbeddable&lt;I, O&gt;&gt;(embeddableFactoryId: string) =&gt; EmbeddableFactory&lt;I, O, E&gt; &#124; undefined</code> | |
| [getEmbeddablePanel](./kibana-plugin-plugins-embeddable-public.embeddablestart.getembeddablepanel.md) | <code>(stateTransfer?: EmbeddableStateTransfer) =&gt; EmbeddablePanelHOC</code> | |
| [getStateTransfer](./kibana-plugin-plugins-embeddable-public.embeddablestart.getstatetransfer.md) | <code>(history?: ScopedHistory) =&gt; EmbeddableStateTransfer</code> | |
Loading

0 comments on commit 3ecbe5b

Please sign in to comment.