Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Endpoint] Animate camera, add sidebar #55590

Merged
merged 76 commits into from
Feb 14, 2020
Merged

Conversation

oatkiller
Copy link
Contributor

@oatkiller oatkiller commented Jan 22, 2020

Summary

scale_animation mov

This PR adds a sidebar navigation. clicking the icons in the nav will focus the camera on the different nodes. There is an animation effect when the camera moves.

Dev validation

Works in Safari. Note that Safari doesn't recognize the timestamp_utc provided by the sample data. It shows 'timestamp invalid' message instead. @FrankHassanabad thanks for finding this issue

image

ff works
image

ie11 doesn't work. can't even load the login screen.
image
image

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

Copy link
Contributor Author

@oatkiller oatkiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding TODOs for myself

const [time, setTime] = useState<Date>(new Date());
const rafRef = useRef<number>();
useEffect(() => {
const handleFrame = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not loop rAF unless animation is in progress. TODO

const [projectionMatrix, setProjectionMatrix] = useState<Matrix3>(
projectionMatrixAtTime(new Date())
);
const [time, setTime] = useState<Date>(new Date());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this 'time' concern could be a separate hook TODO


useNonPassiveWheelHandler(handleWheel, ref);

const projectionMatrixAtTime = useSelector(selectors.projectionMatrix);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO add general comment about rAF, date, and why projection matrix is a function of time.

@@ -0,0 +1,132 @@
/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reconsider name of this module/component. TODO


export const Event = memo(() => {
const { processNodePositions } = useSelector(selectors.processNodePositionsAndEdgeLineSegments);
interface ProcessTableView {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO justify data munging

import { CameraAnimationState, Vector2 } from '../../../types';
import * as vector2 from '../../../lib/vector2';

export function active(animation: CameraAnimationState, time: Date): boolean {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO comment

return animation.startTime.getTime() + animationDuration >= time.getTime();
}

export function translation(animation: CameraAnimationState, time: Date): Vector2 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO comment

/**
* The amount of milliseconds animations will last.
*/
export const animationDuration = 400;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO shouldn't be a constant

/**
* Time when this action was dispatched.
*/
time: Date;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO justify why we don't use middleware to add timestamps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pros for metadata:
you don't have to type in new Date() when creating actions

Cons for metadata:
extra complexity.
you have to install middleware for the reducer to work, that includes tests
hidden complexity: not obvious that action's aren't pure (they aren't pure because their meaning is effected by the time, and conditions, under which they are dispatched.)

};
}

// TODO, Data is no longer a concern. its nested under camera and also nested under graph
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO remove comment

@@ -186,4 +234,4 @@ export type ProcessWithWidthMetadata = {
/**
* String that represents the direction in which Resolver can be panned
*/
export type PanDirection = 'north' | 'south' | 'east' | 'west';
export type CardinalDirection = 'north' | 'south' | 'east' | 'west';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO is this used?

@@ -26,6 +26,13 @@ export function divide(a: Vector2, b: Vector2): Vector2 {
return [a[0] / b[0], a[1] / b[1]];
}

/**
* Multiply `a` against `b`, treating `b` like a 1x2 instead of a 2x1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO change comment

@@ -31,7 +31,9 @@ export interface EndpointResultList {
endpoints: EndpointMetadata[];
// the total number of unique endpoints in the index
total: number;
// the page size requested
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO remove change

/**
* Time when this action was dispatched.
*/
readonly time: Date;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion, union w/ a single type defining time

...state,
translationNotCountingCurrentPanning: translation(state),
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just pass time to userStoppedPanning and use the normal function? would simplify types

@oatkiller oatkiller added Feature:Endpoint Elastic Endpoint feature Team:Endpoint Data Visibility Team managing the endpoint resolver labels Feb 3, 2020
*
* If the scale is low, the camera is zoomed out, objects look further away, and so they move
* across the screen slower at a given camera speed. Therefore we can control the speed at
* hich objects move across the screen without changing the camera speed. We do this by changing scale.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sp: which

@oatkiller oatkiller added Feature:Resolver Security Solution Resolver feature review labels Feb 11, 2020
@oatkiller oatkiller changed the title WIP: refactor camera stuff (partial) and add sidebar Animate camera, add sidebar Feb 11, 2020
@@ -6,7 +6,8 @@
"license": "Elastic-License",
"scripts": {},
"dependencies": {
"react-redux": "^7.1.0"
"react-redux": "^7.1.0",
"redux-devtools-extension": "^2.13.8"
Copy link
Contributor

@FrankHassanabad FrankHassanabad Feb 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be in devDependencies as its a dev tool?

"redux-devtools-extension": "^2.13.8"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to get that workin.

@oatkiller
Copy link
Contributor Author

@elasticmachine merge upstream

@oatkiller
Copy link
Contributor Author

@elasticmachine merge upstream

@oatkiller
Copy link
Contributor Author

@elasticmachine merge upstream

@oatkiller oatkiller merged commit a790f61 into elastic:master Feb 14, 2020
@oatkiller oatkiller deleted the card branch February 14, 2020 14:41
@kevinlog kevinlog changed the title Animate camera, add sidebar [Endpoint] Animate camera, add sidebar Feb 18, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

oatkiller pushed a commit that referenced this pull request Feb 18, 2020
* Add Endpoint plugin and Resolver embeddable (#51994)

* Add functional tests for plugins to x-pack (so we can do a functional test of the Resolver embeddable)
* Add Endpoint plugin
* Add Resolver embeddable
* Test that Resolver embeddable can be rendered

 Conflicts:
	x-pack/.i18nrc.json
	x-pack/test/api_integration/apis/index.js

* [Endpoint] Register endpoint app (#53527)

* register app, create functional test

* formatting

* update tests

* adjust test data for endpoint

* add endpoint tests for testing spaces, app enabled, disabled, etc

* linting

* add read privileges to endpoint

* rename variable since its used now

* remove deprecated context

* remove unused variable

* fix type check

* correct test suite message

Co-Authored-By: Larry Gregory <lgregorydev@gmail.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Larry Gregory <lgregorydev@gmail.com>

* [Endpoint] add react router to endpoint app (#53808)

* add react router to endpoint app

* linting

* linting

* linting

* correct tests

* change history from hash to browser, add new test util

* remove default values in helper functions

* fix type check, use FunctionComponent as oppsed to FC

* use BrowserRouter component

* use BrowserRouter component lin

* add comments to test framework, change function name to include browserHistory

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* EMT-issue-65: add endpoint list api (#53861)

add endpoint list api

* EMT-65:always return accurate endpoint count (#54423)

EMT-65:always return accurate endpoint count, independent of paging properties

* Resolver component w/ sample data (#53619)

Resolver is a map. It shows processes that ran on a computer. The processes are drawn as nodes and lines connect processes with their parents.

Resolver is not yet implemented in Kibana. This PR adds a 'map' type UX. The user can click and drag to pan the map and zoom using trackpad pinching (or ctrl and mousewheel.)

There is no code providing actual data. Sample data is included. The sample data is used to draw a map. The fundamental info needed is:

process names
the parent of a process
With this info we can topologically lay out the processes. The sample data isn't yet in a realistic format. We'll be fixing that soon.

Related issue: elastic/endpoint-app-team#30

* Resolver test plugin not using mount context. (#54933)

Mount context was deprecated. Use core.getStartServices() instead.

* Resolver nonlinear zoom (#54936)

* [Endpoint] add Redux saga Middleware and app Store (#53906)

* Added saga library
* Initialize endpoint app redux store

* Resolver is overflow: hidden to prevent obscured elements from showing up (#55076)

* [Endpoint] Fix saga to start only after store is created and stopped on app unmount (#55245)

- added `stop()`/`start()` methods to the Saga Middleware creator factory
- adjust tests based on changes
- changed application `renderApp` to stop sagas when react app is unmounted

* Resolver zoom, pan, and center controls (#55221)

* Resolver zoom, pan, and center controls

* add tests, fix north panning

* fix type issue

* update west and east panning to behave like google maps

* [Endpoint] FIX: Increase tests `sleep` default duration back to 100ms (#55492)

Revert `sleep()` default duration, in the saga tests, back to 100ms in order to prevent intermittent failures during CI runs.

Fixes #55464
Fixes #55465

* [Endpoint] EMT-65: make endpoint data types common, restructure (#54772)

[Endpoint] EMT-65: make endpoint data types common, use schema changes

* Basic Functionality Alert List (#55800)

* sets up initial grid and data type

* data feeds in from backend but doesnt update

* sample data feeding in correctly

* Fix combineReducers issue by importing Redux type from 'redux' package

* Add usePageId hook that fires action when user navigates to page

* Strict typing for middleware

* addresses comments and uses better types

* move types to common/types.ts

* Move types to endpoint/types.ts, address PR comments

blah 2

Co-authored-by: Pedro Jaramillo <peluja1012@gmail.com>

* [Endpoint] Add Endpoint Details route (#55746)

* Add Endpoint Details route

* add Endpoint Details tests

* sacrifices to the Type gods

* update to latest endpoint schema

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* [Endpoint] EMT-67: add kql support for endpoint list (#56328)

[Endpoint] EMT-67: add kql support for endpoint list

* [Endpoint] ERT-82 ERT-83 ERT-84: Alert list API with pagination (#56538)

* ERT-82 ERT-83 ERT-84 (partial): Add Alert List API with pagination

* Better type safety for alert list API

* Add Test to Verify Endpoint App Landing Page (#57129)

 Conflicts:
	x-pack/test/functional/page_objects/index.ts

* fixes render bug in alert list (#57152)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* Resolver: Animate camera, add sidebar (#55590)

This PR adds a sidebar navigation. clicking the icons in the nav will focus the camera on the different nodes. There is an animation effect when the camera moves.

 Conflicts:
	yarn.lock

* [Endpoint] Task/basic endpoint list (#55623)

* Adds host management list to endpoint security plugin

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* [Endpoint] Policy List UI route and initial view (#56918)

* Initial Policy List view

* Add `endpoint/policy` route and displays Policy List
* test cases (both unit and functional)

Does not yet interact with API (Ingest).

* Add ApplicationService app status management (#50223)

This was already backported, but changes to endpoint app could not be
backported, since endpoint app itself hadn't been backported. Now that
the endpoint app is backported, reapply the endpoint specific changes
from the original commit.

* Implements `getStartServices` on server-side (#55156)

This was already backported, but changes to endpoint app could not be
backported, since endpoint app itself hadn't been backported. Now that
the endpoint app is backported, reapply the endpoint specific changes
from the original commit.

* [ui/utils/query_string]: Remove unused methods & migrate apps to querystring lib (#56957)

This was already backported, but changes to endpoint app could not be
backported, since endpoint app itself hadn't been backported. Now that
the endpoint app is backported, reapply the endpoint specific changes
from the original commit.

Co-authored-by: Kevin Logan <56395104+kevinlog@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Larry Gregory <lgregorydev@gmail.com>
Co-authored-by: nnamdifrankie <56440728+nnamdifrankie@users.noreply.github.com>
Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
Co-authored-by: Pedro Jaramillo <peluja1012@gmail.com>
Co-authored-by: Dan Panzarella <pzl@users.noreply.github.com>
Co-authored-by: Madison Caldwell <madison.rey.caldwell@gmail.com>
Co-authored-by: Charlie Pichette <56399229+charlie-pichette@users.noreply.github.com>
Co-authored-by: Candace Park <56409205+parkiino@users.noreply.github.com>
Co-authored-by: Pierre Gayvallet <pierre.gayvallet@gmail.com>
Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Endpoint Elastic Endpoint feature Feature:Resolver Security Solution Resolver feature release_note:skip Skip the PR/issue when compiling release notes review Team:Endpoint Data Visibility Team managing the endpoint resolver v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants