-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Endpoint: Move files, add README, replace implicit
any
with stricte…
…r types. Reorganize types. (#63262) * Removed `FIXME` comments and references to private repos. Please use Github issues to track work * Added a README describing the modules in `applications/endpoint` * Removed dead code * Moved `AppRoot` component to its own module * Moved `applications/endpoint/services` under `store` * Moved some exported types to `applications/endpoint/types` * Moved all React code to `view` * Added types in some places that were implicitly `any` * Moved `PageId` type from common directory (where it could be shared with the server) to the public directory Conflicts: * `x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx`
- Loading branch information
Robert Austin
committed
Apr 13, 2020
1 parent
d2844d1
commit 51a58a7
Showing
26 changed files
with
161 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
x-pack/plugins/endpoint/public/applications/endpoint/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Endpoint application | ||
This application provides the user interface for the Elastic Endpoint | ||
|
||
# Architecture | ||
The application consists of a _view_ written in React and a _model_ written in Redux. | ||
|
||
# Modules | ||
We structure the modules to match the architecture. `view` contains the _view_ (all React) code. `store` contains the _model_. | ||
|
||
This section covers the conventions of each top level module. | ||
|
||
# `mocks` | ||
This contains helper code for unit tests. | ||
|
||
## `models` | ||
This contains domain models. By convention, each submodule here contains methods for a single type. Domain model classes would also live here. | ||
|
||
## `store` | ||
This contains the _model_ of the application. All Redux and Redux middleware code (including API interactions) happen here. This module also contains the types and interfaces defining Redux actions. Each action type or interface should be commented and if it has fields, each field should be commented. Comments should be of `tsdoc` style. | ||
|
||
## `view` | ||
This contains the code which renders elements to the DOM. All React code goes here. | ||
|
||
## `index.tsx` | ||
This exports `renderApp` which instantiates the React view with the _model_. | ||
|
||
## `types.ts` | ||
This contains the types and interfaces. All `export`ed types or interfaces (except ones defining Redux actions, which live in `store`) should be here. Each type or interface should have a `tsdoc` style comment. Interfaces should have `tsdoc` comments on each field and types which have fields should do the same. |
13 changes: 0 additions & 13 deletions
13
x-pack/plugins/endpoint/public/applications/endpoint/components/truncate_text.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
x-pack/plugins/endpoint/public/applications/endpoint/view/app_root.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import * as React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { Route, Switch } from 'react-router-dom'; | ||
import { Store } from 'redux'; | ||
import { AlertIndex } from './alerts'; | ||
import { HostList } from './hosts'; | ||
import { PolicyList } from './policy'; | ||
import { PolicyDetails } from './policy'; | ||
import { HeaderNavigation } from './components/header_navigation'; | ||
import { AppRootProvider } from './app_root_provider'; | ||
import { Setup } from './setup'; | ||
import { EndpointPluginStartDependencies } from '../../../plugin'; | ||
import { ScopedHistory, CoreStart } from '../../../../../../../src/core/public'; | ||
|
||
interface RouterProps { | ||
history: ScopedHistory; | ||
store: Store; | ||
coreStart: CoreStart; | ||
depsStart: EndpointPluginStartDependencies; | ||
} | ||
|
||
/** | ||
* The root of the Endpoint application react view. | ||
*/ | ||
export const AppRoot: React.FunctionComponent<RouterProps> = React.memo( | ||
({ history, store, coreStart, depsStart }) => { | ||
return ( | ||
<AppRootProvider store={store} history={history} coreStart={coreStart} depsStart={depsStart}> | ||
<Setup ingestManager={depsStart.ingestManager} notifications={coreStart.notifications} /> | ||
<HeaderNavigation /> | ||
<Switch> | ||
<Route | ||
exact | ||
path="/" | ||
render={() => ( | ||
<h1 data-test-subj="welcomeTitle"> | ||
<FormattedMessage id="xpack.endpoint.welcomeTitle" defaultMessage="Hello World" /> | ||
</h1> | ||
)} | ||
/> | ||
<Route path="/hosts" component={HostList} /> | ||
<Route path="/alerts" component={AlertIndex} /> | ||
<Route path="/policy" exact component={PolicyList} /> | ||
<Route path="/policy/:id" exact component={PolicyDetails} /> | ||
<Route | ||
render={() => ( | ||
<FormattedMessage id="xpack.endpoint.notFound" defaultMessage="Page Not Found" /> | ||
)} | ||
/> | ||
</Switch> | ||
</AppRootProvider> | ||
); | ||
} | ||
); |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.