Skip to content

Commit

Permalink
[Uptime] Remove monitor states graphql (#62853) (#63871)
Browse files Browse the repository at this point in the history
* WIP replacing GQL with redux/rest.

* Finish implementing migration.

* Introduce new connected component for ping list.

* Replace GraphQL type with io-ts.

* Update some broken tests.

* Add test for new helper function.

* Write test snapshots.

* Migrate api tests from graphql to rest.

* Update fixtures that rely on pings.

* Move ping types to runtime_types folder with rest of io-ts files.

* Update Ping type location and imports, type checking.

* Remove reliance on fixtures for ping functional API tests.

* Fix broken unit tests.

* Fix broken types.

* Remove local state storage from parent components.

* Add functional test to cover Ping List functionality.

* Fix monitor page functional test that was broken by merge conflicts.

* Fix broken tests.

* Fix broken API test.

* Replace a test with a describe block that will pre-navigate all tests.

* Delete unused reducer keys.

* Re-introduce loading to ping list reducer.

* Inroduce code that will cause PingList to re-fetch when refresh button is pressed.

* Update expanded rows to support multiple concurrent expanded rows.

* Modify pingList reducer to have singular optional error field.

* Delete unnecessary helper code.

* Delete unused interface.

* Add runtime_type to parse getPings params, fix pagination index.

* Add dedicated monitor type to runtime_types.

* Fix broken tests.

* Fix broken tests.

* Rename '@timestamp' property to 'timestamp' on Ping type.

* Fix broken type and key pings list table on document ID instead of timestamp.

* Fix broken unit tests.

* Fix broken tests and types.

* Fix broken functional test.

* Add REST endpoint for monitor states.

* Add REST route to constants file.

* Introduce io-ts typing for monitor states.

* Remove remaining GraphQL types.

* Update monitor states types to use io-ts types.

* Add state management for monitor states.

* Introduce connected monitor list component.

* Fixup runtime types for monitor states.

* Remove all remaining references to apollo graphql.

* Update URL generator function tests to use inline snapshots instead of snapshot files.

* Fix missing imports and small type issues.

* Prefer inline snapshot to object literal comparison.

* Add type check and console log to API response.

* Update README to remove graphql references.

* Fix type error.

* Make monitor list refresh when global refresh button is pressed.

* Fix broken types.

* Rename `@timestamp` field to `timestamp`.

* Change spelling of var.

* Add timestamp map for `@timestamp` field in monitor states fetcher.

* Remove need for `monito_states` fixture.

* Write test code that allows for deletion of the `monitor_states_id_filtered` fixture.

* Rewrite pagination tests to no longer rely on monitor states page fixtures.

* Skip test that is causing other functional tests to fail.

* Remove unused translations.

* Fix broken test snapshots.

* Fix stale error reporting errors.

* Remove runtime validation from REST handler.

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
justinkambic and elasticmachine authored Apr 17, 2020
1 parent 91ec7d0 commit d26b213
Show file tree
Hide file tree
Showing 146 changed files with 2,261 additions and 35,212 deletions.
17 changes: 10 additions & 7 deletions x-pack/legacy/plugins/uptime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
## Purpose

The purpose of this plugin is to provide users of Heartbeat more visibility of what's happening
in their infrastructure. It's primarily built using React and Apollo's GraphQL tools.
in their infrastructure.

## Layout

There are three sections to the app, `common`, `public`, and `server`.

### common

Contains GraphQL types, constants and a few other files.
Contains runtime types types, constants and a few other files.

Notably, we use `io-ts`/`fp-ts` functions and types to help provide
additional runtime safety for our API requests/responses.

### public

Components come in two main types, queries and functional. Queries are extended from Apollo's queries
type which abstracts a lot of the GraphQL connectivity away. Functional are dumb components that
don't store any state.
We use Redux and associated tools for managing our app state. Components come in the usual `connect`ed and
presentational varieties.

The `lib` directory controls bootstrapping code and adapter types.

Expand All @@ -27,12 +29,13 @@ The principal structure of the app is stored in `uptime_app.tsx`.

### server

There is a `graphql` directory which contains the resolvers, schema files, and constants.

The `lib` directory contains `adapters`, which are connections to external resources like Kibana
Server, Elasticsearch, etc. In addition, it contains domains, which are libraries that provide
functionality via adapters.

The `requests` directory contains functions responsible for querying Elasticsearch and parsing its
responses.

There's also a `rest_api` folder that defines the structure of the RESTful API endpoints.

## Testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { SortOrder, CursorDirection } from '../graphql/types';
import { CursorDirection, SortOrder } from '../runtime_types';

/**
* The Uptime UI utilizes a settings context, the defaults for which are stored here.
Expand Down
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/uptime/common/constants/rest_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
export enum API_URLS {
INDEX_PATTERN = `/api/uptime/index_pattern`,
INDEX_STATUS = '/api/uptime/index_status',
MONITOR_LIST = `/api/uptime/monitor/list`,
MONITOR_LOCATIONS = `/api/uptime/monitor/locations`,
MONITOR_DURATION = `/api/uptime/monitor/duration`,
MONITOR_DETAILS = `/api/uptime/monitor/details`,
Expand Down
232 changes: 0 additions & 232 deletions x-pack/legacy/plugins/uptime/common/graphql/types.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

export * from './details';
export * from './locations';
export * from './state';
Loading

0 comments on commit d26b213

Please sign in to comment.