Commit graph

38 commits

Author SHA1 Message Date
Spencer fecdba7eba
[eslint] add rule to prevent export* in plugin index files (#109357)
* [eslint] add rule to prevent export* in plugin index files

* deduplicate export names for types/instances with the same name

* attempt to auto-fix duplicate exports too

* capture exported enums too

* enforce no_export_all for core too

* disable rule by default, allow opting-in for help fixing

* update tests

* reduce yarn.lock duplication

* add rule but no fixes

* disable all existing violations

* update api docs with new line numbers

* revert unnecessary changes to yarn.lock which only had drawbacks

* remove unnecessary eslint-disable

* rework codegen to split type exports and use babel to generate valid code

* check for "export types" deeply

* improve test by using fixtures

* add comments to some helper functions

* disable fix for namespace exports including types

* label all eslint-disable comments with related team-specific issue

* ensure that child exports of `export type` are always tracked as types

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-01 18:05:45 -07:00
Xavier Mouligneau 16af3e95cb
[RAC] Remove rbac on security solution side (#110472)
* wip to remove rbac

* Revert "[Cases] Include rule registry client for updating alert statuses (#108588)"

This reverts commit 1fd7038b34.

This leaves the rule registry mock changes

* remove rbac on Trend/Count alert

* update detection api for status

* remove @kbn-alerts packages

* fix leftover

* Switching cases to leverage update by query for alert status

* Adding missed files

* fix bad logic

* updating tests for use_alerts_privileges

* remove index alias/fields

* fix types

* fix plugin to get the right index names

* left over of alis on template

* forget to use current user for create/read route index

* updated alerts page to not show table when no privileges and updates to tests

* fix bug when switching between o11y and security solution

* updates tests and move to use privileges page when user tries to access alerts without proper access

* updating jest tests

* pairing with yara

* bring back kbn-alerts after discussion with the team

* fix types

* fix index field for o11y

* fix bug with updating index priv state

* fix i18n issue and update api docs

* fix refresh on alerts

* fix render view on alerts

* updating tests and checking for null in alerts page to not show no privileges page before load

* fix details rules

Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
Co-authored-by: Yara Tercero <yara.tercero@elastic.co>
2021-09-01 04:23:44 -04:00
Pablo Machado 3854d3a586
[RAC] EuiDataGrid pagination (#109269)
* Update T-Grid to use DataGrid pagination

* It also improves the Gtid loading state
* DataGrid pagination makes sure that we display the grid with the proper height.

* Add DataGrid height hack to t-grid

HUGE HACK!!!

DataGrtid height isn't properly calculated when the grid has horizontal scroll.
https://github.com/elastic/eui/issues/5030

In order to get around this bug we are calculating `DataGrid` height here and setting it as a prop.

Please revert this commit  and allow DataGrid to calculate its height when the bug is fixed.

* Apply DataGrid laoding and pagination changes to observability

* Fix cypress tests

* Fix t-grid page render bug on Observability

* some pagination fixes

* hide table when analyzer active

* isolate exported function

Co-authored-by: semd <sergi.massaneda@elastic.co>
2021-08-26 14:41:47 -04:00
Steph Milovic 27af6ef068
[Security Solution] Bugfix for disable state of External Alert context menu (#109914) 2021-08-25 12:49:19 -06:00
Xavier Mouligneau 6a1a38b346
[RAC] [o11y] add permission in alerts table from kibana privilege/consumer (#109759)
* add alert permission in o11y

* review I

* review II

* fix selection all when checkbox disabled

* fix selected on bulk actions
2021-08-24 23:32:40 -04:00
Andrew Goldstein a161c2b7d8
[RAC] [TGrid] Use EuiDataGridColumn schemas (for sorting) (#109983)
## Summary

Updates the `TGrid` to use `EuiDataGrid` [schemas](https://eui.elastic.co/#/tabular-content/data-grid-schemas-and-popovers/) as suggested by @snide in the following issue: <https://github.com/elastic/kibana/issues/108894>

## Desk testing

1) In the `Security Solution`, navigate to `Security > Rules` and enable multiple detection rules that have different `Risk Score`s

**Expected result**

- The Detection Engine generates alerts (when the rule's criteria is met) that have different risk scores

2) Navigate to the `Security > Alerts` page

**Expected results**

As shown in the screenshot below:

- The alerts table is sorted by `@timestamp` in descending (Z-A) order, "newest first"
- The `@timestamp` field in every row is newer than, or the same time as the row below it
- The alerts table shows a non-zero count of alerts, e.g. `20,600 alerts`

![alerts-table-at-page-load](https://user-images.githubusercontent.com/4459398/130700525-343d51af-7a3a-475c-b3b4-b429bc212adf.png)

_Above: At page load, the alerts table is sorted by `@timestamp` in descending (Z-A) order, "newest first"_

3) Observe the count of alerts shown in the header of the alerts table, e.g. `20,600 alerts`, and then change the global date picker in the KQL bar from `Today` to `Last 1 year`

**Expected results**

- The golbal date picker now reads `Last 1 year`
- The count of the alerts displayed in the alerts table has increased, e.g. from `20,600 alerts` to `118,709 alerts`
- The `@timestamp` field in every row is (still) newer than, or the same time as the row below it

4) Click on the `@timestamp` column, and choose `Sort A-Z` from the popover, to change the sorting to ascending, "oldest first", as shown in the screenshot below:

![click-sort-ascending](https://user-images.githubusercontent.com/4459398/130701250-3f229644-2a78-409e-80ff-f88588562190.png)

_Above: Click `Sort A-Z` to sort ascending, "oldest first"_

**Expected results**

As shown in the screenshot below:

- The alerts table is sorted by `@timestamp` in ascending (A-Z) order, "oldest first"
- The `@timestamp` field in every row is older than, or the same time as the row below it
- `@timestamp` is older than the previously shown value, e.g. `Aug 3` instead of `Aug 24`

![timestamp-ascending-oldest-first](https://user-images.githubusercontent.com/4459398/130702221-cc8cf84f-c044-4574-8a93-b9d35c14c890.png)

_Above: The alerts table is now sorted by `@timestamp` in ascending (A-Z) order, "oldest first"_

5) Click on the `Risk Score` column, and choose `Sort A-Z` from the popover, to add `Risk Score` as a secondary sort in descending (Z-A) "highest first" order, as shown in the screenshot below:

![sort-risk-score](https://user-images.githubusercontent.com/4459398/130702599-e4c0d74a-8775-435b-a263-5b6b278f6dfd.png)

_Above: Click `Sort A-Z` to add `Risk Score` as a secondary sort in descending (Z-A) "highest first" order_

**Expected results**

- The alerts table re-fetches data
- The alerts table shows `2 fields sorted`

6) Hover over the alerts table and click the `Inspect` magnifiing glass icon

**Expected result**

- The `Inspect` modal appaers, as shown in the screenshot below:

![inspect](https://user-images.githubusercontent.com/4459398/130702849-1189f32e-eb03-4d9d-b248-6c6f0b5665fa.png)

_Above: the `Inspect` modal_

7) Click the `Request` tab, and scroll to the `sort` section of the request

**Expected result**

Per the JSON shown below:

- The request is sorted first by `@timestamp` in ascending (A-Z) order, "oldest first"
- The request is sorted second by `signal.rule.risk_score` descending (Z-A) "highest first" order

```json
  "sort": [
    {
      "@timestamp": {
        "order": "asc",
        "unmapped_type": "date"
      }
    },
    {
      "signal.rule.risk_score": {
        "order": "desc",
        "unmapped_type": "number"
      }
    }
  ],
```

8) Click `Close` to close the `Inspect` modal

9) Click `2 fields sorted` to display the sort popover

10) Use the drag handles to, via drag-and-drop, update the sorting such that `Risk Score` is sorted **before** `@timestamp`, as shown in the screenshot below:

![sort-by-risk-score-first](https://user-images.githubusercontent.com/4459398/130704159-523effa2-21ef-4599-a939-964fc523f9ec.png)

_Above: Use the drag handles to, via drag-and-drop, update the sorting such that `Risk Score` is sorted **before** `@timestamp`_

**Expected results**

As shown in the screenshot below:

- The table is updated to be sorted first by the higest risk score, e.g. previously `47`, now `73`
- The alerts table is sorted second by `@timestamp` in ascending (A-Z) order, "oldest first", and *may* have changed, e.g. from `Aug 3` to `Aug 12`, depending on the sample data in your environment

![highest-risk-score](https://user-images.githubusercontent.com/4459398/130704878-163a2427-fc7a-4755-9adc-a06b0d7b8e43.png)

_Above: The alerts table is now sorted first by highest risk score_

11) Once again, hover over the alerts table and click the `Inspect` magnifiing glass icon

12) Once again, click the `Request` tab, and scroll to the `sort` section of the request

**Expected result**

Per the JSON shown below:

- The request is sorted first by `signal.rule.risk_score` in descending (Z-A) "highest first" order
- The request is sorted second by `@timestamp` in ascending (A-Z) order, "oldest first"

```json
  "sort": [
    {
      "signal.rule.risk_score": {
        "order": "desc",
        "unmapped_type": "number"
      }
    },
    {
      "@timestamp": {
        "order": "asc",
        "unmapped_type": "date"
      }
    }
  ],
```
2021-08-24 20:53:35 -06:00
Steph Milovic a75db0550b
[Security Solution] [Bugfix] Fixes broken alert actions (add to case, investigate in timeline) (#109339) 2021-08-24 10:44:56 -04:00
Angela Chuang e4bb6a91c4
fix disabled dropdown in alerts table (#109724) 2021-08-24 08:59:15 +01:00
Xavier Mouligneau e8e53e36e5
[RAC] Get o11y alerts in alerts table (#109346)
* get back index names  in o11y

* testing and integration

* fix types

* Avoid using the rule data client for field list

* Remove left-over index argument

* no needs of alert consumer anymore

Co-authored-by: Felix Stürmer <stuermer@weltenwort.de>
2021-08-20 12:52:34 -04:00
Alejandro Fernández Gómez 5fd903b7fe
[RAC] Enable workflow status filtering (#108215)
Co-authored-by: Jason Rhodes <jason.matthew.rhodes@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-20 12:07:09 +02:00
Davis Plumlee fc1a2bbd1b
[Security Solution][Detection Alerts] Changes in-progress status to acknowledged (#107972) 2021-08-18 02:12:16 -04:00
Sergi Massaneda b607f42fcf
[RAC][Observability] Add status update actions in row menu (#108698)
* use rac alerts bulk_update

* cleanup

* adds replace ALERT_STATUS with ALERT_WORKFLOW_STATUS and updates tests and adds logic for switching between signal.status and workflow status when updating alerts in .siem-signals

* allow object and string types in query param, fixed single update api to use WORKFLOW_STATUS instead of ALERT_STATUS

* adds additional integration test for when query is a DSL object in addtion to KQL string

* optionally use fields api in requests if _source does not contain authz properties

* integrate bulk update to all hook calls

* adds fields support, fixes bug where we were writing to 'signals.status' and not { signals: {status }} in alerts client

* clean up and fixes

* fix a bug where we were not waiting for updates to complete when using ids param in alerts bulk update. Adds integration tests for detection engine testing update alerts with new alerts as data client routes

* take index name from ecsData props

* pr suggestions

* some more type fixes

* refactor and type fixes

* snapshot updated

* add status update actions to row context menu

* refactor to use dispatch function in o11y actions

* comment removed

* bring alertConsumer back

* bring indexNames back

* check capabilities to show status update items

Co-authored-by: Devin Hurley <devin.hurley@elastic.co>
2021-08-17 16:03:35 -04:00
Angela Chuang 04a8a3c199
[RAC] integrating rbac search strategy with alert flyout (#108748)
* add alert consumers for useTimelineEventDetails

* set entityType to events

* rename to AlertConsumers

* set entityType to alerts

* send entity type to search strategy

* fix import

* fix import

* fix import

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-17 14:20:17 +01:00
Tiago Costa 3ab852f213
Revert "[RAC] integrating rbac search strategy with alert flyout (#108375)"
This reverts commit c6c24e4392.
2021-08-16 15:15:19 +01:00
Angela Chuang c6c24e4392
[RAC] integrating rbac search strategy with alert flyout (#108375)
* add alert consumers for useTimelineEventDetails

* set entityType to events

* rename to AlertConsumers

* set entityType to alerts

* send entity type to search strategy

* fix import

* fix import

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-16 08:58:27 -04:00
Ryland Herrick a9844db461
[Security Solution][CTI] Update legacy CTI signals to latest ECS threat fields (#107988)
* WIP: Adding integration test

* Replace threat.indicator mappings with threat.enrichments mappings

The nested threat.indicator mappings were experimental, and replaced by
threat.enrichmentsin ECS 1.10. While these fields are also experimental,
they fix the conflict between CTI data's normal threat.indicator
mappings.

* Add threat.enrichments mappings to our signals template mappings

event.* is no longer nested within here; it was determined that event
fields were not relevant to enrichment. All relevant ECS fieldsets
(file, pe, etc) are now nested under threat.enrichments.

* Update snapshot with newest threat.enrichments mappings

This test is a snapshot of the actual mappings applied by our templates. Looks good to me!

* Update ECS types to match latest

We now have two threat fields we care about for CTI, for legacy and
official ECS.

* Add a basic test for behavior of legacy enriched signals.

They're still queryable by threat.indicator, meaning that any existing
dashboards will still work.

* WIP: First pass at a data migration for CTI signals

* Defines reindex script to move things around
* Adds integration tests to make sure the migration and new mappings
  work
* Need to test a few more things and verify corner cases
* Need to extract some helpers from tests

* Bump our template version to ensure devs roll over

Marshall bumped to 55, giving us 10 versions for 7.14.x updates.
However, devs would not otherwise roll over and get my mapping updates
without destroying their signals index and rebuilding (which is also not
the same thing, exactly), so this trades having one higher signals
version for a more streamlined dev workflow.

* More robust guard against data migration

We only attempt to migrate legacy enrichments if the document:

* is a signal from an indicator match rule
* has a `threat.indicator` field
* does not have a `threat.enrichments` field

* Minor reorder of operations to make logic clearer

* Add more assertions around our signals data migration

Tests a few more pieces of the resulting document, giving more
confidence that it's the correct transformation (and mappings).

This also modifies/anonymizes the data that was originally generated on
a work machine.

* Remove outdated note

This was for when these tests were driven via the UI; the API is more
responsive and now synchronization is currently needed here, beyond the
200 responses.

* Fix typo in comment

These fields are in ECS 1.11.

* Update snapshot test

We bumped the version previously, causing this test to become outdated.

* Update ECS typings in timelines plugin

These were copied from the security_solution plugin. I updated those,
but neglected to update these.

Until there's a better mechanism for deduplication here, I'm going to
kick the can and update both for now.

* Update enrichments logic to read/write from threat.enrichments

* indicator match rule logic
  * we now simply copy from the specified indicator path, and place that
    in `threat.enrichments.indicator`
* event enrichment API logic
  * We were previously returning fields from `indicator.*`, we now
    include the `indicator.*` suffix in order to be more consistent with
    the sibling `matched.*` fields
* row renderer logic
  * removal of dataset
  * updates relevant to API changes above

* Fix logical error in generating links from indicator fields

We want to link the reference field, not a `first_seen` field.

* Always include the indicator prefix in first-party indicator fields

Prior to this change we would display e.g. `threatintel.indicator.foo`
for investigation enrichment fields. Now that the structure has changed
slightly and we return both `indicator.*` and `matched.*` fields for
existing enrichents, we want to display investigation enrichment
similarly.

* Update indicator match rule integration tests

Now that we've updated our enrichment logic, we need to update our
enrichment tests.

* Remove unused translation

* Update example row renderer data for enriched alerts

* Update parallel CTI constants to get our CTI row renderer working

We were not requesting the necessary fields for our row renderer, since
these constants (specifically CTI_ROW_RENDERER_FIELDS) now exist in both
security_solution and the timelines plugin. I had updated the former,
but only the latter is actually used.

* Update CTI enrichment UI tests

* Update prepackaged threat timeline template with new threat fields

Also bumps the timelineTemplateVersion.

* Update Indicator Match rule tests

These needed three things:

* Update to timeline template (see previous commit)
* Changing expectations from `threat.indicator` to `threat.enrichments`
* Update row renderer expectation to exclude dataset

* Update mock data with newest CTI enrichment fields

* Fix assertion on our threat details

These fields are prefixed with `indicator` now because:

1. This data pertains to the indicator, not the match per se
2. The actual field is prefixed with indicator (or, it at least
   specifies an indicator in the case of a custom threat index (via
   threat_indicator_path))

* Update test data and tests for our field parsing helpers

* Update more event-parsing tests

Ths one involved updating a mock in another package.

* Modify our helper function to support old filebeat indicators

When we query indicators for enrichment matches, the current expectation
is that we'll be querying 7.14 filebeat modules, which have an indicator
path of 'threatintel.indicator'. The only place that matters on the UI
is on the threat intel panel, where these indicators come back with such
a prefix.

This change has one behavior: it brings back the `provider` field on the
Alert summary tab for queried enrichments from filebeat modules.

* Update variable and method names to be more consistent with internal terminology

Indicators come from a CTI index. Enrichments are the application of
indicator data to other documents, and contain both indicator fields and
matched context.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-14 01:57:23 -04:00
Sergi Massaneda a7661a553c
[TGrid] Alerts status update use RAC api (#108092)
Co-authored-by: Devin Hurley <devin.hurley@elastic.co>
2021-08-13 22:11:53 -04:00
Liza Katz e91baea5dc
[Data][Es Query] Use ES types instead of DslQuery (#108290)
* es-query types

* jest and lint

* cc

* options

* type

* type
2021-08-12 21:23:33 +02:00
Pablo Machado 79fefe0311
[Security solution] [RAC] Add row renderer popover to alert table "reason" field (#108054)
* Add row renderer popover to alert table reason field

* Add a title to row renderer popover on alert table

* Fix issues found during code review
2021-08-12 11:11:53 -04:00
Jonathan Budzenski 2ab5c2c40a Revert "[RAC] integrating rbac search strategy with alert flyout (#107748)"
This reverts commit e9ac0c6674.
2021-08-12 08:20:28 -05:00
Angela Chuang e9ac0c6674
[RAC] integrating rbac search strategy with alert flyout (#107748)
* add alert consumers for useTimelineEventDetails

* set entityType to events

* rename to AlertConsumers

* set entityType to alerts

* send entity type to search strategy

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-12 10:54:17 +01:00
Michael Olorunnisola 09470dcccf
[Security Solution][RAC] - Add reason field (#107532) 2021-08-11 17:18:04 -04:00
Tiago Costa dfaf54082a
chore(NA): moving @kbn/rule-data-utils to babel transpiler (#107573)
* chore(NA): moving @kbn/rule-data-utils to babel transpiler

* chore(NA): update imports

* chore(NA): targetted imports for apm

* chore(NA): fix imports

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-11 15:59:21 +01:00
Liza Katz 204efae5bf
[Data cleanup] unify serializable state (#107745)
* Use Serializable from package

* Rename to align with core

* fix

* more replacements

* docssss

* fix

* Move it to @kbn/utility-types and remove core export

* buildy build

* tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-10 13:03:48 +02:00
Xavier Mouligneau 923eca0adf
[RAC] integrating rbac search strategy with alert table (#107242)
### Summary

We are integrating alert search strategy with RBAC on top of alert tables for security solution and o11y.
2021-08-05 21:10:27 -04:00
Andrew Goldstein 5f409bc339
[RAC] [TGrid] Implements cell actions in the TGrid (#107771)
## Summary

This PR implements cell actions in the `TGrid`, rendering them via `EuiDataGrid`, per the `Before` and `After` screenshots below:

### Before

Users previously hovered over a draggable field to view and trigger cell actions:

<img width="1348" alt="legacy_cell_actions" src="https://user-images.githubusercontent.com/4459398/128351498-49b4d224-6c51-4293-b14f-46bbb58f7cb3.png">

_Above: legacy `TGrid` cell action rendering_

### After

Cell actions are now rendered via `EuiDataGrid` cell actions:

<img width="997" alt="euidatagrid_cell_actions" src="https://user-images.githubusercontent.com/4459398/128358847-c5540ea4-8ba1-4b35-ab6b-3b3e39ae54ce.png">

_Above: new `TGrid` cell action rendering via `EuiDataGrid`_

## Technical Details

Every instance of the `TGrid` on a page can specify its own set of cell actions via `defaultCellActions` when calling the `timelines.getTGrid()` function to create an instance.

For example, the Observability Alerts `TGrid` is initialized in with a default set of actions in `x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx`, as shown in the code below:

```ts
      {timelines.getTGrid<'standalone'>({
        type: 'standalone',
        columns,
        deletedEventIds: [],
        defaultCellActions: getDefaultCellActions({ enableFilterActions: false }), // <-- defaultCellActions
        // ...
    </>
```

The type of the `defaultCellActions` is:

```ts
defaultCellActions?: TGridCellAction[];
```

and the definition of `TGridCellAction` is in `x-pack/plugins/timelines/common/types/timeline/columns/index.tsx`:

```ts
/**
 * A `TGridCellAction` function accepts `data`, where each row of data is
 * represented as a `TimelineNonEcsData[]`. For example, `data[0]` would
 * contain a `TimelineNonEcsData[]` with the first row of data.
 *
 * A `TGridCellAction` returns a function that has access to all the
 * `EuiDataGridColumnCellActionProps`, _plus_ access to `data`,
 *  which enables code like the following example to be written:
 *
 * Example:
 * ```
 * ({ data }: { data: TimelineNonEcsData[][] }) => ({ rowIndex, columnId, Component }) => {
 *   const value = getMappedNonEcsValue({
 *     data: data[rowIndex], // access a specific row's values
 *     fieldName: columnId,
 *   });
 *
 *   return (
 *     <Component onClick={() => alert(`row ${rowIndex} col ${columnId} has value ${value}`)} iconType="heart">
 *       {'Love it'}
 *      </Component>
 *   );
 * };
 * ```
 */
export type TGridCellAction = ({
  browserFields,
  data,
}: {
  browserFields: BrowserFields;
  /** each row of data is represented as one TimelineNonEcsData[] */
  data: TimelineNonEcsData[][];
}) => (props: EuiDataGridColumnCellActionProps) => ReactNode;
```

For example, the following `TGridCellAction[]` defines the `Copy to clipboard` action for the Observability Alerts table in `x-pack/plugins/observability/public/pages/alerts/default_cell_actions.tsx`:

```ts
/** actions common to all cells (e.g. copy to clipboard) */
const commonCellActions: TGridCellAction[] = [
  ({ data }: { data: TimelineNonEcsData[][] }) => ({ rowIndex, columnId, Component }) => {
    const { timelines } = useKibanaServices();

    const value = getMappedNonEcsValue({
      data: data[rowIndex],
      fieldName: columnId,
    });

    return (
      <>
        {timelines.getHoverActions().getCopyButton({
          Component,
          field: columnId,
          isHoverAction: false,
          ownFocus: false,
          showTooltip: false,
          value,
        })}
      </>
    );
  },
];
```

Note that an _implementation_ of the copy to clipboard cell action, including the button, is available for both the Observability and Security solutions to use via `timelines.getHoverActions().getCopyButton()`, (and both solutions use it in this PR), but there's no requirement to use that specific implementation of the copy action.

### Security Solution cell actions

All previously-available hover actions in the Security Solution are now available as cell actions, i.e.:

- Filter for value
- Filter out value
- Add to timeline investigation
- Show Top `<field>` (only enabled for some data types)
- Copy to clipboard

### Observability cell actions

In this PR:

- Only the `Copy to clipboard` cell action is enabled by default in the Observability Alerts table
- The `Filter for value` and `Filter out value` cell actions may be enabled in the `Observability` solution by changing a single line of code, (setting `enableFilterActions` to true), on the following line in `x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx`:

```js
defaultCellActions: getDefaultCellActions({ enableFilterActions: false }), // <-- set this to `true` to enable the filter actions
```

`enableFilterActions` is set to `false` in this PR because the Observability Alerts page's search bar, defined in `x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx`:

```ts
  return (
    <SearchBar
      indexPatterns={dynamicIndexPattern}
      placeholder={i18n.translate('xpack.observability.alerts.searchBarPlaceholder', {
        defaultMessage: 'kibana.alert.evaluation.threshold > 75',
      })}
      query={{ query: query ?? '', language: queryLanguage }}
      // ...
    />
````

must be integrated with a `filterManager` to display the filters. A `filterManager` instance may be obtained in the Observability solution via the following boilerplate:

```ts
  const {
    services: {
      data: {
        query: { filterManager },
      },
    },
  } = useKibana<ObservabilityPublicPluginsStart>();
```

## Desk testing

To desk test this PR, you must enable feature flags in the Observability and Security Solution:

- To desk test the `Observability > Alerts` page, add the following settings to `config/kibana.dev.yml`:

```
xpack.observability.unsafe.cases.enabled: true
xpack.observability.unsafe.alertingExperience.enabled: true
xpack.ruleRegistry.write.enabled: true
```

- To desk test the TGrid in the following Security Solution, edit `x-pack/plugins/security_solution/common/experimental_features.ts` and in the `allowedExperimentalValues` section set:

```typescript
tGridEnabled: true,
```

cc @mdefazio
2021-08-05 12:46:07 -06:00
Andrew Goldstein f4bc4d1ea4
[RAC] [TGrid] Implements sorting in the TGrid (#107495)
## Summary

This PR implements sorting in the `TGrid`, per the animated gifs below:

![observability-sorting](https://user-images.githubusercontent.com/4459398/127960825-5be21a92-81c1-487d-9c62-1335495f4561.gif)

_Above: Sorting in Observability, via `EuiDataGrid`'s sort popover_

![security-solution-sorting](https://user-images.githubusercontent.com/4459398/128050301-0ea9ccbc-7896-46ef-96da-17b5b6d2e34b.gif)

_Above: Sorting and hiding columns in the Security Solution via `EuiDataGrid`'s column header actions_

## Details

* Sorting is disabled for non-aggregatble fields
* This PR resolves the `Sort [Object Object]` TODO described [here](https://github.com/elastic/kibana/pull/106199#issuecomment-883668966)
* ~This PR restores the column header tooltips where the TGrid is used in the Security Solution~

## Desk testing

To desk test this PR, you must enable feature flags in the Observability and Security Solution:

- To desk test the `Observability > Alerts` page, add the following settings to `config/kibana.dev.yml`:

```
xpack.observability.unsafe.cases.enabled: true
xpack.observability.unsafe.alertingExperience.enabled: true
xpack.ruleRegistry.write.enabled: true
```

- To desk test the TGrid in the following Security Solution, edit `x-pack/plugins/security_solution/common/experimental_features.ts` and in the `allowedExperimentalValues` section set:

```typescript
tGridEnabled: true,
```

cc @mdefazio
2021-08-03 16:41:44 -06:00
Sergi Massaneda b5e8db2443
[RAC] [TGrid] Bulk actions to EuiDataGrid toolbar (#107141)
* tGrid EuiDataGrid toolbar replace utilityBar

* tgrid new prop in observability

* types and translations fixes

* bulkActions props and encapsulation

* update limits

* code cleaning

* load lazy and remove export from public

* add memoization to bulk_actions

* icon change and test fixed

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-03 14:02:44 -04:00
Xavier Mouligneau b0827d038f
[RAC] [SECURITY SOLUTION] Remove drag drop security solutions (#107162)
* wip to remove drag & drop

* fix timeline action visibility and filter present on scroll

* remove unused class

* clean up hover actions

* add isDraggable on row render to allow the control of drag and drop

* fix add to timeline to work the old way

* fix types + unit test

* fix cypress test, I went to  fast  with the renaming

* review I

* fix pagination

* fix type introduce by another PR

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
2021-07-29 11:53:05 -04:00
Jonathan Budzenski 05cebcde93 Revert "[RAC] [SECURIT SOLUTIUONS] Remove drag drop security solutions (#106721)"
This reverts commit 3f14abb372.
2021-07-28 20:25:06 -05:00
Xavier Mouligneau 3f14abb372
[RAC] [SECURIT SOLUTIUONS] Remove drag drop security solutions (#106721)
* wip to remove drag & drop

* fix timeline action visibility and filter present on scroll

* remove unused class

* clean up hover actions

* add isDraggable on row render to allow the control of drag and drop

* fix add to timeline to work the old way

* fix types + unit test

* fix cypress test, I went to  fast  with the renaming

* review I

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
2021-07-28 20:12:10 -04:00
Yara Tercero 44a9dadaff
[Timeline][RBAC] - Add RBAC logic to timeline alerts search strategy (#105333)
## Summary
 
Adds RBAC layer to timeline plugin search strategy for alerts.
2021-07-28 01:36:54 -04:00
Steph Milovic c0ceb06f4b
[Security Solution] UEBA Spacetime Project (#104973)
Merging with known issues documented here: https://github.com/elastic/kibana/issues/106648
2021-07-23 09:49:55 -05:00
Liza Katz a6af9d5050
[Es query] Move to package (#103530)
May the forces of bootstrapping helps us 🙏🏻 😉
2021-07-21 17:10:55 +02:00
Andrew Goldstein f1539ddd29
[RAC] [TGrid] Migrate the TGrid's rendering to EuiDataGrid (#106199)
## [RAC] [TGrid] Migrate the TGrid's rendering to `EuiDataGrid`

This PR migrates TGrid's rendering to use `EuiDataGrid`, per the screenshots below:

![o11y_alerts](https://user-images.githubusercontent.com/4459398/126413504-e825a5a2-1cb5-475e-b514-01fb819793e1.png)

![security_solution_alerts](https://user-images.githubusercontent.com/4459398/126413546-28df8f28-fa81-4b97-91c6-667589ea683c.png)

Related RAC Issue: https://github.com/elastic/security-team/issues/1299

### Prerequisites to deleting legacy code (reducing bundle sizes)

To reduce the size of the `timelines` and `security_solution` plugins, legacy TGrid code and the dependency on `react-beautiful-dnd` will be removed in a follow-up PR.

- Related issue: https://github.com/elastic/kibana/issues/105941

The legacy code and dependencies will be deleted when the following tasks are completed (in follow-up PRs):

- Sorting: Map `redux` sort state to `EuiDataGrid`'s `sorting` prop
- Actions: Migrate draggable hover actions to `EuiDataGrid` `cellActions`
  - related PR: <https://github.com/elastic/kibana/pull/105500>
- Use `BrowserFields` to display field metadata when hovering over a column
  - related PR: <https://github.com/elastic/kibana/pull/105207>
- Migrate Security Solution's actions column config from a single column to multiple columns

### Desk testing

To desk test this PR, you must enable feature flags in the Observability and Security Solution:

- To desk test the `Observability > Alerts` page, add the following settings to `config/kibana.dev.yml`:

```
xpack.observability.unsafe.cases.enabled: true
xpack.observability.unsafe.alertingExperience.enabled: true
xpack.ruleRegistry.write.enabled: true
```

- To desk test the TGrid in the following Security Solution, edit `x-pack/plugins/security_solution/common/experimental_features.ts` and in the `allowedExperimentalValues` section set:

```typescript
tGridEnabled: true,
```
2021-07-20 21:54:57 -06:00
Xavier Mouligneau 4fa3dc46cb
[RAC] T-Grid is moving to a new home (#100265)
* wip

* First pass at standalone and embedded redux stores and usage

* wip

* First pass at standalone and embedded redux stores and usage

* wip

* clean up

* wip

* refact(NA): remove extra pkg_npm target and add specific target folders on @kbn/i18n

* cleanup

* - fixes type errors in tests

* WIP remove use_manage_timeline

* wip add query + selector

* finishing integrating timeline manage context from redux

* integrating t-grid in security solution

* fix RowRender type

* WIP begin to move components from package to plugin

* integration of t-grid inside of security solution

* wip to make redux work

* little trick to make  it render

* - fixes a few type errors

* better integration betwen tgrid and security solutions

* bringing back tsconfig on timeline

* wip integration t-grid in observability

* fix types

* fix type in security solutions

* add type to import + trie dto get the bundle size as small as possible

* fix type in integration test

* fix type in integration test

* - fix tests

* clean up to use technical fields

* - fixes unit tests

* - mocks the `useDateFormat` function of the `useKibana` service to fix unit tests

* fix t-grid settings vs create timeline + fix inspect button

* fix last suites test

* Update unit tests, snapshots and lint

* Fix bad merge

* fix plugin export

* Fix some failing tests

* fix unit tets in timelines plugins

* fix latest test

* fix i18n

* free obs from t-grid

* Fix timeline functional plugin types

* fix store provider

* Update failing defaultHeader test

* Fix i18n usage in security solution

* Fix remaining i18n errors in timelines plugin

* Dedupe common shared types

* move drag and drop utils in package to avoid duplication

* More shared type cleanup

* add feature flag

* review I

* fix merge  with master

* fix i18n translation

* More type deduping

* Use @kbn/common-utils, fix remaining types

* fix types

* fix tests

* missing type

* fix cypress tests

Co-authored-by: Kevin Qualters <kevin.qualters@elastic.co>
Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
Co-authored-by: Andrew Goldstein <andrew.goldstein@elastic.co>
2021-06-22 18:56:33 -04:00
Spencer 27c191d405
[plugin-generator] don't generate .eslintrc.js files for internal plugins (#96921)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-04-13 07:43:03 -07:00
Kevin Qualters 03b104cc61
[Security Solution][RAC][Timeline] Timeline plugin skeleton and test plugin harness (#95683)
* [RAC][Security Solution] Initial timeline and test plugin harness

* Change plugin name from timeline to timelines
2021-03-31 15:33:19 -04:00