* remove unused piece of state
* Move related event total calculation to selector
* rename xScale
* remove `let`
* Move `dispatch` call out of HTTP try-catch
* add POC logic to modify the 'from' param in the search
* fixes formatting for appending gap diff to from
* computes new max signals based on how many intervals of rule runs were missed when gap in consecutive rule runs is detected
* adds logging, fixes bug where we could end up with negative values for diff, adds calculatedFrom to the search after query
* remove console.log and for some reason two eslint disables were added so i removed one of them
* rename variables, add test based on log message - need to figure out a better way to test this
* remove unused import
* fully re-worked the algorithm for searching discrete time periods, still need search_after because a user could submit a rule with a custom maxSignals so that would still serve a purpose. This needs heavy refactoring though, and tests.
* updated loop to include maxSignals per time interval tuple, this way we guarantee maxSignals per full rule interval. Needs some refactoring though.
* move logic into utils function, utils function still needs refactoring
* adds unit tests and cleans up new util function for determining time intervals for searching to occur
* more code cleanup
* remove more logging statements
* fix type errors
* updates unit tests and fixes bug where search result would return 0 hits but we were accessing property on non-existent hit item
* fix rebase conflict
* fixes a bug where a negative gap could exist if a rule ran before the lookback time, also fixes a bug where the search and bulk loop would return false when successful.
* gap is a duration, not a number.
* remove logging variable
* remove logging function from test
* fix type import from rebase with master
* updates missed test when rebased with master, removes unused import
* modify log statements to include meta information for logged rule events, adds tests
* remove unnecessary ts-ignores
* indentation on stringify
* adds a test to ensure we are parsing the elapsed time correctly
* Switches mount callbacks to only use start deps
Fixes#58014
* Sets up skeleton logs data fetchers for overview
* Fixes type hacks for logs fetcher
* Prevent kibana from crashing on initial load
* Fixes types and linting errors
* Fixes some linting import/export issues
Co-authored-by: Alejandro Fernández Gómez <alejandro.fernandez@elastic.co>
* Plugging in DashboardStart dependency
* Create embeddable by reference and navigate back to dashboard
* Trying to feature flag the new flow
* Feature flagging new visualize flow
* Removing unnecessary console statement
* Fixing typescript errors
* Adding a functional test for new functionality
* Adding a functional test for new functionality
* Fixing test name
* Changing test name
* Moving functional test to a separate folder
* Trying to fix the config file
* Adding an index file
* Remove falsly included file
* Adding aggs and params to vis input
* Serializing vis before passing it as an input
* Incorporating new state transfer logic
* Remove dashboardStart as a dependency
* Trying to get the test to run
* Remove unused import
* Readding spaces
* Fixing type errors
* Incorporating new changes
Fixes a race condition where the ML plugin would be mounted before receiving its first license information update and thus redirecting to a fallback page (Kibana Home, Space-Chooser or Data Visualizer page depending on the setup).
* implements recursive scanning in plugin discovery system
* update optimizer to find plugins in sub-directories
* update renovate
* update optimizer IT snapshot
* refactor processPluginSearchPaths$ and add test for inaccessible manifest
* add symlink test
* add maxDepth to the optimizer
* adapt mockFs definitions
* remove `flat` usage
* ts-ignore --> ts-expect-error
* fix error with mutable array
* fix errors in consumers code
* update SOM
* fix FeatureConfig & Feature compatibility
* do not re-export from code. it breaks built version
* update docs
* add eslint rule for platform team code
* remove test. this is covered by ts-expect-error in unit tests
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary
* Moves querying and tests from server to common
The function we are interested using on the front end is:
```ts
export const getQueryFilter = (
query: Query,
language: Language,
filters: Array<Partial<Filter>>,
index: Index,
lists: ExceptionListItemSchema[]
) => {
```
### Checklist
- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
* Add pure API functions and react hooks for value list APIs
This also adds a generic hook, useAsyncTask, that wraps an async
function to provide basic utilities:
* loading state
* error state
* abort/cancel function
* Fix type errors in hook tests
These were not caught locally as I was accidentally running typescript
without the full project.
* Document current limitations of useAsyncTask
* Defines a new validation function that returns an Either instead of a tuple
This allows callers to further leverage fp-ts functions as needed.
* Remove duplicated copyright comment
* WIP: Perform request/response validations in the FP style
* leverages new validateEither fn which returns an Either
* constructs a pipeline that:
* validates the payload
* performs the API call
* validates the response
and short-circuits if any of those produce a Left value.
It then converts the Either into a promise that either rejects with the
Left or resolves with the Right.
* Adds helper function to convert a TaskEither back to a Promise
This cleans up our validation pipeline considerably.
* Adds request/response validations to findLists
* refactors private API functions to accept the encoded request schema
(i.e. snake cased)
* refactors validateEither to use `schema.validate` instead of
`schema.decode` since we don't actually want the decoded value, we just
want to verify that it'll be able to be decoded on the backend.
* Refactor our API types
* Add request/response validation to import/export functions
* Fix type errors
* Continue to export decoded types without a qualifier
* pull types used by hooks from their new location
* Fix errors with usage of act()
* Attempting to reduce plugin bundle size
By pulling from the module directly instead of an index, we can
hopefully narrow down our dependencies until tree-shaking does this for
us.
* useAsyncFn's initiator does not return a promise
Rather than returning a promise and requiring the caller to handle a
rejection, we instead return nothing and require the user to watch the
hook's state.
* success can be handled with a useEffect on state.result
* errors can be handled with a useEffect on state.error
* Fix failing test
Assertion count wasn't updated following interface changes; we've now
got two inline expectations so this isn't needed.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>