* [Maps] source descriptor types
* make SORT_ORDER an enum
* fix type error
* finish defining descriptors for all sources
* fill out layer descriptor
* fix type
* make some properties optional to avoid type explosions
* make type optional
* nest types a bit more so they better match class structor
* in progress work from pairing with Thomas
* one more thing
* add unit test (#35)
* add functions removed from fields typescript converstion
* move joins from VectorTileLayer constructor to VectorLayer constructor, add mock to fix map_selectors test
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Thomas Neirynck <thomas@elastic.co>
* Optimized pipelines
* Fixed tests
* Addressed feedback
* Withhold LS stats until there is at least one pipeline
* Fixed logstash stats
* Addressed feedback
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [ML] multi-line json support for analytics job editor
* [ML] advanced editor with xjson
* [ML] add jest mock for XJsonMode
* [ML] add xJson mode to the json tab
* [ML] fix mocks
* [ML] Fixing licensing after server NP cutover
* client side refactor
* management refactor
* moving management license check
* adding server side license class
* added common license class
* client sides using license class
* updating server api guards
* fix privileges tests
* updating translations
* fixing disabled tabs on basic license
* refactoring client side license checks
* setting license initialized flag
* fixing license check on index data viz
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [test] Comment out Jest hooks in skipped blocks
Jest will run the hooks regardless of if they are skipped.
Tests skipped in 61c9dc4022
and 420ded8eb2 were still resulting in build failures due to the beforeEach failing.
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
* Additional variables/imports no longer needed
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
* Skip additional flaky ingest tests
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
* Comment out file
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
* Must have one test
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Cleanup implementation of the header to let pages embed the header rather than the weird sort of control the header works with today. Also uses kibana context in a way that makes more sense, and provide a path forward for #53550 since that will need to add a new header type (and some buttons next to the picker).
Fixes#58835
This is a follow-on to https://github.com/elastic/kibana/pull/57030 ,
"[alerting] initial index threshold alertType and supporting APIs",
to get it working with the existing alerting UI. The parameter shape
was different between the two, so the alertType was changed to fix
the existing UI shapes expected.
* Move linked_search to react
* Use i18n from start contract
* Move linked search to the editor
* Updating layout and fixing truncation
* Fix functional test, add a tooltip
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Migrate transform legacy server to NP.
- Create server plugin/index for transform in x-pack/plugins.
- Move all legacy/server files to plugins/transform
* [Maps] direct Discover visualize to Maps application
* pass initial layers to maps app
* add functional test
* fix parentheses messed up by lint fix
* fix i18n expression
* move logic into lib
* fix typescript errors
* use constant for geo_point and geo_shape, more TS noise
* use encode_array in an attempt to make TS happy
* another round of TS changes
* one more thing
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Add resolver middleware
* Update types to match events, use sample events in useCamera tests
* add predicate to convert alertdata to legacy endpoint event
* Use mock event generator in tests
* Guard against events not having agent or endpoint fields
Co-authored-by: Robert Austin <robert.austin@elastic.co>
* Removed Boom from reindex-service
The reindex service had logic inside it for mapping errors
to HTTP. This has been moved to the route handlers and also
removed Boom.
There is one more instance of Boom use inside of reindex-actions
but that comes from Saved Objects which should probably be removed
at a later stage.
* Fix import path
Specify the full relative import path to the kibana's core
server folder
* Remove unnecessary if statement
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Add tabs to the Endpoint app. Uses EuiTabs and browser history for integration with react-router
Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [Lens] Allow custom number formats on dimensions
* Fix merge issues
* Text and decimal changes from review
* Persist number format across operations
* Respond to review comments
* Change label
* Add persistence
* Fix import
* 2 decimals
* Persist number formatting on drop too
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Adds the first built-in alertType for Kibana alerting, an index threshold alert, and associated HTTP endpoint to generate preview data for it.
addresses the server-side requirements for issue https://github.com/elastic/kibana/issues/53041
* [APM] Update tsconfig.json template in optimization script
The location of the cypress tests has changed, and those files are no longer excluded in the APM type check. This change updates the tsconfig.json template to exclude the new location.
* Update link in readme
* remove obsolete legacy server deps
* licensePreRoutingFactory uses licensing plugin rather than legacy xpack
* move schemas to dir in routes
* use NP license check method for license check
* store license data in plugin for passing to check
* create server plugin files in NP plugin dir
* remove dependency on legacy xpack plugin
* add sample data links first step
* move all server dirs from legacy to np dir
* fix requiredPlugin spaces name and update import routes
* delete unnecessary files and add sample data links
* update license and privilege check tests
* add routeInit types
* Handle setup mode if security is disabled
* Rename so the test actually runs, and fix/add tests
* Use es.js api instead of transport.request
* Revert "Use es.js api instead of transport.request"
This reverts commit ae0e48f8bd.
* Explicitly handle security not enabled
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [Infra] Add basic backend for metric threshold alerts
* Define separate fired/recovered action groups
* Allow alerting on arbitrary search fields besides host.name
* Add list and delete endpoioints
* Add groupBy alerts
* Remove extraneous routes and SavedObject logic
* Remove additional SavedObject code
* Remove renotify logic from executor
* Fix action group type
* Fix scheduledActions typecheck
* Fix i18n
* Migrate alerting to new platform
* Add alerting to infra dependencies
* Add comment about future use
* Adjust alert params tm names to sync with UI; default to Entire Infrastructure alert
* Add support for between comparator
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* fixes from comments on previous PR
* replaces any with unknown, adds test to show how optional chaining of array items can result in undefined even though typescript says its not
Before this pr:
Discover, Visualise and Dashboard in setup phase create own state containers which watch for pinned filters, time and refresh interval changes. This watching and state comparisons happen for each plugin separately and not only when a specific app is mounted. So we ended up with a bunch of similar synchronous work which happens every time query services state changes.
After this pr:
Query service exposes observable to watch for changes (state$). Discover, Visualise and Dashboard use this observable for sub url tracking instead of creating its own.
* ui/persisted_state 👉 src/plugins/visualizations
Part of #46926
* fix JEST
* remove sinon from tests
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Add KQL filtering
* Schema updates
* Cursor-based pagination
* Add alert detail GET api
* A little refactoring ;)
* Add KQL filtering
* Render SearchBar that provides suggestions and executes search
* Schema updates
* Cursor-based pagination
* Bug fix with search_after type
* hook up filters, trying date range
* Multi-filter support
* Add rison encoding/decoding on the backend
* Wire up front-end for new GET request
* tiny bug fix
* use redux for state, disable saved queries
* Remove SearchBar UI code
* Remove Search Bar UI Part 2
* test 1
* test 2
* Finish integrating refactor work
* Fix fromIndex calculation
* Address feedback
* More tweaks
* Add some tests, round 1
* Add Direction enum
* Add next and prev urls for alert details
* refactor
* fixes
* No more AlertDataWrapper, less Maybe types
* change @timestamp to type number, redefine AlertListState
* moved pagination classes, moved types to alerts top level
* remove fake data mappings file
* Fix data location
* remove Maybe type, prev and next have type 'string | null'
* fix functional tests
* Create immutable AlertEvent type and an AlertMetadata type
* test updates
* make tests werk
* Address PR feedback
* No Date Immutable
* Fix test params
* Fix test type-check
Co-authored-by: Pedro Jaramillo <peluja1012@gmail.com>
Address all of the requests in #54182.
Also add a story for the Cytoscape component that shows most of these changes.
Fixes#54182.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary
* Adds an exact function which allows us to do exact validation rather than allowing arbitrary keys to go through
* Adds a type dependency for parts of validation (gives us feature parity with joi.when())
* Adds several hand spun validations/codecs
* Adds several utilities such as a printer for error validations
### Checklist
Delete any items that are not applicable to this PR.
- [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
* chore: move gitignore to the cypress directory
* chore: ignore more test files
* fix: do not check the Loading Message
It seems not relevant to the main purpose of these tests
* chore: use cypres + webpack + cucumber scaffolding
See https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example
* chore: add eslint and prettier for code linting
* feat: convert existing Cypress test into BDD style
* feat: add support for using proper Node version in MacOSX
* chore: use tslint
* chore: use old layout
We are keeping cypress as rootDir to follow project's structure. On the other hand,
having a second cypress directory at the 2nd level is the default structure, as shown
in the examples:
- https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example
- a240054d7f/examples/preprocessors__typescript-webpack
* chore: remove prelint script meanwhile we fix TS lint
* chore: move test results to a specific directory
* chore: rename variable following old code
* chore: remove non-needed lints, as we are going to use kibana build
* chore: import snapshot function from cypress
* chore: add readFile utils back from a bad removal
* chore: change format of JSON spec file
It was automatically changed by tests
* chore: move CI directory to the proper layout in order for Jenkins to work
* chore: store test-results from proper dir on Jenkins
* chore: store artifacts properly on Jenkins
* Fix type issues
* chore: rename test application to e2e (end-to-end)
We are keeping the build system within the test application, isolating dependencies
* docs: reorganise docs for APM UI e2e tests
* fix: Use proper cypress support file
* chore: use existing NPM script for running cypress on CI
* chore: update paths in CI scripts
* docs: document how the CI runs the tests
* chore: use Node 10 for tests
* chore: Use kibana's Node version for tests
* chore: run yarn install
* docs: update docs
* fix: path was wrong
* docs: fix paths and flags used to load data
* docs: elasticsearch fix flag
* docs: Bootstrap kibana before running it
* docs: remove outdated info
* chore: move background steps to the scenario
This would avoid not reading the background when the number of scenarios grows
Co-authored-by: Dario Gieselaar <d.gieselaar@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Migrate kbn_top_nav.js to kibana_legacy
* Wrap TopNavMenu into i18nContext
* Move the kbnTopNav directive definition to kibana_legacy and remove ui/kbn_top_nav
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [Metrics UI] Add custom metrics interface to Inventory View
* WIP
* Adding workflows for editing custom metrics
* Polishing visual design
* Removing extra text
* Fixing types and return values
* fixing i18n
* Adding aria labels for clearity
* Changing custom group by to match same width as custom metric
* updating integration test for custom metrics
* Fixing type def
* [Maps] add Top term aggregation
* update pew-pew source to handle terms agg
* make helper function for pulling values from bucket
* update terms source
* better join labels
* categoricla meta
* remove unused constant
* remove unused changes
* remove unused constant METRIC_SCHEMA_CONFIG
* update jest expect
* fix auto complete suggestions for top term
* get category autocomplete working with style props from joins
* pluck categorical style meta with real field name
* mock MetricsEditor to fix jest test
* review feedback
* es_agg_utils.js to es_agg_utils.ts
* typing updates
* use composit agg to avoid search.buckets limit
* i18n update and functional test fix
* stop paging through results when request is aborted
* remove unused file
* do not use composite agg when no terms sub-aggregations
* clean up
* pass indexPattern to getValueAggsDsl
* review feedback
* more review feedback
* ts-ignore for untyped imports in tests
* more review feedback
* add bucket.hasOwnProperty check
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Factor our the license checking logic and messaging to common
* Add licensing plugin as a dependency of the APM plugin
* Throw a forbidden error on the server if trying to access the service map routes
* es-archiver call _migrate endpoint instead of creating a migrator
* fix crlf....
* use promise instead of callback accessor
* attempt with disabled authent
* enable security again
* set mapping to dynamic before calling migration endpoint
* rename space data from non-spaced tests
* add documentation on the `rerun` flag
* create router with the `/api/saved_objects` prefix
* add unit test about strict mapping
* add integration test on migrate endpoint
* wrap route handler with handleLegacyErrors
* add remark about limitations of the rerun flag
* Apply suggestions from code review
Co-Authored-By: Aleh Zasypkin <aleh.zasypkin@gmail.com>
* do not return detailed index result
* add access tag to migrate route
* use /internal prefix for migrate endpoint
* fix integ tests
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
* Refactor the all rules page to be easier to test
* review with Garrett
* bring back utility bar under condition
* fix bugs tags and allow switch to show loading when enable/disable rule
* fix rules selection when trigerring new rules
* fix imports/exports can only use rule_id as learned today
* review I
* Add async search strategy
* Add async search
* Fix async strategy and add tests
* Move types to separate file
* Revert changes to demo search
* Update demo search strategy to use async
* Add cancellation to search strategies
* Add tests
* Simplify async search strategy
* Move loadingCount to search strategy
* Update abort controller library
* Bootstrap
* Abort when the request is aborted
* Add utility and update value suggestions route
* Fix bad merge conflict
* Update tests
* Move to data_enhanced plugin
* Remove bad merge
* Revert switching abort controller libraries
* Revert package.json in lib
* Move to previous abort controller
* Fix test to use fake timers to run debounced handlers
* Revert changes to example plugin
* Fix loading bar not going away when cancelling
* Call getSearchStrategy instead of passing directly
* Add async demo search strategy
* Fix error with setting state
* Update how aborting works
* Fix type checks
* Add test for loading count
* Attempt to fix broken example test
* Revert changes to test
* Fix test
* Update name to camelCase
* Fix failing test
* Don't require data_enhanced in example plugin
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Until these are officially supported in new platform, it's best to not
rely on this behavior. We can achieve roughly the same functionality
with a GET request. Modifies the existing script accordingly, in case
anyone's still using it.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* use links instead of click handlers when switching spaces
* remove unused imports
* remove use of deprecated injectedMetadata service
* simplify SpacesManager constructor
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Partially addresses #50897
updates visualizations plugin
makes visualizations/saved_visualizations np_ready
makes visualizations/embeddable np_ready
remove DefaultVisEditor dependency from visualizations
import AggConfigs directly instead of ui/public
Clean up imports from root. use relative imports
Remove bind directive import
* updates read privileges route tests
* fixes test for 404 when alertsClient is not present, adds new test for catching errors at the route level for prepackaged rules route
* fixes test for happy path on create rules bulk route (missing mock resulted in 200, but was still throwing an error), adds tests for covering case where a rule with a matching rule id is found to have already existed, adds a test covering the case where createRules throws an error and that error is caught in the catch block, and appears in the response
* adds more jest functions to beforeEach to ensure mockImplementation state used by spyOn is not carried over between tests, increases test coverage for create rules route
* updates unit test coverage for delete rules route and bulk delete
* increase unit test coverage for find_rules_route
* add test case to get_prepackaged_rules where findRules throws an error
* adds unit test for missing alertsClient in patch_rules_bulk route
* adds unit test coverage for transform error and pathRules throwing an error on patch rules route
* adds unit test coverage for rule not found, transform error, and readRules throws an error on read_rules_route
* adds unit test coverage for update rules (bulk) routes
* increases unit test coverage for open close signals route
* updates coverage for signals query route
* adds unit tests for rules status route, updates utils test coverage. Removed unreachable code.
* updates test coverage, removes usage of pipes from ndjson to stream conversion and returns arrays of tranformers to be used in createPromiseFromStreams so that unhandled promise rejections can be handled appropriately.
* fixes type errors
* fix bug on transform when rulestatus saved objects array is empty because we are no longer passing in the current status, we are passing in the whole saved object.
* adds unit test for when readRules throws an error inside of get export by object ids
* adds unit tests for catching errors on read rules and fixes property undefined bug in catch block
* removes unused function from utils
* adds the 'else' clause back to the getTupleDuplicateErrorsAndUniqueRules function and adds a test case for when an attempt to import rules with missing ruleIds is made, and the expected outcome.
* Create x-pack/plugins skeleton for upgrade assistant
* Move public folder contents
Move the public folder of Upgrade Assistant and migrate public to use HttpSetup (remove axios)
* Include stylesheets in public
* Move server side out of legacy
Begin migration of Reindex worker to new platform
Move imports around so that it satsifies new platform constraints like not importing
server side code (even types) in client.
* Updated the routes with new dependencies and removed server shim
* Fix router unit tests
* Fix server lib tests
After changing function signatures for the reindex server factory (and others) all
of the tests needed to be revisited and brought in line with the new APIs.
Also used core/server mocks where appropriate
* Clean up types issues
* Fix setting credentials on request header
* Removed the security plugin from Upgrade Assistant
The security plugin is a potential future consumer of the Upgrade Assistant's deprecation feature
and we would therefore not want to create a circular depedency here. We pull in the licensing plugin
rather (as it is less likely that we will depend on that) and use it to determine whether security
is available and enabled.
* Migrate to config to new platform config
xpack.upgrade_assistant.enabled
* Remove unused types
* Fix import issue
* Move upgrade assistant back to Elasticsearch management section
* Update dotfiles
Added elasticsearch ui team as upgrade assistant code owner
Updated i18nrc.json path
* Alphabetical ordering in xpack/i18nrc.json
* Implemented PR feedback
Renamed callCluster -> callAsUser to be more consistent
with platform naming.
Added comment about why we are not using security plugin
directly inside of Upgrade Assistant.
Fixed long path imports and use 'src/core/..' throughout.
Fixed import ordering.
Renamed variables inside of telemetry lib.
* Revert to longer import path
In plugin.ts importing from 'kibana/server' or 'src/core/server'
results in a module not found error.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [ML] Adding filebeat config to file dataviz
* adding extra help text
* removing commented out code
* adding extra blank line to processors section
* cleaning up types
* moving hosts line out of function
* typo in config text
* updating config based on review
* tiny refactor
* translating paths text
When generating test data we refresh excessively, this can fill up the
ES queues and break the tests if we run massive tests. I originally ran
into this with https://github.com/elastic/kibana/pull/58078/ which I
closed due to finding a better approach.
While none of our current tests have the scale to expose this problem,
we certainly will add tests that do later, so we should keep this
change.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
In the NP the routes have already the app name on them. Adding it to
this button made the app name double
/app/metrics/metrics/settings
/app/logs/logs/settings
The button only needs to go to the settings page within the app where
it's being loaded, so we can safely drop the prefix.
Closes#58233
* [Telemetry] Merge OSS and XPack usage collectors
* Create X-Pack collector again
* Separate the license retrieval from the stats
* Fix telemetry tests with new fields
* Use Promise.all to retrieve license and stats at the same time
* Fix moment mock
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Fixes#58079
This is an improved version of #58078
Note, this is a bugfix targeting 7.6.1 . I've decided to open this PR directly against 7.6 in the interest of time. We can forward-port this to 7.x / master later.
This patch improves the handling of timespans with snapshot counts. This feature originally worked, but suffered a regression when we increased the default timespan in the query context to 5m. This means that without this patch the counts you get are the maximum total number of monitors that were down over the past 5m, which is not really that useful.
We now use a scripted metric to always count precisely the number of up/down monitors. On my box this could process 400k summary docs in ~600ms. This should scale as shards are added.
I attempted to keep memory usage relatively slow by using simple maps of strings.
* Bug fix update
update to toggle footer edit controls "off" when locking edit controls.
* Update to toggle
Update to toggle, so that only the "Expression Editor" and tray are hidden when locking controls.
* Update to toggle logic
Added canUserWrite property, and added a condition to ensure the "page" tray still shows once the Expression editor is locked
* Update to property definition
Update to consolidate isWriteable and canUserWrite into one variable instead of two.
* Adding Test (in progress) code
Adding Toolbar test code (so far) - needs to be completed to address nested compononet storybook issue
* Adding issue link
Adding issue link in TODO comments
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Show blank lines instead of N/A on service map popovers
Because RUM agents never show CPU or memory usage, we don't want to always show the metric with N/A. If a metric is null, just hide the lines.
Break up the display and fetching components and update the popover stories to show the list.
Update some types.
* Fix metric typings
Fixes an error where the transforms page would load blank with an expired license. Fixes the issue by adding a type guard. With an expired license, the page now renders again correctly the error message.