Some maintenance and minor fixes to state containers based on experience while working with them in #53582
Patch unit tests to use current "terminology" (e.g. "transition" vs "mutation")
Fix docs where "store" was used instead of "state container"
Allow to create state container without transition.
Fix freeze function to deeply freeze objects.
Restrict State to BaseState with extends object.
in set() function, make sure the flow goes through dispatch to make sure middleware see this update
Improve type inference for useTransition()
Improve type inference for createStateContainer().
Other issues noticed, but didn't fix in reasonable time:
Can't use addMiddleware without explicit type casting #54438
Transitions and Selectors allow any state, not bind to container's state #54439
* share specific instances of some ui packages
* remove unnecessary eslint changes, every package will define deps anyway
* remove mentions of moment webpackShims in eslint resolver
* remove use of lodash
* list angular as dep for x-pack
* add operations as codeowner of shared-deps pkg
Today, apps rely on AppState and GlobalState in the ui/state_management module to deal with internal (app) and shared (global) state. These classes give apps an ability to read/write state, when is then synced to the URL as well as sessionStorage. They also react to changes in the URL and automatically update state & emit events when changes occur.
This PR introduces new state synching utilities, which together with state containers src/plugins/kibana_utils/public/state_containers will be a replacement for AppState and GlobalState in New Platform.
* Move fp-ts and immer to "." package.json
* Revert "Move fp-ts and immer to "." package.json"
This reverts commit b876df0d54.
* Second attempt, fp-ts and immer -> root
* fp-ts -> 2.3.1
* Revert x-pack/package.json
* Update fp-ts in x-pack/package.json
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
As we recently added react-use as a dependency, makes sense to clean up those generic hooks from Kibana repo.
Removed custom hooks from kibana_react and other places:
useObservable
useUnmount
useShallowCompareEffect
react-use should be used instead:
import useObservable from 'react-use/lib/useObservable'
* Shim input_control_vis
* Convert input_control_vis src files to typescript
* Add Required, Optional, Required and Class types to kbn-utility-types
* Collect all ui/* imports into legacy imports file
* Pass down plugin deps from top level
* Add timeout and terminate_after options to SearchSourceFields
* Instrument Kibana with APM RUM agent
* make route-change transaction work with properl url
* extract page-load transaction url from app link
* check if app is hidden and set active:false
* make distributed tracing work and merge config
* remove config/apm.js and address review
* address review comments
* add apm.js to build tassks
* move apm from dev to src
* add @types/hoist-non-react-statics which is required by react rum
* apply changes correctly from master
Adds a `runNow` api to Task Manager, allowing us to force the refresh of a recurring task.
This PR includes a couple of sustainability changes as well as the feature itself.
1. **Declarative query composition.** At the moment the queries in the TaskStore are huge JSON objects that are hard to maintain and understand. This PR introduces a pattern where the different parts of the query are composed out of type-checked functions, making it easier to maintain and to construct dynamically as needs change. _This was included in this PR as the **markAvailableTasksAsClaimed** query needs different query clauses depending on whether there are specific Tasks we wish to claim first.
2. **Refactoring of the Task Poller** As the `runNow` api is introduced we find Task Manager's lifecycle in a weird state where it has both a _pull_ model, where timeouts & callbacks interact without having to responsd to any external requests, and a _push_ model where requests are made to the new `runNow` api. Balancing these two proved error prone, hard to maintain and had the potential of _lossy_ behaviour where requests are dropped accidentally. To address this TaskPoller has been refactored using Rxjs observables, remodelling the existing _pull_ mechanism as a _push_ mechanism so Task Manager can _respond_ to both _polling_ calls and _runNow_ in a similar fashion.
And ofcourse the main feature of this PR:
3. **runNow api** An api on TaskManager that takes a _task ID_ and attempts to run the task. The call returns a promise which resolves with a result which notifies the caller when the task has either completed successfully, or result in an error.
Ensure no deprecated Node.js core API's are used in Kibana. This is
achieved by throwing an error in either development mode or in CI if one
of the deprecated API's is called, and as such, new PR's should no
longer be able to be merged if they use deprecated API's.
Some of these API's (like the `Buffer` constructor`) is a security risk.
Instruments Kibana with Elastic APM by adding the Node.js agent to the
source code. The agent is not turned on by default but can be enabled by
setting the environment variable `ELASTIC_APM_ACTIVE=true` or by
creating an apm config file called `config/apm.dev.js` and setting
`active: true` inside of it.
This implementation is not meant to be used by end-users of Kibana as it
lacks integration with the regular Kibana config file. For now, this is
meant as a useful internal tool for Elastic employees when developing
Kibana.
By default, it's pre-configured with a `serverUrl` pointing to an APM
Server hosted on Elastic Cloud. The data is stored in an ES cluster
accessible only by Elastic employees. These defaults can easily be
overwritten using environment variables or via the custom config file.
This adds an absolute session timeout (lifespan) to user sessions.
It also improves the existing session timeout toast and the overall
user experience in several ways.
* run mocha tests from x-pack with root mocha script
* Only run Karma tests in xpack intake job
* disable failing suites
* fix typo
* skip correct suite (there are multiple root suites)
* support disabling junit reporting with $DISABLE_JUNIT_REPORTER
* don't generate junit in ispec_plugin tests
* eui to 16.0.0
* type defs
* card click
* snapshot updates
* time format test updates
* ts return
* integration fix
* async
* more time format fixes
* more time format fixes
* test updates
* add uisettings dateformat timepicker test
* after method to clear setting
* initial push
* self code review
* ignore node-fetch type
* usageFetcher api
* user agent metric
* telemetry plugin collector
* remove extra unused method
* remove unused import
* type check
* fix collections tests
* pass kfetch as dep
* add ui metrics integration test for user agent
* dont start ui metrics when not authenticated
* user agent count always 1
* fix broken ui-metric integration tests
* try using config.get
* avoid fetching configs if sending
* type unknown -> string
* check if fetcher is causing the issue
* disable ui_metric from functional tests
* enable ui_metric back again
* ignore keyword above 256
* check requesting app first
* clean up after all the debugging :)
* fix tests
* always return 200 for ui metric reporting
* remove boom import
* logout after removing role/user
* undo some changes in tests
* inside try catch
* prevent potential race conditions in priorities with =
* use snake_case for telemetry plugin collection
* usageFetcher -> sendUsageFrom
* more replacements
* remove extra unused route
* config() -> config
* Update src/legacy/core_plugins/telemetry/index.ts
Co-Authored-By: Mike Côté <mikecote@users.noreply.github.com>
* Update src/legacy/core_plugins/ui_metric/server/routes/api/ui_metric.ts
Co-Authored-By: Mike Côté <mikecote@users.noreply.github.com>
* config() -> config
* fix SO update logic given the current changes
* fix opt in check
* triple check
* check for non boolean
* take into account older settings
* import TelemetryOptInProvider
* update test case
* [a11y] add initial accessibility functional tests
* add accessibility jobs
* fix config path
* remove percy setup from scripts
* disable color-contrast rule
* apply changes from @myasonik
* define aria-controls/owns props even when suggestions aren't visible
* [ftr/a11y] only throw error when there are errors
* adding tests for management page
* add a11y test for management page
* adding ignore rules' to a11y
* accessibility test for kibana home
* 7 passing tests, 0 failures
* jest snapshot update
* support a11y test in pipeline job
* update a11y test script for pipelines
* use oss compatible ci setup
* fix exclude syntax
* add default exclusion syntax
This PR include three key changes:
1. Run tasks as soon as they have been marked as running, rather than wait for the whole batch to me marked
2. Use a custom refresh setting of refresh: false where possible, in place of wait_for, in order to speed up Task Manager's internal workflow
3. Instrumentation of Task Manager exposing Activity / Inactivity metrics in Performance test runs
* Update dependency rxjs to ^6.5.3
* move argument type def up for better coverage
* adapt to possibly undefined helpExtension
* complete definition of deprecation$ type
* define types that bindNodeCallback can no longer infer
* define more types that bindNodeCallback can't infer
* be more explicit and accurate about the types for a subject/observable pair
* fix interface error, TS now identifies it
* ignore a return type flaw because types are not being managed properly
* avoid overspecifying types
* allow types to be inferred where possible
* remove unnecessary withLatestFrom()
* reduce number of rxjs versions installed
* update kbn/pm dist