diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/embeddable.tsx b/x-pack/plugins/endpoint/public/embeddables/resolver/embeddable.tsx
index a303b3418c040f3..9539162f9cfb645 100644
--- a/x-pack/plugins/endpoint/public/embeddables/resolver/embeddable.tsx
+++ b/x-pack/plugins/endpoint/public/embeddables/resolver/embeddable.tsx
@@ -8,37 +8,18 @@ import ReactDOM from 'react-dom';
import React from 'react';
import { AppRoot } from './view';
import { storeFactory } from './store';
-import {
- EmbeddableInput,
- IContainer,
- Embeddable,
-} from '../../../../../../src/plugins/embeddable/public';
-import { HttpSetup } from '../../../../../../src/core/public';
+import { Embeddable } from '../../../../../../src/plugins/embeddable/public';
export class ResolverEmbeddable extends Embeddable {
public readonly type = 'resolver';
- private httpService: HttpSetup;
private lastRenderTarget?: Element;
- constructor(initialInput: EmbeddableInput, httpService: HttpSetup, parent?: IContainer) {
- super(
- // Input state is irrelevant to this embeddable, just pass it along.
- initialInput,
- // Initial output state - this embeddable does not do anything with output, so just
- // pass along an empty object.
- {},
- // Optional parent component, this embeddable can optionally be rendered inside a container.
- parent
- );
- this.httpService = httpService;
- }
public render(node: HTMLElement) {
if (this.lastRenderTarget !== undefined) {
ReactDOM.unmountComponentAtNode(this.lastRenderTarget);
}
this.lastRenderTarget = node;
- // TODO, figure out how to destroy middleware
- const { store } = storeFactory({ httpService: this.httpService });
+ const { store } = storeFactory();
ReactDOM.render(, node);
}
diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/factory.ts b/x-pack/plugins/endpoint/public/embeddables/resolver/factory.ts
index 7925aea479a5fa8..f5d1aad93ed5746 100644
--- a/x-pack/plugins/endpoint/public/embeddables/resolver/factory.ts
+++ b/x-pack/plugins/endpoint/public/embeddables/resolver/factory.ts
@@ -5,7 +5,6 @@
*/
import { i18n } from '@kbn/i18n';
-import { HttpSetup } from 'kibana/public';
import {
EmbeddableFactory,
IContainer,
@@ -15,19 +14,13 @@ import { ResolverEmbeddable } from './embeddable';
export class ResolverEmbeddableFactory extends EmbeddableFactory {
public readonly type = 'resolver';
- private httpService: HttpSetup;
-
- constructor(httpService: HttpSetup) {
- super();
- this.httpService = httpService;
- }
public isEditable() {
return true;
}
public async create(initialInput: EmbeddableInput, parent?: IContainer) {
- return new ResolverEmbeddable(initialInput, this.httpService, parent);
+ return new ResolverEmbeddable(initialInput, {}, parent);
}
public getDisplayName() {
diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/store/index.ts b/x-pack/plugins/endpoint/public/embeddables/resolver/store/index.ts
index 3b3f51e9821c5c6..d043453a8e4cdf3 100644
--- a/x-pack/plugins/endpoint/public/embeddables/resolver/store/index.ts
+++ b/x-pack/plugins/endpoint/public/embeddables/resolver/store/index.ts
@@ -6,15 +6,29 @@
import { createStore, StoreEnhancer } from 'redux';
import { ResolverAction } from '../types';
-import { HttpSetup } from '../../../../../../../src/core/public';
import { resolverReducer } from './reducer';
-export const storeFactory = (_dependencies: { httpService: HttpSetup }) => {
+export const storeFactory = () => {
+ /**
+ * Redux Devtools extension exposes itself via a property on the global object.
+ * This interface can be used to cast `window` to a type that may expose Redux Devtools.
+ */
interface SomethingThatMightHaveReduxDevTools {
- __REDUX_DEVTOOLS_EXTENSION__?: (options?: {
- name?: string;
- actionsBlacklist: readonly string[];
- }) => StoreEnhancer;
+ __REDUX_DEVTOOLS_EXTENSION__?: (options?: PartialReduxDevToolsOptions) => StoreEnhancer;
+ }
+
+ /**
+ * Some of the options that can be passed when configuring Redux Devtools.
+ */
+ interface PartialReduxDevToolsOptions {
+ /**
+ * A name for this store
+ */
+ name?: string;
+ /**
+ * A list of action types to ignore. This is used to ignore high frequency events created by a mousemove handler
+ */
+ actionsBlacklist?: readonly string[];
}
const windowWhichMightHaveReduxDevTools = window as SomethingThatMightHaveReduxDevTools;
// Make sure blacklisted action types are valid
diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/view/diagnostic_dot.tsx b/x-pack/plugins/endpoint/public/embeddables/resolver/view/diagnostic_dot.tsx
index 6c8266cdc566d4f..b6e70c18a462857 100644
--- a/x-pack/plugins/endpoint/public/embeddables/resolver/view/diagnostic_dot.tsx
+++ b/x-pack/plugins/endpoint/public/embeddables/resolver/view/diagnostic_dot.tsx
@@ -7,6 +7,7 @@
import React from 'react';
import styled from 'styled-components';
import { useSelector } from 'react-redux';
+import { Vector2 } from '../types';
import { applyMatrix3 } from '../lib/vector2';
import * as selectors from '../store/selectors';
diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/view/index.tsx b/x-pack/plugins/endpoint/public/embeddables/resolver/view/index.tsx
index 63788304dc0c07c..73667eff418445a 100644
--- a/x-pack/plugins/endpoint/public/embeddables/resolver/view/index.tsx
+++ b/x-pack/plugins/endpoint/public/embeddables/resolver/view/index.tsx
@@ -8,8 +8,7 @@ import React, { useCallback, useState, useEffect, useMemo } from 'react';
import { Store } from 'redux';
import { Provider, useSelector, useDispatch } from 'react-redux';
import styled from 'styled-components';
-import { applyMatrix3 } from '../lib/vector2';
-import { ResolverState, ResolverAction, Vector2 } from '../types';
+import { ResolverState, ResolverAction } from '../types';
import * as selectors from '../store/selectors';
import { useAutoUpdatingClientRect } from './use_autoupdating_client_rect';
import { useNonPassiveWheelHandler } from './use_nonpassive_wheel_handler';
@@ -148,7 +147,12 @@ const Diagnostic = styled(
useNonPassiveWheelHandler(handleWheel, ref);
return (
-
+
{dotPositions.map((worldPosition, index) => (
))}
diff --git a/x-pack/plugins/endpoint/public/plugin.ts b/x-pack/plugins/endpoint/public/plugin.ts
index 219477698c2642a..355364253b2a52f 100644
--- a/x-pack/plugins/endpoint/public/plugin.ts
+++ b/x-pack/plugins/endpoint/public/plugin.ts
@@ -38,7 +38,7 @@ export class EndpointPlugin
},
});
- const resolverEmbeddableFactory = new ResolverEmbeddableFactory(core.http);
+ const resolverEmbeddableFactory = new ResolverEmbeddableFactory();
plugins.embeddable.registerEmbeddableFactory(
resolverEmbeddableFactory.type,