* [Fleet] Install security_rule assets as saved objects
* Add security-rule to update_assets.ts
* Update UUIDs for security_rule asset
* Change .type to match the saved object type not the asset type
* Add saved object mapping for security-rule
* Make SO non-hidden
* Fix SO mapping for security-rule
* Make security-rule a non-hidden asset
## Summary
As identified in https://github.com/elastic/kibana/pull/96505#issuecomment-815392671, this fixes the flakiness in the `Closing alerts` cypress test. Method used was to just delete the rule after the initial batch of alerts were generated. Alternatively we could add a function for disabling the rule (didn't see one in there), but the outcome is the same, no more alerts generated while the test is being performed. 🙂
> Passing locally, though upon further inspection, this test is definitely going to be flakey as it's checking counts on alerts as they move through different states and there are new alerts that keep coming in (hence the count mis-match in the above failure). Potential fixes would be to use an absolute daterange to after the first round of alerts were generated, or just stop generating alerts before performing the alert state changes.
##### Before:
<p align="center">
<img width="500" src="https://user-images.githubusercontent.com/2946766/113952824-ae1d9500-97d3-11eb-9021-6737544b9c50.png" />
</p>
##### After:
<p align="center">
<img width="500" src="https://user-images.githubusercontent.com/2946766/113958216-ed50e380-97dd-11eb-9d22-d1c6aafc97d2.png" />
</p>
* [Actions] Added action configuration settings `maxResponseContentLength` and `responseTimeout` which define max response content size (in bytes) and awaiting timeout for action executions based on axios requests.
* replaced pasceDuration with moment
* fixed due to comments
* renamed internal options
In elastic/eui#4649 the `betaBadgeLabel` and related props have been removed from `EuiPanel` and it's now recommended to use an `EuiCard` instead.
Replace these in APM and Observability plugins and update stories so examples can be viewed.
* Update our EUI breadcrumb helper to skip generating links for the last breadcrumb in the list
* Fix useEuiBreadcrumbs tests
- add a describe block to make it clear we're testing link behavior in non-last breadcrumbs
- add a helper that automatically adds a last breadcrumb so that link generation still works
* Add comment/note as to why I didn't add last-breadcrumb-specific logic to useGenerateBreadcrumbs
resolves https://github.com/elastic/kibana/issues/92949
This PR adds two new Kibana config keys to further customize when the proxy
is used when making HTTP requests. Prior to this PR, if a proxy was set
via the `xpack.actions.proxyUrl` config key, all requests would be
proxied.
Now, there's a further refinement in that hostnames can be added
to the `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts`
config keys. Only one of these config keys can be used at a time.
If the target URL hostname of the HTTP request is listed in the
`proxyBypassHosts` list, the proxy won't be used.
If the target URL hostname of the HTTP request is **NOT** listed in the
`proxyOnlyHosts` list, the proxy won't be used.
Depending on the customer's environment, it may be easier to list the hosts to
bypass, or easier to list the hosts that should only be proxied, so they can
choose either method.
* Revert change to wrap setContext in useEffect
A recommendation was made to wrap the setContext call in a previous PR, which lets the app know if the context is org or account, in a useEffect call, for potential performance reasons. Unfortunately, this causes the lifecycle to change so that changing routes from org to personal dashboard does not register the change in time. This commit changes it back to a working state.
* Add constants and routes for Account nav
* Add AccountHeader component
* Add header to layout and fix height
The main layout stylesheet, https://github.com/elastic/kibana/blob/master/x-pack/plugins/enterprise_search/public/applications/shared/layout/layout.scss gives a static height that includes the main Kibana navigation. The height with the account nav only is added to the existing privateSourcesLayout css class
* Refactor test
* Added new const to List plugin for new Endpont Event Filter list
* Data Generator for event filters ++ script to load event filters (WIP)
* refactor `generate_data` to use `BaseDataGenerator` class
The transforms UI source preview uses fields to search and retrieve document attributes. The feature was introduced in 7.10. For cross cluster search, as of now, when a search using fields is used using cross cluster search against a cluster earlier than 7.10, the API won't return an error or other information but just silently drop the fields attribute and return empty hits without field attributes.
In Kibana, index patterns can be set up to use cross cluster search using the pattern <cluster-names>:<pattern>. If we identify such a pattern and the search hits don't include fields attributes, we display a warning callout from now on.
* initial pass at es client migration
* fixed potential for not passing in an error message and triggering an unhandled exception
* reworked ad hoc fixing of error response
* delete legacy client file and remove use of legacyEs service
* remove unused import
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
For both OneDrive and SharePoint we define a service_type that has an
underscore in the middle (one_drive and share_point). This fixes the
route definitions so sources of these connector types can be
reauthenticated.
## Summary
Moves part of the exceptions UI out of the security solution plugin and into the lists plugin. In order to keep PRs (relatively) small, I am moving single components at a time. This should also then help more easily pinpoint the source of any issues that come up along the way.
The next couple PRs will focus on the exception builder. This one in particular is focused on moving over the `ExceptionBuilderComponent` which deals with rendering numerous exception items and their entries.
Quick Summary:
- `x-pack/plugins/security_solution/public/common/components/exceptions/builder/` → ` x-pack/plugins/lists/public/exceptions/components/builder/`
- Corresponding unit test file moved as well
- Updated security solution exception builder to pull `ExceptionBuilderComponent` from lists plugin
* [Metrics UI] Observability Overview Host Summary
* Adding UI elements
* Adding logos
* Changing the size of the request
* Change to new ECS fields for network traffic
* Adding logos to HostLink component
* Round seconds
* fixing data handler test
* Fixing test for metrics_overview_fetchers
* Adding types for SVG to observability
* Adding i18n support to table labels
* removing unused translations
* move back to host.network.(in,out).bytes
* Adding changes to source from #95334
* Fixing source type
* Removing unintentional change.
* Maybe, fixing types
* removing svg typings
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Fix color assertion with risk of percentage being rounded to 0.
- Better naming of attributes of expected values.
- Adds assertions to use the sample size dropdown and randomize query switch.
* Change top_hits aggregations to top_metrics for snapshot api
* Fix typing
* Remove top_hits types
* Add test for top metrics
* Fix functional test
* Add size 1 to top metrics aggregation
* change type for metadata rows
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* starting removing stuff
* fix jest config
* disable CLI mode until other PR is merged
* fix the schema
* add deprecation for maxPayloadBytes
* fix legacy start logic
* deletes `env` from unknown args
* fix FTR test config
* some legacy service deletion
* move config validation
* remove legacy exports from entrypoint
* preserve legacy logging in core logging config
* try to fix uiSettings integration tests
* fix legacy service tests
* more type fix
* use fromRoot from @kbn/utils
* cleanup kibana.d.ts
* fix unit tests
* remove src/core/server/utils
* fix server script
* add integration test for `/{path*}` route
* add unit tests on legacy config
* adapt uiSetting IT bis
* fix tests
* update generated doc
* address some review comments
* move review comments
* fix some stuff
* fix some stuff
* fix some stuff
* fix some stuff bis
* generated doc
* add test for ensureValidConfiguration
* fixes a skipped management x-pack test
* modified the test to incoroporate the review comments
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Set up helper for showing JSON request/response bodies
* Set up mock API log obj for tests to use
* Add ApiLogLogic file for flyout handling
* Add ApiLogFlyout component
* Update views to load flyout
* Update table to open flyout
* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/utils.ts
* PR feedback: comments
Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
### [RAC][Alert Triage][TGrid] Update the Alerts Table (TGrid) API to implement `renderCellValue`
- This PR implements a superset of the `renderCellValue` API from [EuiDataGrid](https://elastic.github.io/eui/#/tabular-content/data-grid) in the `TGrid` (Timeline grid) API
- The TGrid API was also updated to accept a collection of `RowRenderer`s as a prop
The API changes are summarized by the following screenshot:
<img width="1239" alt="render-cell-value" src="https://user-images.githubusercontent.com/4459398/113345484-c121f800-92ef-11eb-8a21-2b6dd8ef499b.png">
The following screenshot shows the `signal.rule.risk_score` column in the Alerts table being rendered with a green background color, using the same technique illustrated by `EuiDataGrid`'s [codesandbox example](https://codesandbox.io/s/nsmzs):
<img width="1231" alt="alerts" src="https://user-images.githubusercontent.com/4459398/113349015-a30ac680-92f4-11eb-8518-5c1b7465e76e.png">
Note: In the screenshot above, the values in the Alerts table are also _not_ rendered as draggables.
Related (RAC) issue: https://github.com/elastic/kibana/issues/94520
### Details
The `StatefulEventsViewer` has been updated to accept `renderCellValue` as a (required) prop:
```
renderCellValue: (props: CellValueElementProps) => React.ReactNode;
```
The type definition of `CellValueElementProps` is:
```
export type CellValueElementProps = EuiDataGridCellValueElementProps & {
data: TimelineNonEcsData[];
eventId: string; // _id
header: ColumnHeaderOptions;
linkValues: string[] | undefined;
timelineId: string;
};
```
The `CellValueElementProps` type above is a _superset_ of `EuiDataGridCellValueElementProps`. The additional properties above include the `data` returned by the TGrid when it performs IO to retrieve alerts and events.
### Using `renderCellValue` to control rendering
The internal implementation of TGrid's cell rendering didn't change with this PR; it moved to
`x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/default_cell_renderer.tsx` as shown below:
```
export const DefaultCellRenderer: React.FC<CellValueElementProps> = ({
columnId,
data,
eventId,
header,
linkValues,
setCellProps,
timelineId,
}) => (
<>
{getColumnRenderer(header.id, columnRenderers, data).renderColumn({
columnName: header.id,
eventId,
field: header,
linkValues,
timelineId,
truncate: true,
values: getMappedNonEcsValue({
data,
fieldName: header.id,
}),
})}
</>
);
```
Any usages of TGrid were updated to pass `DefaultCellRenderer` as the value of the `renderCellValue` prop, as shown in the screenshot below:
<img width="1239" alt="render-cell-value" src="https://user-images.githubusercontent.com/4459398/113345484-c121f800-92ef-11eb-8a21-2b6dd8ef499b.png">
The `EuiDataGrid` [codesandbox example](https://codesandbox.io/s/nsmzs) provides the following example `renderCellValue` implementation, which highlights a cell green based on it's numeric value:
```
const renderCellValue = useMemo(() => {
return ({ rowIndex, columnId, setCellProps }) => {
const data = useContext(DataContext);
useEffect(() => {
if (columnId === 'amount') {
if (data.hasOwnProperty(rowIndex)) {
const numeric = parseFloat(
data[rowIndex][columnId].match(/\d+\.\d+/)[0],
10
);
setCellProps({
style: {
backgroundColor: `rgba(0, 255, 0, ${numeric * 0.0002})`,
},
});
}
}
}, [rowIndex, columnId, setCellProps, data]);
function getFormatted() {
return data[rowIndex][columnId].formatted
? data[rowIndex][columnId].formatted
: data[rowIndex][columnId];
}
return data.hasOwnProperty(rowIndex)
? getFormatted(rowIndex, columnId)
: null;
};
}, []);
```
The sample code above formats the `amount` column in the example `EuiDataGrid` with a green `backgroundColor` based on the value of the data, as shown in the screenshot below:
<img width="956" alt="datagrid-cell-formatting" src="https://user-images.githubusercontent.com/4459398/113348300-a782af80-92f3-11eb-896a-3d92cf4b9b53.png">
To demonstrate that similar styling can be applied to TGrid using the same technique illustrated by `EuiDataGrid`'s [codesandbox example](https://codesandbox.io/s/nsmzs), we can update the `DefaultCellRenderer` in `x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/default_cell_renderer.tsx` to apply a similar technique:
```
export const DefaultCellRenderer: React.FC<CellValueElementProps> = ({
columnId,
data,
eventId,
header,
linkValues,
setCellProps,
timelineId,
}) => {
useEffect(() => {
if (columnId === 'signal.rule.risk_score') {
const value = getMappedNonEcsValue({
data,
fieldName: columnId,
});
if (Array.isArray(value) && value.length > 0) {
const numeric = parseFloat(value[0]);
setCellProps({
style: {
backgroundColor: `rgba(0, 255, 0, ${numeric * 0.002})`,
},
});
}
}
}, [columnId, data, setCellProps]);
return (
<>
{getMappedNonEcsValue({
data,
fieldName: columnId,
})}
</>
);
};
```
The example code above renders the `signal.rule.risk_score` column in the Alerts table with a green `backgroundColor` based on the value of the data, as shown in the screenshot below:
<img width="1231" alt="alerts" src="https://user-images.githubusercontent.com/4459398/113349015-a30ac680-92f4-11eb-8518-5c1b7465e76e.png">
Note: In the screenshot above, the values in the Alerts table are not rendered as draggables.
* Hide chrome for Workplace Search by default
The Workplace Search Personal dashboard needs the chrome hidden. We hide it globally here first to prevent a flash of chrome on the Personal dashboard and unhide it for admin routes, which will be in a future commit
* Add core.chrome.setIsVisible to KibanaLogic
* Toggle chrome visibility for Workplace Search
* Add test
* Refactor to set context and chrome when pathname changes
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Fix route for private deferated source summary
* Make schema types nullable
Federated sources don’t have counts and the server returns null so our routes have to expect that sometimes these values will be null
* Add SourceSubNav to Personal dashboard
We are able to leverage the existing component with a couple a small change; the existing componet is a subnav in the larger Enterprise Search shared navigation component and does not include its styles. This caused the list items to render with bullet points next to them. Adding this class and displaying the nav items as block elements fixes this issue.
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* add spaces test
* fix updating and deleting sessions in non-default space
* revert back to batch update
* Add space tests
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Liza K <liza.katz@elastic.co>
This was causing console errors.
I factored out the column headers to their own component, and moved
all table rows to be under a tbody. This alleviates the console
warnings.
* Add toasts to FlashMessagesLogic
+ Tests cleanup:
- Group actions by their reducer blocks (since flashMessages has such specific logic) - recommend viewing with whitespace changes off for this
- Do not reset context between each test, but instead by mount(), which allows tests to maintain state between adding/removing/resetting
- Remove '()' from test names (feedback from previous PRs)
* Add toast message helpers
+ refactor FLASH_MESSAGE_TYPES to constants, so that both callouts & toasts can use it effectively
* Update FlashMessages to display toasts as well as callouts
- This means we can automatically use toasts alongside callouts in all views that already have FlashMessages
+ a11y enhancement! update callouts to also announce new messages to screenreaders
* [Example] Update ApiLogsLogic to flash an error toast on poll
+ update copy to better match EUI guidelines (shorter)
* Fix test caused by new FlashMessages structure
* PR suggestion - destructure
Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
* PR feedback: implicit return
* Fix color types
- adding our own string enum fixes the typescript errors that both EuiCallout & EuiToast emit when passing color props to the base EUI types
* PR feedback: Update flashToast API to match callout helper API
- accepts a string title with optional args, creates a unique ID automatically if missing
Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
* Remove kebabCase
Kibana routes are snake case, which matches the existing serviceType, so this is no longer needed
* Fix route segment
The word reauthenticate is not hyphenated
* Fix all misspelling of reauthenticate
Renames files too
* add runtime mapping editor in wizard
* ensure depVar is updated correctly with RF changes
* remove old RF from includes
* ensure cloning works with RF as depVar
* ensure indexPattern RF work
* scatterplot supports RTF. depVar options have indexPattern RTF on first load
* remove unnecessary types
* ensure supported fields included by default
* update types in editor
* use isRuntimeMappings
* fix translations. ensure runtimeMappings persist when going back to step 1
* ensure histograms support runtime fields
* update types
* Enterprise Search eslint import order rule fix
- mocks in current folder should be grouped with mocks from parent folders
* Run --fix/update instances of importing ./__mocks__
* Add hasBorder to all EuiPageContent panels
* EngineCreation: switch EuiPageBody to EuiPageContent
+ add hasBorder
* Credentials: update EuiPanels w/ hasBorder
* ApiCodeExample: switch to hasBorder
* DataPanel: update to take & pass hasBorder prop
* Analytics & EngineOverview: use hasBorder
* Relevance Tuning: update EuiPanels
- switch to hasBorder for top level panels
- switch to color="subdued" for boost accordion
- tweak padding of boost panel
- CSS cleanup
* Role Mappings: switch to hasBorder
+ remove unused class - `euiPanel--disabled` was not applying any styles
+ remove random 'export' string
* Sample engine CTA: switch to subdued panel
+ fix sizing - when loading button pops in, it was causing text to overflow
* Standardize process fields across process and Target.process
* Lint
* Bug fix
* Typo fix
* Add new fields to unit test, fix 0 truthiness bug, and exercise 0 truthiness bug in unit test
* Add a PR-requested unit test case
* Use Yoda Conditions, Kibana does not
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [APM] Correlations support for progressively loading sections (#95059)
* fixes type consistency
* - Adds progressive section loading for errors tab in correlations
- code improvements
* Tests for latency correlations and overall distribution APIs
* adds API test for error correlations endpoints
* renamed 'getOverallErrorDistribution' to 'getOverallErrorTimeseries'
* Code improvements
* fix whitespace
* Remove references to class `ArtifactClient` and replace with EndpointArtifactClientInterface
* refactor artifact client tests to use new class
* Added additional test to Fleet Artifacts create service
* remove SavedObject type wrapper from getArtifact response
* add base config for all the TS projects
* all the project use new tsconfig.project.json
* compile test files in the high-level tsconfig.json
* fix TS error in maps plugin
* fix TS error in infra plugin
* exclude mote test and test until folders
* uptime. do not import test code within prod code
* expressions. do not import test code within prod code
* data: export mocks from high level folder
* task_manager: comply with es client typings
* infra: remove unused enzyme_helpers
* check_ts_project requires "include" key
* ts_check should handle parent configs
* all ts configs should extend base one
* exclude test folders from plugins
* update patterns to fix ts_check errors
* Apply suggestions from code review
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
* uptime: MountWithReduxProvider to test helpers
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Gets rid of imports from 'elasticsearch' and replaces them with '@elastic/elasticsearch'.
- Extends isPopulatedObject() to allow an optional array of attributes to check if they exist. Allows us to get rid of the manual and inconsistent usages of hasOwnProperty().