* progress on bulk close
* works but could be slow
* clean up, add tests
* fix reduce types
* address 'event.' fields
* remove duplicate import
* don't replace nested fields
* my best friend typescript
* Add Frontend components for Value Lists Management Modal
Imports and uses the hooks provided by the lists plugin. Tests coming
next.
* Update value list components to use newest Lists API
* uses useEffect on a task's state instead of promise chaining
* handles the fact that API calls can be rejected with strings
* uses exportList function instead of hook
* Close modal on outside click
* Add hook for using a cursor with paged API calls.
For e.g. findLists, we can send along a cursor to optimize our query. On
the backend, this cursor is used as part of a search_after query.
* Better implementation of useCursor
* Does not require args for setCursor as they're already passed to the
hook
* Finds nearest cursor for the same page size
Eventually this logic will also include sortField as part of the
hash/lookup, but we do not currently use that on the frontend.
* Fixes useCursor hook functionality
We were previously storing the cursor on the _current_ page, when it's
only truly valid for the _next_ page (and beyond).
This was causing a few issues, but now that it's fixed everything works
great.
* Add cursor to lists query
This allows us to search_after a previous page's search, if available.
* Do not validate response of export
This is just a blob, so we have nothing to validate.
* Fix double callback post-import
After uploading a list, the modal was being shown twice. Declaring the
constituent state dependencies separately fixed the issue.
* Update ValueListsForm to manually abort import request
These hooks no longer care about/expose an abort function. In this one
case where we need that functionality, we can do it ourselves relatively
simply.
* Default modal table to five rows
* Update translation keys following plugin rename
* Try to fit table contents on a single row
Dates were wrapping (and raw), and so were wrapped in a FormattedDate
component. However, since this component didn't wrap, we needed to
shrink/truncate the uploaded_by field as well as allow the fileName to
truncate.
* Add helper function to prevent tests from logging errors
https://github.com/enzymejs/enzyme/issues/2073 seems to be an ongoing
issue, and causes components with useEffect to update after the test is
completed.
waitForUpdates ensures that updates have completed within an act()
before continuing on.
* Add jest tests for our form, table, and modal components
* Fix translation conflict
* Add more waitForUpdates to new overview page tests
Each of these logs a console.error without them.
* Fix bad merge resolution
That resulted in duplicate exports.
* Make cursor an optional parameter to findLists
This param is an optimization and not required for basic functionality.
* Tweaking Table column sizes
Makes actions column smaller, leaving more room for everything else.
* Fix bug where onSuccess is called upon pagination change
Because fetchLists changes when pagination does, and handleUploadSuccess
changes with fetchLists, our useEffect in Form was being fired on every
pagination change due to its onSuccess changing.
The solution in this instance is to remove fetchLists from
handleUploadSuccess's dependencies, as we merely want to invoke
fetchLists from it, not change our reference.
* Fix failing test
It looks like this broke because EuiTable's pagination changed from a
button to an anchor tag.
* Hide page size options on ValueLists modal table
These have style issues, and anything above 5 rows causes the modal to
scroll, so we're going to disable it for now.
* Update error callbacks now that we have Errors
We don't display the nice errors in the case of an ApiError right now,
but this is better than it was.
* Synchronize delete with the subsequent fetch
Our start() no longer resolves in a meaningful way, so we instead need
to perform the refetch in an effect watching the result of our delete.
* Cast our unknown error to an Error
useAsync generally does not know how what its tasks are going to be
rejected with, hence the unknown.
For these API calls we know that it will be an Error, but I don't
currently have a way to type that generally. For now, we'll cast it
where we use it.
* Import lists code from our new, standardized modules
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary
* Adds the ability for exception lists to be multi-list queried
* Fixes a bunch of script issues where I did not update everywhere I needed to use `ip_list` and deletes an old list that now lives within the new/lists folder
* Fixes a few io-ts issues with Encode Decode while I was in there.
* Adds two more types and their tests for supporting converting between comma separated strings and arrays for GET calls.
* Fixes one weird circular dep issue while adding more types.
You now send into the find an optional comma separated list of exception lists their namespace type and any filters like so:
```ts
GET /api/exception_lists/items/_find?list_id=simple_list,endpoint_list&namespace_type=single,agnostic&filtering=filter1,filter2"
```
And this will return the results of both together with each filter applied to each list. If you use a sort field and ordering it will order across the lists together as if they are one list. Filter is optional like before. If you provide less filters than there are lists, the lists will only apply the filters to each list until it runs out of filters and then not filter the other lists.
If at least one list is found this will _not_ return a 404 but it will _only_ query the list(s) it did find. If none of the lists are found, then this will return a 404 not found exception.
**Script testing**
See these files for more information:
* find_exception_list_items.sh
* find_exception_list_items_by_filter.sh
But basically you can create two lists and an item for each of the lists:
```ts
./post_exception_list.sh ./exception_lists/new/exception_list.json
./post_exception_list_item.sh ./exception_lists/new/exception_list_item.json
./post_exception_list.sh ./exception_lists/new/exception_list_agnostic.json
./post_exception_list_item.sh ./exception_lists/new/exception_list_item_agnostic.json
```
And then you can query these two lists together:
```ts
./find_exception_list_items.sh simple_list,endpoint_list single,agnostic
```
Or for filtering you can query both and add a filter for each one:
```ts
./find_exception_list_items_by_filter.sh simple_list,endpoint_list "exception-list.attributes.name:%20Sample%20Endpoint%20Exception%20List,exception-list-agnostic.attributes.name:%20Sample%20Endpoint%20Exception%20List" single,agnostic
```
### 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
* Fix dimension popover layout and color picker “Auto”
* Created ToolbarButton
* Move disabled help text to tooltip for missing values
* Darker side panel backgrounds
* Adding to .asciidoc about where to put the SASS import
* Moving `SASS` guidelines to STYLEGUIDE.md
* Fix keyboard focus of XY settings popover
* Fix dark mode
* Add API functions and hooks for reading and creating the lists index
* Ensure KibanaApiError extends the Error interface
It has a name, so we should type it as such. This way, we can use it
anywhere that an Error is accepted.
* Return an Error from validationEither and thus from our useAsync hooks
Because an io-ts pipeline needs a consistent type across its left value,
and validateEither was returning a string, we were forcing all our
errors to strings. In the case of an API error, however, this meant a
loss of data, since the original error's extra fields were lost.
By returning an Error from validateEither, we can now pass through Api
errors from useAsync and thus use them directly in kibana utilities like
toasts.addError.
* WIP: implements checking for and consequent creation of lists index
This adds most of the machinery that I think we're going to need. Not
featured here:
* lists privileges (stubbed out currently)
* handling when lists is disabled
* tests
* Add frontend plugin for lists
We need this to deteremine in security_solution whether lists is enabled
or not. There's no other functionality here, just boilerplate.
* Fix cross-plugin imports/exports
Now that lists has a client plugin, the optimizer cares about code
coming into and out of it.
By default, you cannot import another plugin's common/ folder into your
own common/ nor public/ folders. This is fixed by adding 'common' to
extraPublicDirs, however: extraPublicDirs need to resolve to modules.
Rather than adding each folder from which we export modules to
extraPublicDirs, I've added common/index.ts and exporting everything
through there.
By convention, I'm adding shared_exports.ts as an index of these exported modules,
and shared_imports.ts is used to import on the other end.
For now, I've left the ad hoc _deps files so as to limit the changes
here, but we should come back through and remove them at some point. NB
that I did remove lists_common_deps as it was only used in one or two
spots.
* Fix test failing due to lack of context
This component now uses useKibana indirectly through useListsConfig.
* Lists and securitySolution require each other's bundles
Without lists being a requiredBundle of securitySolution, we cannot
import its code when the plugin is disabled. The opposite is also true,
but there's no lists "app" to break.
* Fix logic in useListsConfig
Lists needs configuration if the index explicitly does not exist. If it
is true (already exists) or null (lists is disabled or we could not read
the index), we're good.
* useList* behavior when lists plugin is disabled
When the lists plugin is disabled, our calls in useListsIndex become no-ops so that:
* useListsIndex state does not change
* useListsConfig.needsConfiguration remains false as indexExists is
never non-null
This also removes use of our `useIsMounted` hook. Since the effects
we're consuming come from useAsync hooks, state will (already) not be
updated if the component is unmounted.
* Fix warning due to dynamic creation of a styled component
* Revert "Fix warning due to dynamic creation of a styled component"
This reverts commit 7124a8fbd9.
(This was already fixed on master)
* Check user's lists index privileges when determining configuration status
If there is no lists index and the user cannot create it, we will
display a configuration message in lieu of Detections
* Adds a lists hook to read privileges (missing schemae)
* Adds security hook useListsPrivileges to perform and parse the
privileges request
* Updates useListsConfig to use useListsPrivileges hook
* Move lists hooks to their own subfolder
* Redirect to main detections page if lists needs configuration
If:
* lists are enabled, and
* lists indexes DNE, and
* user cannot manage the lists indexes
Then they will be redirected to the main detections page where they'll
be instructed to configure detections. If any of the above is false,
things work as normal.
* Lock out of detections when user cannot write to value lists
Rather than add conditional logic to all our UI components dealing with
lists, we're going the heavy-handed route for now.
* Mock lists config hook in relevant Detections page tests
* Disable Detections when Lists is enabled
This refactors useListsConfig.needsConfiguration to mean:
* lists plugin is disabled, OR
* lists indexes DNE and can't be created, OR,
* user can't write to the lists index
In any of these situations, we want to disable detections, and so we
export that as a single boolean, needsConfiguration.
* Remove unneeded complexity exception
We refactored this to work 👍
* Remove outdated TODO
We link to our documentation, which will describe the lists aspects of
configuration.
* [Data Plugin] Allow server-side date formatters to accept custom timezone
When Advanced Settings shows the date format timezone to be "Browser,"
this means nothing to field formatters in the server-side context. The
field formatters need a way to accept custom format parameters. This
allows a server-side module that creates a FieldFormatMap to set a
timezone as a custom parameter. When custom formatting parameters exist,
they get combined with the defaults.
* add more to tests - need help though
* simplify changes
* api doc changes
* fix src/plugins/data/public/field_formats/constants.ts
* rerun api changes
* re-use public code in server, add test
* fix path for tests
* weird api change needed but no real diff
* 3td time api doc chagens
* move shared code to common
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This modifies the ML job setup flyout of the anomalies tab to offer a list of the two available modules. Via the list each of the modules' jobs can be created or re-created.
* Add simple variables to Canvas workpads
* Fix type for workpad variable action and clarify comment
* Fix types in fixtures and templates
* Fixing type check errors on actions
* Addressing pr feedback and refactoring canvas sidebar accordions
* Render true/false instead of Yes/no on variables
* add warning callout when editing a variable
* Address review feedback
* More feedback
* updating storyshot with new edit mode callout
* Some animation tweaks for the panel
* one more panel tweak
* Removing the slide transition for now
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* rm index: false from binary mappings
* test against unverified snapshot
* two more
* Mapping adjustments
* Revert "Mapping adjustments"
This reverts commit 52d68dcd6d.
* Revert "test against unverified snapshot"
This reverts commit 4284ac37f1.
Co-authored-by: Madison Caldwell <madison.caldwell@elastic.co>
* [Maps] use EuiColorPalettePicker and Eui palettes
* use new ramps to create mb style
* update ColorMapSelect to use EuiColorPalettePicker
* move color_utils test to color_palettes
* clean up heatmap constants
* tslint
* fix test expects
* fix merge mistake
* update jest expects
* remove .chromium folder
* another jest expect update
* remove charts from kibana.json
* remove unneeded jest.mock
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Test user artifacts for all OSes. Test unicode.
* Test hashes and sizes pre- and post- decoding
* Clean up types in ingestManager common mocks
* Fix type in package config mock
* Add test for conflict on dispatch
* Test package config conflict resolution
* style: sort plugin interface
* WIP: UsageCollector for Security Adoption
This uses ML and raw ES calls to query our ML Jobs and Rules, and parse
them into a format to be consumed by telemetry.
Still to come:
* initialization
* tests
* Initialize usage collectors during plugin setup
* Rename usage key
The service seems to convert colons to underscores, so let's just use an
underscure.
* Collector is ready if we have a kibana index
* Refactor collector to generate options in a function
This allows us to test our adherence to the collector API, focusing
particularly on the fetch function.
* Refactor usage collector in anticipation of endpoint data
We're going to have our usage data under one key corresponding to the
app, so this nests the existing data under a 'detections' key while
allowing another fetching function to be plugged into the
main collector under a separate key.
* Update our collector to satisfy telemetry tooling
* inlines collector options
* inlines schema object
* makes DetectionsUsage an interface instead of a type alias
* Extracts telemetry mappings via scripts/telemetry_extract
* Refactor detections usage logic to perform one loop instead of two
We were previously performing two loops over each set of data: one to
format it down to just the data we need, and another to convert that
into usage data. We now perform both steps within a single loop.
* Refactor detections telemetry to be nested
* Extract new nested detections telemetry mappings
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Add Workplace Search plugin to app
- Adds telemetry for Workplace Search
- Adds routing for telemetry and overview
- Registers plugin
* Add breadcrumbs for Workplace Search
* Add Workplace Search index
* Add route paths, types and shared assets
* Add shared Workplace Search components
* Add setup guide to Workplace Search
* Add error state to Workplace Search
* Add Workplace Search overview
This is the functional MVP for Workplace Search
* Update telemetry per recent changes
- Remove saved objects indexing
- add schema definition
- remove no_ws_account
- minor cleanup
* Fix pluralization syntax
- Still not working but fixed the syntax nonetheless
* Change pluralization method
- Was unable to get the `FormattedMessage` to work using the syntax in the docs. Always added ‘more’, even when there were zero (or one for users). This commit uses an alternative approach that works
* Update readme
* Fix duplicate i18n label
* Fix failing test from previous commit
🤦
* Update link for image in Setup Guide
* Remove need for hash in routes
Because of a change in the Workplace Search rails code, we can now use non-hash routes that will be redirected by rails so that we don’t have users stuck on the overview page in Workplace Search when logging in
* Directly link to source details from activity feed
Previously the dashboard in legacy Workplace Search linked to the sources page and this was replicated in the Kibana MVP. This PR aligns with the legacy dashboard directly linking to the source details
https://github.com/elastic/ent-search/pull/1688
* Add warn logging to Workplace Search telemetry collector
* Change casing to camel to match App Search
* Misc security feedback for Workplace Search
* Update licence mocks to match App Search
* PR feedback from App Search PR
* REmove duplicate code from merge conflict
* Fix tests
* Move varible declaration inside map for TypeScript
There was no other way 🤦
* Refactor last commit
* Add punctuation
Smallest commit ever.
* Fix actionPath type errors
* Update rebase feedback
* Fix failing test
* Update telemetry test after AS PR feedback
* DRY out error state prompt copy
* DRY out telemetry endpoint into a single route + DRY out
DRY out endpoint
- Instead of /api/app_search/telemetry & /api/workplace_search/telemetry, just have a single /api/enterprise_search/telemetry endpoint that takes a product param
- Update public/send_telemetry accordingly (+ write tests for SendWorkplaceSearchTelemetry)
DRY out helpers
- Pull out certain reusable helper functions into a shared lib/ folder and have them take the repo id/name as a param
- Move tests over
- Remove misplaced comment block
+BONUS
- pull out content type header that's been giving us grief in Chrome into a constant
* Remove unused telemetry type
* Minor server cleanup - DRY out mockLogger
* Setup Guide cleanup
* Clean up Loading component
- use EUI vars per feedback
- remove unnecessary wrapper
- adjust vh for Kibana layout
- Actually apply loadingSpinner styles
* Misc i18n fixes
+ minor newline reduction, because prettier lets me
* Refactor Recent Activity component/styles
- Remove table markup/styles - not semantically correct or accessible in this case - replace w flex
- Fix link colors not inheriting
- Add EuiPanel, error colors looked odd against page background
- Fix prop/type definition
- CSS cleanup - EUI vars, correct BEM, don't target generic selectors
* [Opinionated] Refactor RecentActivity component
- Pull out iterated activity items into a child subcomponent
- Move constants/strings closer to where they're being used, instead of having to jump around the file
- Move IActivityFeed definition to this file, since that's primarily where it's used
@scottybollinger - if you're not a fan of this commit no worries, just let me know and we can discuss/roll back as needed
* Refactor ViewContentHeader
- remove unused CSS
- fallback cleanup
- refactor tests
* Refactor ContentSection
- Remove unused CSS classes
- Refactor tests to include all props/more specific assertions
* Refactor StatisticCard
- Prefer using EuiTextColor to spans / custom classes
- Prefer using EuiCard's native `href` behavior over using our own wrapping link/--isClickablec class
- Note that when we port the link/destination over to React Router, we should instead opt to use React Router history, which will involve creating a EuiCard helper
- Make test a bit more specific
* Minor OrganizationStats cleanup
- Use EuiFlexGrid
* Refactor OnboardingSteps
- i18n
- Compact i18n newlines (nit)
- Convert FormattedMessage to i18n.translate for easier test assertions
- Org Name CTA
- Move to separate child subcomponent to make it easier to quickly skim the parent container
- Remove unused CSS class
- Fix/add responsive behavior
- Tests refactor
- Use describe() blocks to break up tests by card/section
- Make sure each card has tests for each state - zero, some/complete, and disabled/no access
- Assert by plain text now that we're using i18n.translate()
- Remove ContentSection/EuiPanel assertions - they're not terribly useful, and we have more specific elements to check
- Add accounts={0} test to satisfy yellow branch line
* Clean up OnboardingCard
- Remove unused CSS class
- Remove unnecessary template literal
Tests
- Swap out check for EuiFlexItem - it's not really the content we're concerned about displaying, EuiEmptyPrompt is the primary component
- Remove need for mount() by dive()ing into EuiEmptyPrompt (this also removes the need to specify a[data-test-subj] instead of just [data-test-subj])
- Simplify empty button test - previous test has already checked for href/telemetry
- Cover uncovered actionPath branch line
* Minor Overview cleanup
- Remove unused telemetry type
- Remove unused CSS class
- finally
- Remove unused license context from tests
* Feedback: UI fixes
- Fix setup guide CSS class casing
- Remove border transparent (UX > UI)
* Fix Workplace Search not being hidden on feature control
- Whoops, totally missed this 🤦
* Add very basic functional Workplace Search test
- Has to be without_host_configured, since with host requires Enterprise Search
- Just checks for basic Setup Guide redirect for now
- TODO: Add more in-depth feature/privilege functional tests for both plugins at later date
* Pay down test render/loading tech debt
- Turns out you don't need render(), shallow() skips useEffect already 🤦
- Fix outdated comment import example
* DRY out repeated mountWithApiMock into mountWithAsyncContext
+ Minor engines_overview test refactors:
- Prefer to define `const wrapper` at the start of each test rather than a `let wrapper` - this better for sandboxing / not leaking state between tests
- Move Platinum license tests above pagination, so the contrast between the two tests are easier to grok
* Design feedback
- README copy tweak + linting
- Remove unused euiCard classes from onboarding card
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
* Added updated Policy Response action names to translation file
* `formatResponse` to generate a user friendly value for action name if no i18n
* test case to cover formatting unknown actions