Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legrego redesign space selector #4

Merged

Conversation

cchaos
Copy link

@cchaos cchaos commented Jun 20, 2018

@legrego Here's a quicky design clean up. It didn't need a lot of work, so good job!! Just a couple things to note for what I did:

  • Mainly fixing some spacing and width in main layout
  • Ensuring you can pass other props (mainly classes) to the space avatar
  • Card adjustments
    • Putting avatar as the card’s icon
    • Only min-heighting the cards, but also truncating the description if it’s too long. This will make it look better if the description is really long or else you’ll just get half cut off text.
    • Remove extra elements around Card title since it’s already applied within the EuiCard itself. Just needs a string.

cchaos added 4 commits June 20, 2018 15:23
- Putting avatar as the card’s `icon`
- Only min-heighting the cards, but also truncating the description if it’s too long. This will make it look better if the description is really long or else you’ll just get half cut off text.
- Remove extra elements around Card title since it’s already applied within the `EuiCard` itselft. Just needs a string.
Uses a darkened color of the blue so it stands out and not washes out
Copy link
Owner

@legrego legrego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much! I appreciate the touch ups and summary explanation of your changes. Looks great!

@legrego legrego merged commit cb21278 into legrego:redesign-space-selector Jun 20, 2018
@cchaos cchaos deleted the legrego-redesign-space-selector branch July 26, 2018 17:33
legrego pushed a commit that referenced this pull request Sep 7, 2018
Initial round of spaces api testing
legrego pushed a commit that referenced this pull request Sep 10, 2018
commit 23515b1
Author: kobelb <[email protected]>
Date:   Mon Sep 10 06:57:58 2018 -0400

    Adding more users to the spaces tests

commit 4bbde73
Author: kobelb <[email protected]>
Date:   Mon Sep 10 06:09:35 2018 -0400

    Adding not space aware get tests

commit 5d11bef
Author: kobelb <[email protected]>
Date:   Sat Sep 8 14:06:20 2018 -0400

    Adding not space aware test to find

commit f9383fd
Author: kobelb <[email protected]>
Date:   Sat Sep 8 13:49:04 2018 -0400

    Adding bulk create tests and testing non space aware type with bulkGet

commit 5388b5a
Author: kobelb <[email protected]>
Date:   Fri Sep 7 16:18:04 2018 -0400

    Adding bulk create test

commit 0674263
Author: kobelb <[email protected]>
Date:   Fri Sep 7 15:58:21 2018 -0400

    Ignoring some modules

commit 6b011d3
Author: kobelb <[email protected]>
Date:   Fri Sep 7 15:55:58 2018 -0400

    Making the users match for saved objects security and spaces

commit de2f994
Author: kobelb <[email protected]>
Date:   Fri Sep 7 14:18:53 2018 -0400

    Making the space suites define their own test expectations

commit 5407866
Author: kobelb <[email protected]>
Date:   Fri Sep 7 13:15:46 2018 -0400

    Removing redundant spaces folder

commit 9913923
Author: kobelb <[email protected]>
Date:   Fri Sep 7 13:14:45 2018 -0400

    Removing unneeded objects from the esarchive

commit bc602b1
Author: kobelb <[email protected]>
Date:   Fri Sep 7 13:08:12 2018 -0400

    Moving some tests around

commit 7fec308
Author: kobelb <[email protected]>
Date:   Fri Sep 7 12:38:23 2018 -0400

    Deleting rbac_api_integration tests, they've been migrated elsewhere

commit 29c018e
Author: kobelb <[email protected]>
Date:   Fri Sep 7 10:01:16 2018 -0400

    Importing SuperTest where needed

commit 38d2e74
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:44:53 2018 -0400

    Removing the "saved_objects" folder

commit 70eada4
Merge: 1b2708f 9023431
Author: Brandon Kobel <[email protected]>
Date:   Fri Sep 7 10:04:03 2018 -0400

    Merge pull request #4 from legrego/spaces-api-tests

    Initial round of spaces api testing

commit 9023431
Merge: 6410f72 1b2708f
Author: Larry Gregory <[email protected]>
Date:   Fri Sep 7 09:37:57 2018 -0400

    Merge remote-tracking branch 'kobelb/spaces/securing-api-tests' into spaces-api-tests

commit 1b2708f
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:17:25 2018 -0400

    Even more typescript

commit 369a429
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:08:28 2018 -0400

    Typescriptifying Get

commit f53f2ab
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:01:48 2018 -0400

    Typescriptifying Find

commit f707e03
Author: kobelb <[email protected]>
Date:   Fri Sep 7 07:55:10 2018 -0400

    Typescriptifying Create

commit 485d983
Author: kobelb <[email protected]>
Date:   Fri Sep 7 07:31:54 2018 -0400

    Changing the namespace agnostic type name

commit 71c2122
Author: kobelb <[email protected]>
Date:   Fri Sep 7 07:25:15 2018 -0400

    Adding update tests

commit f60e953
Author: kobelb <[email protected]>
Date:   Thu Sep 6 15:53:34 2018 -0400

    Delete tests

commit 94682e5
Author: kobelb <[email protected]>
Date:   Thu Sep 6 12:07:39 2018 -0400

    Adding get security and spaces tests

commit 481943f
Author: kobelb <[email protected]>
Date:   Thu Sep 6 11:58:42 2018 -0400

    Generalizing bulk get

commit 14d9058
Merge: 6627127 fc5f7fa
Author: Brandon Kobel <[email protected]>
Date:   Thu Sep 6 10:46:07 2018 -0400

    Merge pull request #3 from legrego/remove-privs-api

    Remove privs api and hardcoded privs list

commit 6410f72
Author: Larry Gregory <[email protected]>
Date:   Thu Sep 6 09:35:30 2018 -0400

    add missing superagent type

commit 4afacc0
Author: Larry Gregory <[email protected]>
Date:   Wed Sep 5 20:19:15 2018 -0400

    initial round of spaces api testing

commit 6627127
Author: kobelb <[email protected]>
Date:   Wed Sep 5 17:29:37 2018 -0400

    Adding GET test suite

commit 68a5537
Author: kobelb <[email protected]>
Date:   Wed Sep 5 13:32:49 2018 -0400

    Copying find to security and spaces

commit fc5f7fa
Author: Larry Gregory <[email protected]>
Date:   Wed Sep 5 12:36:30 2018 -0400

    move es privilege tests to api_integration

commit 189fbe6
Author: kobelb <[email protected]>
Date:   Wed Sep 5 12:24:41 2018 -0400

    Switching approach to dynamically enabling security

commit c72200f
Author: Larry Gregory <[email protected]>
Date:   Wed Sep 5 11:57:26 2018 -0400

    remove get privileges api

commit 1607f80
Author: kobelb <[email protected]>
Date:   Wed Sep 5 11:47:19 2018 -0400

    Dynamically supplying users so we reduce some duplication

commit 9deec1b
Author: kobelb <[email protected]>
Date:   Wed Sep 5 09:32:36 2018 -0400

    Security and Spaces create tests

commit a8232dd
Author: kobelb <[email protected]>
Date:   Wed Sep 5 07:22:10 2018 -0400

    Using a create "test suite"

commit f07f668
Author: kobelb <[email protected]>
Date:   Wed Sep 5 05:54:46 2018 -0400

    Using the spaces esArchive always now

commit b2021ad
Merge: d3babea 7b4575b
Author: kobelb <[email protected]>
Date:   Wed Sep 5 05:43:48 2018 -0400

    Merge branch 'spaces/securing' into spaces/securing-api-tests

commit d3babea
Author: kobelb <[email protected]>
Date:   Tue Sep 4 17:43:38 2018 -0400

    Moving over the spaces only saved objects tests

commit 94054a2
Author: kobelb <[email protected]>
Date:   Tue Sep 4 17:26:43 2018 -0400

    Copying over the security only saved object api tests
legrego pushed a commit that referenced this pull request Sep 12, 2018
* Splitting to a client and a wrapper, integation tests are passing
without spaces

* Adding the spaces wrapper back in the mix using a priority collection

* Restructuring the secure wrapper as we don't need to switch between
repositories

* Checking authorization at the current space

* Beginning to make the rbac api integration tests run against spaces

* Adding identical data to the rbac esArchives for two more spaces

* Adding some space tests for find

* Beginning to work on the spaces client

* Fixing find and filtering out unrequested privileges from response

* Adding get code and test

* Introducing an RBAC Auth Scope

* Exposing the spacesClient a bit better

* Moving the server.expose to the security plugin init

* Moving checkPrivilegesAtAllResources to it's own thing

* No longer using the auth scope for RBAC, dashboard mode didn't work with
it

* Securing the create space method

* Adding secure update method

* Adding secured delete endpoints

* Restructuring some code in the spaces client

* Adding tests for the select endpoint

* Spaces can't be managed via the SavedObjectsClient now

* Creating separate space_all and space_read privileges

* Splitting out the spaces and global privileges

* Fixing edit role screen after API changes

* Revising comment, there is a Set in JavaScript now, but lodash can't
equal them

* Using authorization mode to log deprecation warning on login

* Changing the signature of checkPrivileges

We're now using the legacy fallback when there are no application
privileges. This improves performance at the sake of legacy 403s being
displayed to users who have no application privileges.

* Refactoring the way we specify resources when checking privileges

* Exposing the space service more intuitively

* Fixing comments

* Security defines all actions

* Renaming `response` returned by the checkPrivileges function

* Hard-coding the kibana app privileges teporarily

* Adding Authenticator authorization mode tests

* Adding actions.manageSpaces tests

* Adding check privileges tests

* Fixing checkPrivileges test snapshots

* Making sure tests fail until I correct this deficiency

* Adding stubbed out authorization mode tests

* Fixing tests for RegisterPrivilegesWithCluster

* Fixing service AuthorizationService tests

* Addinng serializer tests

* Adding validateEsResponse tests

* We don't need the SecureSavedObjectsClient anymore!

* Adding SecureSavedObjectsClientWrapper tests...

* Fixing a few stray tests

* Fixing issue when user isn't authenticated and check useRbacForRequest

* Validating spaces we're adding to roles

* Reusing hasAnyPrivileges from hasAnyResourcePrivileges

* Better variable name

* toArray -> toPrioritizedArray

* Using Space throughout the SpacesClient

* GetActiveSpace uses the SpacesClient now

* Squashed commit of the following:

commit 23515b1
Author: kobelb <[email protected]>
Date:   Mon Sep 10 06:57:58 2018 -0400

    Adding more users to the spaces tests

commit 4bbde73
Author: kobelb <[email protected]>
Date:   Mon Sep 10 06:09:35 2018 -0400

    Adding not space aware get tests

commit 5d11bef
Author: kobelb <[email protected]>
Date:   Sat Sep 8 14:06:20 2018 -0400

    Adding not space aware test to find

commit f9383fd
Author: kobelb <[email protected]>
Date:   Sat Sep 8 13:49:04 2018 -0400

    Adding bulk create tests and testing non space aware type with bulkGet

commit 5388b5a
Author: kobelb <[email protected]>
Date:   Fri Sep 7 16:18:04 2018 -0400

    Adding bulk create test

commit 0674263
Author: kobelb <[email protected]>
Date:   Fri Sep 7 15:58:21 2018 -0400

    Ignoring some modules

commit 6b011d3
Author: kobelb <[email protected]>
Date:   Fri Sep 7 15:55:58 2018 -0400

    Making the users match for saved objects security and spaces

commit de2f994
Author: kobelb <[email protected]>
Date:   Fri Sep 7 14:18:53 2018 -0400

    Making the space suites define their own test expectations

commit 5407866
Author: kobelb <[email protected]>
Date:   Fri Sep 7 13:15:46 2018 -0400

    Removing redundant spaces folder

commit 9913923
Author: kobelb <[email protected]>
Date:   Fri Sep 7 13:14:45 2018 -0400

    Removing unneeded objects from the esarchive

commit bc602b1
Author: kobelb <[email protected]>
Date:   Fri Sep 7 13:08:12 2018 -0400

    Moving some tests around

commit 7fec308
Author: kobelb <[email protected]>
Date:   Fri Sep 7 12:38:23 2018 -0400

    Deleting rbac_api_integration tests, they've been migrated elsewhere

commit 29c018e
Author: kobelb <[email protected]>
Date:   Fri Sep 7 10:01:16 2018 -0400

    Importing SuperTest where needed

commit 38d2e74
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:44:53 2018 -0400

    Removing the "saved_objects" folder

commit 70eada4
Merge: 1b2708f 9023431
Author: Brandon Kobel <[email protected]>
Date:   Fri Sep 7 10:04:03 2018 -0400

    Merge pull request #4 from legrego/spaces-api-tests

    Initial round of spaces api testing

commit 9023431
Merge: 6410f72 1b2708f
Author: Larry Gregory <[email protected]>
Date:   Fri Sep 7 09:37:57 2018 -0400

    Merge remote-tracking branch 'kobelb/spaces/securing-api-tests' into spaces-api-tests

commit 1b2708f
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:17:25 2018 -0400

    Even more typescript

commit 369a429
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:08:28 2018 -0400

    Typescriptifying Get

commit f53f2ab
Author: kobelb <[email protected]>
Date:   Fri Sep 7 08:01:48 2018 -0400

    Typescriptifying Find

commit f707e03
Author: kobelb <[email protected]>
Date:   Fri Sep 7 07:55:10 2018 -0400

    Typescriptifying Create

commit 485d983
Author: kobelb <[email protected]>
Date:   Fri Sep 7 07:31:54 2018 -0400

    Changing the namespace agnostic type name

commit 71c2122
Author: kobelb <[email protected]>
Date:   Fri Sep 7 07:25:15 2018 -0400

    Adding update tests

commit f60e953
Author: kobelb <[email protected]>
Date:   Thu Sep 6 15:53:34 2018 -0400

    Delete tests

commit 94682e5
Author: kobelb <[email protected]>
Date:   Thu Sep 6 12:07:39 2018 -0400

    Adding get security and spaces tests

commit 481943f
Author: kobelb <[email protected]>
Date:   Thu Sep 6 11:58:42 2018 -0400

    Generalizing bulk get

commit 14d9058
Merge: 6627127 fc5f7fa
Author: Brandon Kobel <[email protected]>
Date:   Thu Sep 6 10:46:07 2018 -0400

    Merge pull request #3 from legrego/remove-privs-api

    Remove privs api and hardcoded privs list

commit 6410f72
Author: Larry Gregory <[email protected]>
Date:   Thu Sep 6 09:35:30 2018 -0400

    add missing superagent type

commit 4afacc0
Author: Larry Gregory <[email protected]>
Date:   Wed Sep 5 20:19:15 2018 -0400

    initial round of spaces api testing

commit 6627127
Author: kobelb <[email protected]>
Date:   Wed Sep 5 17:29:37 2018 -0400

    Adding GET test suite

commit 68a5537
Author: kobelb <[email protected]>
Date:   Wed Sep 5 13:32:49 2018 -0400

    Copying find to security and spaces

commit fc5f7fa
Author: Larry Gregory <[email protected]>
Date:   Wed Sep 5 12:36:30 2018 -0400

    move es privilege tests to api_integration

commit 189fbe6
Author: kobelb <[email protected]>
Date:   Wed Sep 5 12:24:41 2018 -0400

    Switching approach to dynamically enabling security

commit c72200f
Author: Larry Gregory <[email protected]>
Date:   Wed Sep 5 11:57:26 2018 -0400

    remove get privileges api

commit 1607f80
Author: kobelb <[email protected]>
Date:   Wed Sep 5 11:47:19 2018 -0400

    Dynamically supplying users so we reduce some duplication

commit 9deec1b
Author: kobelb <[email protected]>
Date:   Wed Sep 5 09:32:36 2018 -0400

    Security and Spaces create tests

commit a8232dd
Author: kobelb <[email protected]>
Date:   Wed Sep 5 07:22:10 2018 -0400

    Using a create "test suite"

commit f07f668
Author: kobelb <[email protected]>
Date:   Wed Sep 5 05:54:46 2018 -0400

    Using the spaces esArchive always now

commit b2021ad
Merge: d3babea 7b4575b
Author: kobelb <[email protected]>
Date:   Wed Sep 5 05:43:48 2018 -0400

    Merge branch 'spaces/securing' into spaces/securing-api-tests

commit d3babea
Author: kobelb <[email protected]>
Date:   Tue Sep 4 17:43:38 2018 -0400

    Moving over the spaces only saved objects tests

commit 94054a2
Author: kobelb <[email protected]>
Date:   Tue Sep 4 17:26:43 2018 -0400

    Copying over the security only saved object api tests

* update public api to use SpacesClient

* fix

* test and api fixes

* fix tests

* Disallowing use of Spaces with the SpacesSavedObjectsClientWrapper

* Adding spaces audit logging

* Updating snapshots

* Adding get and getAll tests for the spaces client

* Adding update tests

* Adding create tests

* Adding SpacesClient delete tests

* Fixing authenticate tests

* Making tests more consistent

* Fixing kibana privileges tests

* Fixing a few type issues

* Making typescript ignore the .only test suites

* Switching to beforeEach and afterEach and removing the mocha types

* Switching to our own expect.js definitions

The definitions in @types/expect have expect being globally defined
which conflicts with the jest definitions, and expect isn't globally
defined in the mocha tests and we must use the module value

* Fixing more linting rules

* Removing test stubs and replacing with TODOs. Updating snapshots

* No longer shadowing application for the put role API

* Relying on the errors thrown by the SpacedClient when determining active
space

* Back to after/before... mocha doesn't have beforeAll/afterAll

* We got them types, thanks Spencer!!!

* Ignoring space type from the secure saved objects client find with no
type
legrego pushed a commit that referenced this pull request Nov 8, 2018
legrego pushed a commit that referenced this pull request Nov 26, 2018
* First version of new visualization selection

* Extract some components

* Remove visualization category

* Remove old wizard code

* Fix i18n ids

* Fix tests

* Fix tag cloud tests

* Fix broken test method

* Fix wrong method call

* Fix TSVB navigation in tests

* Restructure components

* Fix for lab removal

* Add tests

* Timroes/eui vis type selection (#4)

* Added background graphic from welcome screen to modal

* Fixed up responsiveness

* Change wording

* Fix test snapshot

* Create VisTypeIcon

* Implement suggestions

* Change experimental wording

* Use regular quotes for i18n engine
legrego pushed a commit that referenced this pull request Nov 26, 2018
* First version of new visualization selection

* Extract some components

* Remove visualization category

* Remove old wizard code

* Fix i18n ids

* Fix tests

* Fix tag cloud tests

* Fix broken test method

* Fix wrong method call

* Fix TSVB navigation in tests

* Restructure components

* Fix for lab removal

* Add tests

* Timroes/eui vis type selection (#4)

* Added background graphic from welcome screen to modal

* Fixed up responsiveness

* Change wording

* Fix test snapshot

* Create VisTypeIcon

* Implement suggestions

* Change experimental wording

* Use regular quotes for i18n engine
legrego added a commit that referenced this pull request Jul 2, 2019
…tic#40057)

* default disabledFeatures to empty array

* update PUT spaces tests
legrego added a commit that referenced this pull request Jul 2, 2019
…tic#40058)

* default disabledFeatures to empty array

* update PUT spaces tests
legrego pushed a commit that referenced this pull request Oct 2, 2019
…tic#46913)

* I/O metrics POC

* Gather correct metric for total

* Remove io stats from advanced

* Move io stats to node overview page

* Add new io metrics

* Add new io metrics

* Add note about supported platforms

* Update snapshot

* Add warning about platforms to all metrics

* Another snapshot update

* Update type and units

* Remove errant trailing comma

* Snapshot update for new types

* Add node_io integration testing
legrego pushed a commit that referenced this pull request Oct 15, 2019
…tic#47631)

* refactor failed_tests_reporter to use TS, no octokit

* update renovate config

* ensure that all kbn-test files are in ts project

* fix some type errors

* add some more tests

* [kbn-test/githubapi] cleanup and document

* collect log messages as strings instead of message objects

* ensure issue is open when updating body

* improve readability of getKibanaIssues

* expose axios helpers from dev-utils

* fix request params for fetching github issues and validate locally

* include a README for failed_tests_reporter

* improve axios error helpers

# Conflicts:
#	packages/kbn-test/src/index.ts
#	renovate.json5
legrego pushed a commit that referenced this pull request Oct 16, 2019
…tic#48309)

Backports the following commits to 7.x:
 - [Logs UI] Add ML job status callouts to results page (elastic#47642)
legrego pushed a commit that referenced this pull request Oct 30, 2019
…tic#47632)

* refactor failed_tests_reporter to use TS, no octokit (elastic#46993)

* refactor failed_tests_reporter to use TS, no octokit

* update renovate config

* ensure that all kbn-test files are in ts project

* fix some type errors

* add some more tests

* [kbn-test/githubapi] cleanup and document

* collect log messages as strings instead of message objects

* ensure issue is open when updating body

* improve readability of getKibanaIssues

* expose axios helpers from dev-utils

* fix request params for fetching github issues and validate locally

* include a README for failed_tests_reporter

* improve axios error helpers

# Conflicts:
#	package.json
#	packages/kbn-test/src/index.ts
#	packages/kbn-test/src/mocha/junit_report_generation.js
#	renovate.json5
#	src/dev/jest/junit_reporter.js
#	yarn.lock

* ensure all of kbn-test is in ts project
legrego pushed a commit that referenced this pull request Oct 30, 2019
…tic#47634)

* refactor failed_tests_reporter to use TS, no octokit (elastic#46993)

* refactor failed_tests_reporter to use TS, no octokit

* update renovate config

* ensure that all kbn-test files are in ts project

* fix some type errors

* add some more tests

* [kbn-test/githubapi] cleanup and document

* collect log messages as strings instead of message objects

* ensure issue is open when updating body

* improve readability of getKibanaIssues

* expose axios helpers from dev-utils

* fix request params for fetching github issues and validate locally

* include a README for failed_tests_reporter

* improve axios error helpers

# Conflicts:
#	package.json
#	packages/kbn-dev-utils/src/axios/errors.ts
#	packages/kbn-dev-utils/src/index.ts
#	packages/kbn-dev-utils/src/kbn_client/kbn_client_requester.ts
#	packages/kbn-test/src/index.ts
#	packages/kbn-test/src/mocha/junit_report_generation.js
#	renovate.json5
#	src/dev/jest/junit_reporter.js
#	yarn.lock

* ensure all of kbn-test is in ts project

(cherry picked from commit 41134fe)

* backport dev-utils constants
legrego pushed a commit that referenced this pull request Jul 9, 2020
* Initial App Search in Kibana plugin work

- Initializes a new platform plugin that ships out of the box w/ x-pack
- Contains a very basic front-end that shows AS engines, error states, or a Setup Guide
- Contains a very basic server that remotely calls the AS internal engines API and returns results

* Update URL casing to match Kibana best practices

- URL casing appears to be snake_casing, but kibana.json casing appears to be camelCase

* Register App Search plugin in Home Feature Catalogue

* Add custom App Search in Kibana logo

- I haven't had much success in surfacing a SVG file via a server-side endpoint/URL, but then I realized EuiIcon supports passing in a ReactElement directly. Woo!

* Fix appSearch.host config setting to be optional

- instead of crashing folks on load

* Rename plugin to Enterprise Search

- per product decision, URL should be enterprise_search/app_search and Workplace Search should also eventually live here
- reorganize folder structure in anticipation for another workplace_search plugin/codebase living alongside app_search
- rename app.tsx/main.tsx to a standard top-level index.tsx (which will contain top-level routes/state)
- rename AS->ES files/vars where applicable
- TODO: React Router

* Set up React Router URL structure

* Convert showSetupGuide action/flag to a React Router link

- remove showSetupGuide flag
- add a new shared helper component for combining EuiButton/EuiLink with React Router behavior (https://github.com/elastic/eui/blob/master/wiki/react-router.md#react-router-51)

* Implement Kibana Chrome breadcrumbs

- create shared helper (WS will presumably also want this) for generating EUI breadcrumb objects with React Router links+click behavior
- create React component that calls chrome.setBreadcrumbs on page mount
- clean up type definitions - move app-wide props to IAppSearchProps and update most pages/views to simply import it instead of calling their own definitions

* Added server unit tests (#2)

* Added unit test for server

* PR Feedback

* Refactor top-level Kibana props to a global context state

- rather them passing them around verbosely as props, the components that need them should be able to call the useContext hook

+ Remove IAppSearchProps in favor of IKibanaContext

+ Also rename `appSearchUrl` to `enterpriseSearchUrl`, since this context will contained shared/Kibana-wide values/actions useful to both AS and WS

* Added unit tests for public (#4)

* application.test.ts

* Added Unit Test for EngineOverviewHeader

* Added Unit Test for generate_breadcrumbs

* Added Unit Test for set_breadcrumb.tsx

* Added a unit test for link_events

- Also changed link_events.tsx to link_events.ts since it's just TS, no
React
- Modified letBrowserHandleEvent so it will still return a false
boolean when target is blank

* Betterize these tests

Co-Authored-By: Constance <[email protected]>

Co-authored-by: Constance <[email protected]>

* Add UI telemetry tracking to AS in Kibana (#5)

* Set up Telemetry usageCollection, savedObjects, route, & shared helper

- The Kibana UsageCollection plugin handles collecting our telemetry UI data (views, clicks, errors, etc.) and pushing it to elastic's telemetry servers
- That data is stored in incremented in Kibana's savedObjects lib/plugin (as well as mapped)
- When an end-user hits a certain view or action, the shared helper will ping the app search telemetry route which increments the savedObject store

* Update client-side views/links to new shared telemetry helper

* Write tests for new telemetry files

* Implement remaining unit tests (#7)

* Write tests for React Router+EUI helper components

* Update generate_breadcrumbs test

- add test suite for generateBreadcrumb() itself (in order to cover a missing branch)
- minor lint fixes
- remove unnecessary import from set_breadcrumbs test

* Write test for get_username util

+ update test to return a more consistent falsey value (null)

* Add test for SetupGuide

* [Refactor] Pull out various Kibana context mocks into separate files

- I'm creating a reusable useContext mock for shallow()ed enzyme components
+ add more documentation comments + examples

* Write tests for empty state components

+ test new usecontext shallow mock

* Empty state components: Add extra getUserName branch test

* Write test for app search index/routes

* Write tests for engine overview table

+ fix bonus bug

* Write Engine Overview tests

+ Update EngineOverview logic to account for issues found during tests :)
  - Move http to async/await syntax instead of promise syntax (works better with existing HttpServiceMock jest.fn()s)
  - hasValidData wasn't strict enough in type checking/object nest checking and was causing the app itself to crash (no bueno)

* Refactor EngineOverviewHeader test to use shallow + to full coverage

- missed adding this test during telemetry work
- switching to shallow and beforeAll reduces the test time from 5s to 4s!

* [Refactor] Pull out React Router history mocks into a test util helper

+ minor refactors/updates

* Add small tests to increase branch coverage

- mostly testing fallbacks or removing fallbacks in favor of strict type interface
- these are slightly obsessive so I'd also be fine ditching them if they aren't terribly valuable

* Address larger tech debt/TODOs (#8)

* Fix optional chaining TODO

- turns out my local Prettier wasn't up to date, completely my bad

* Fix constants TODO

- adds a common folder/architecture for others to use in the future

* Remove TODO for eslint-disable-line and specify lint rule being skipped

- hopefully that's OK for review, I can't think of any other way to sanely do this without re-architecting the entire file or DDoSing our API

* Add server-side logging to route dependencies

+ add basic example of error catching/logging to Telemetry route
+ [extra] refactor mockResponseFactory name to something slightly easier to read

* Move more Engines Overview API logic/logging to server-side

- handle data validation in the server-side
- wrap server-side API in a try/catch to account for fetch issues
- more correctly return 2xx/4xx statuses and more correctly deal with those responses in the front-end
- Add server info/error/debug logs (addresses TODO)
- Update tests + minor refactors/cleanup
    - remove expectResponseToBe200With helper (since we're now returning multiple response types) and instead make mockResponse var name more readable
    - one-line header auth
    - update tests with example error logs
    - update schema validation for `type` to be an enum of `indexed`/`meta` (more accurately reflecting API)

* Per telemetry team feedback, rename usageCollection telemetry mapping name to simpler 'app_search'

- since their mapping already nests under 'kibana.plugins'
- note: I left the savedObjects name with the '_telemetry' suffix, as there very well may be a use case for top-level generic 'app_search' saved objects

* Update Setup Guide installation instructions (#9)

Co-authored-by: Chris Cressman <[email protected]>

* [Refactor] DRY out route test helper

* [Refactor] Rename public/test_utils to public/__mocks__

- to better follow/use jest setups and for .mock.ts suffixes

* Add platinum licensing check to Meta Engines table/call (#11)

* Licensing plugin setup

* Add LicensingContext setup

* Update EngineOverview to not hit meta engines API on platinum license

* Add Jest test helpers for future shallow/context use

* Update plugin to use new Kibana nav + URL update (#12)

* Update new nav categories to add Enterprise Search + update plugin to use new category

- per @johnbarrierwilson and Matt Riley, Enterprise Search should be under Kibana and above Observability
- Run `node scripts/check_published_api_changes.js --accept` since this new category affects public API

* [URL UPDATE] Change '/app/enterprise_search/app_search' to '/app/app_search'

- This needs to be done because App Search and Workplace search *have* to be registered as separate plugins to have 2 distinct nav links
- Currently Kibana doesn't support nested app names (see: elastic#59190) but potentially will in the future

- To support this change, we need to update applications/index.tsx to NOT handle '/app/enterprise_search' level routing, but instead accept an async imported app component (e.g. AppSearch, WorkplaceSearch).
- AppSearch should now treat its router as root '/' instead of '/app_search'

- (Addl) Per Josh Dover's recommendation, switch to `<Router history={params.history}>` from `<BrowserRouter basename={params.appBasePath}>` since they're deprecating appBasePath

* Update breadcrumbs helper to account for new URLs

- Remove path for Enterprise Search breadcrumb, since '/app/enterprise_search' will not link anywhere meaningful for the foreseeable future, so the Enterprise Search root should not go anywhere
- Update App Search helper to go to root path, per new React Router setup

Test changes:
- Mock custom basepath for App Search tests
- Swap enterpriseSearchBreadcrumbs and appSearchBreadcrumbs test order (since the latter overrides the default mock)

* Add create_first_engine_button telemetry tracking to EmptyState

* Switch plugin URLs back to /app/enterprise_search/app_search

Now that elastic#66455 has been merged in 🎉

* Add i18n formatted messages / translations (#13)

* Add i18n provider and formatted/i18n translated messages

* Update tests to account for new I18nProvider context + FormattedMessage components

- Add new mountWithContext helper that provides all contexts+providers used in top-level app
- Add new shallowWithIntl helper for shallow() components that dive into FormattedMessage

* Format i18n dates and numbers

+ update some mock tests to not throw react-intl invalid date messages

* Update EngineOverviewHeader to disable button on prop

* Address review feedback (#14)

* Fix Prettier linting issues

* Escape App Search API endpoint URLs

- per PR feedback
- querystring should automatically encodeURIComponent / escape query param strings

* Update server plugin.ts to use getStartServices() rather than storing local references from start()

- Per feedback: https://github.com/elastic/kibana/blob/master/src/core/CONVENTIONS.md#applications

- Note: savedObjects.registerType needs to be outside of getStartServices, or an error is thrown

- Side update to registerTelemetryUsageCollector to simplify args

- Update/fix tests to account for changes

* E2E testing (#6)

* Wired up basics for E2E testing

* Added version with App Search

* Updated naming

* Switched configuration around

* Added concept of 'fixtures'

* Figured out how to log in as the enterprise_search user

* Refactored to use an App Search service

* Added some real tests

* Added a README

* Cleanup

* More cleanup

* Error handling + README updatre

* Removed unnecessary files

* Apply suggestions from code review

Co-authored-by: Constance <[email protected]>

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_table.tsx

Co-authored-by: Constance <[email protected]>

* PR feedback - updated README

* Additional lint fixes

Co-authored-by: Constance <[email protected]>

* Add README and CODEOWNERS (#15)

* Add plugin README and CODEOWNERS

* Fix Typescript errors (#16)

* Fix public mocks

* Fix empty states types

* Fix engine table component errors

* Fix engine overview component errors

* Fix setup guide component errors

- SetBreadcrumbs will be fixed in a separate commit

* Fix App Search index errors

* Fix engine overview header component errors

* Fix applications context index errors

* Fix kibana breadcrumb helper errors

* Fix license helper errors

* ❗ Refactor React Router EUI link/button helpers
- in order to fix typescript errors

- this changes the component logic significantly to a react render prop, so that the Link and Button components can have different types - however, end behavior should still remain the same

* Fix telemetry helper errors

* Minor unused var cleanup in plugin files

* Fix telemetry collector/savedobjects errors

* Fix MockRouter type errors and add IRouteDependencies export

- routes will use IRouteDependencies in the next few commits

* Fix engines route errors

* Fix telemetry route errors

* Remove any type from source code

- thanks to Scotty for the inspiration

* Add eslint rules for Enterprise Search plugin

- Add checks for type any, but only on non-test files
- Disable react-hooks/exhaustive-deps, since we're already disabling it in a few files and other plugins also have it turned off

* Cover uncovered lines in engines_table and telemetry tests

* Fixed TS warnings in E2E tests (#17)

* Feedback: Convert static CSS values to EUI variables where possible

* Feedback: Flatten nested CSS where possible

- Prefer setting CSS class overrides on individual EUI components, not on a top-level page

+ Change CSS class casing from kebab-case to camelCase to better match EUI/Kibana

+ Remove unnecessary .euiPageContentHeader margin-bottom override by changing the panelPaddingSize of euiPageContent

+ Decrease engine overview table padding on mobile

* Refactor out components shared with Workplace Search (#18)

* Move getUserName helper to shared

- in preparation for Workplace Search plugin also using this helper

* Move Setup Guide layout to a shared component

* Setup Guide: add extra props for standard/native auth links

Note: It's possible this commit may be unnecessary if we can publish shared Enterprise Search security mode docs

* Update copy per feedback from copy team

* Address various telemetry issues

- saved objects: removing indexing per elastic#43673
- add schema and generate json per elastic#64942
- move definitions over to collectors since saved objects is mostly empty at this point, and schema throws an error when it imports an obj instead of being defined inline
- istanbul ignore saved_objects file since it doesn't have anything meaningful to test but was affecting code coverage

* Disable plugin access if a normal user does not have access to App Search (#19)

* Set up new server security dependency and configs

* Set up access capabilities

* Set up checkAccess helper/caller

* Remove NoUserState component from the public UI

- Since this is now being handled by checkAccess / normal users should never see the plugin at all if they don't have an account/access, the component is no longer needed

* Update server routes to account for new changes

- Remove login redirect catch from routes, since the access helper should now handle that for most users by disabling the plugin (superusers will see a generic cannot connect/error screen)
- Refactor out new config values to a shared mock

* Refactor Enterprise Search http call to hit/return new internal API endpoint

+ pull out the http call to a separate library for upcoming public URL work (so that other files can call it directly as well)

* [Discussion] Increase timeout but add another warning timeout for slow servers

- per recommendation/convo with Brandon

* Register feature control

* Remove no_as_account from UI telemetry

- since we're no longer tracking that in the UI

* Address PR feedback - isSuperUser check

* Public URL support for Elastic Cloud (#21)

* Add server-side public URL route

- Per feedback from Kibana platform team, it's not possible to pass info from server/ to public/ without a HTTP call :[

* Update MockRouter for routes without any payload/params

* Add client-side helper for calling the new public URL API

+ API seems to return a URL a trailing slash, which we need to omit

* Update public/plugin.ts to check and set a public URL

- relies on this.hasCheckedPublicUrl to only make the call once per page load instead of on every page nav

* Fix failing feature control tests

- Split up scenario cases as needed
- Add plugin as an exception alongside ML & Monitoring

* Address PR feedback

- version: kibana
- copy edits
- Sass vars
- code cleanup

* Casing feedback: change all plugin registration IDs from snake_case to camelCase

- note: current remainng snake_case exceptions are telemetry keys
- file names and api endpoints are snake_case per conventions

* Misc security feedback

- remove set
- remove unnecessary capabilities registration
- telemetry namespace agnostic

* Security feedback: add warn logging to telemetry collector

see elastic#66922 (comment)
- add if statement
- pass log dependency around (this is kinda medium, should maybe refactor)
- update tests
- move test file comment to the right file (was meant for telemetry route file)

* Address feedback from Pierre

- Remove unnecessary ServerConfigType
- Remove unnecessary uiCapabilities
- Move registerTelemetryRoute / SavedObjectsServiceStart workaround
- Remove unnecessary license optional chaining

* PR feedback

Address type/typos

* Fix telemetry API call returning 415 on Chrome

- I can't even?? I swear charset=utf-8 fixed the same error a few weeks ago

* Fix failing tests

* Update Enterprise Search functional tests (without host) to run on CI

- Fix incorrect navigateToApp slug (hadn't realized this was a URL, not an ID)
- Update without_host_configured tests to run without API key
- Update README

* Address PR feedback from Pierre

- remove unnecessary authz?
- remove unnecessary content-type json headers
- add loggingSystemMock.collect(mockLogger).error assertion
- reconstrcut new MockRouter on beforeEach for better sandboxing
- fix incorrect describe()s -should be it()
- pull out reusable mockDependencies helper (renamed/extended from mockConfig) for tests that don't particularly use config/log but still want to pass type definitions
- Fix comment copy

Co-authored-by: Jason Stoltzfus <[email protected]>
Co-authored-by: Chris Cressman <[email protected]>
Co-authored-by: scottybollinger <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
legrego pushed a commit that referenced this pull request Jul 14, 2020
* Initial App Search in Kibana plugin work

- Initializes a new platform plugin that ships out of the box w/ x-pack
- Contains a very basic front-end that shows AS engines, error states, or a Setup Guide
- Contains a very basic server that remotely calls the AS internal engines API and returns results

* Update URL casing to match Kibana best practices

- URL casing appears to be snake_casing, but kibana.json casing appears to be camelCase

* Register App Search plugin in Home Feature Catalogue

* Add custom App Search in Kibana logo

- I haven't had much success in surfacing a SVG file via a server-side endpoint/URL, but then I realized EuiIcon supports passing in a ReactElement directly. Woo!

* Fix appSearch.host config setting to be optional

- instead of crashing folks on load

* Rename plugin to Enterprise Search

- per product decision, URL should be enterprise_search/app_search and Workplace Search should also eventually live here
- reorganize folder structure in anticipation for another workplace_search plugin/codebase living alongside app_search
- rename app.tsx/main.tsx to a standard top-level index.tsx (which will contain top-level routes/state)
- rename AS->ES files/vars where applicable
- TODO: React Router

* Set up React Router URL structure

* Convert showSetupGuide action/flag to a React Router link

- remove showSetupGuide flag
- add a new shared helper component for combining EuiButton/EuiLink with React Router behavior (https://github.com/elastic/eui/blob/master/wiki/react-router.md#react-router-51)

* Implement Kibana Chrome breadcrumbs

- create shared helper (WS will presumably also want this) for generating EUI breadcrumb objects with React Router links+click behavior
- create React component that calls chrome.setBreadcrumbs on page mount
- clean up type definitions - move app-wide props to IAppSearchProps and update most pages/views to simply import it instead of calling their own definitions

* Added server unit tests (#2)

* Added unit test for server

* PR Feedback

* Refactor top-level Kibana props to a global context state

- rather them passing them around verbosely as props, the components that need them should be able to call the useContext hook

+ Remove IAppSearchProps in favor of IKibanaContext

+ Also rename `appSearchUrl` to `enterpriseSearchUrl`, since this context will contained shared/Kibana-wide values/actions useful to both AS and WS

* Added unit tests for public (#4)

* application.test.ts

* Added Unit Test for EngineOverviewHeader

* Added Unit Test for generate_breadcrumbs

* Added Unit Test for set_breadcrumb.tsx

* Added a unit test for link_events

- Also changed link_events.tsx to link_events.ts since it's just TS, no
React
- Modified letBrowserHandleEvent so it will still return a false
boolean when target is blank

* Betterize these tests

Co-Authored-By: Constance <[email protected]>

Co-authored-by: Constance <[email protected]>

* Add UI telemetry tracking to AS in Kibana (#5)

* Set up Telemetry usageCollection, savedObjects, route, & shared helper

- The Kibana UsageCollection plugin handles collecting our telemetry UI data (views, clicks, errors, etc.) and pushing it to elastic's telemetry servers
- That data is stored in incremented in Kibana's savedObjects lib/plugin (as well as mapped)
- When an end-user hits a certain view or action, the shared helper will ping the app search telemetry route which increments the savedObject store

* Update client-side views/links to new shared telemetry helper

* Write tests for new telemetry files

* Implement remaining unit tests (#7)

* Write tests for React Router+EUI helper components

* Update generate_breadcrumbs test

- add test suite for generateBreadcrumb() itself (in order to cover a missing branch)
- minor lint fixes
- remove unnecessary import from set_breadcrumbs test

* Write test for get_username util

+ update test to return a more consistent falsey value (null)

* Add test for SetupGuide

* [Refactor] Pull out various Kibana context mocks into separate files

- I'm creating a reusable useContext mock for shallow()ed enzyme components
+ add more documentation comments + examples

* Write tests for empty state components

+ test new usecontext shallow mock

* Empty state components: Add extra getUserName branch test

* Write test for app search index/routes

* Write tests for engine overview table

+ fix bonus bug

* Write Engine Overview tests

+ Update EngineOverview logic to account for issues found during tests :)
  - Move http to async/await syntax instead of promise syntax (works better with existing HttpServiceMock jest.fn()s)
  - hasValidData wasn't strict enough in type checking/object nest checking and was causing the app itself to crash (no bueno)

* Refactor EngineOverviewHeader test to use shallow + to full coverage

- missed adding this test during telemetry work
- switching to shallow and beforeAll reduces the test time from 5s to 4s!

* [Refactor] Pull out React Router history mocks into a test util helper

+ minor refactors/updates

* Add small tests to increase branch coverage

- mostly testing fallbacks or removing fallbacks in favor of strict type interface
- these are slightly obsessive so I'd also be fine ditching them if they aren't terribly valuable

* Address larger tech debt/TODOs (#8)

* Fix optional chaining TODO

- turns out my local Prettier wasn't up to date, completely my bad

* Fix constants TODO

- adds a common folder/architecture for others to use in the future

* Remove TODO for eslint-disable-line and specify lint rule being skipped

- hopefully that's OK for review, I can't think of any other way to sanely do this without re-architecting the entire file or DDoSing our API

* Add server-side logging to route dependencies

+ add basic example of error catching/logging to Telemetry route
+ [extra] refactor mockResponseFactory name to something slightly easier to read

* Move more Engines Overview API logic/logging to server-side

- handle data validation in the server-side
- wrap server-side API in a try/catch to account for fetch issues
- more correctly return 2xx/4xx statuses and more correctly deal with those responses in the front-end
- Add server info/error/debug logs (addresses TODO)
- Update tests + minor refactors/cleanup
    - remove expectResponseToBe200With helper (since we're now returning multiple response types) and instead make mockResponse var name more readable
    - one-line header auth
    - update tests with example error logs
    - update schema validation for `type` to be an enum of `indexed`/`meta` (more accurately reflecting API)

* Per telemetry team feedback, rename usageCollection telemetry mapping name to simpler 'app_search'

- since their mapping already nests under 'kibana.plugins'
- note: I left the savedObjects name with the '_telemetry' suffix, as there very well may be a use case for top-level generic 'app_search' saved objects

* Update Setup Guide installation instructions (#9)

Co-authored-by: Chris Cressman <[email protected]>

* [Refactor] DRY out route test helper

* [Refactor] Rename public/test_utils to public/__mocks__

- to better follow/use jest setups and for .mock.ts suffixes

* Add platinum licensing check to Meta Engines table/call (#11)

* Licensing plugin setup

* Add LicensingContext setup

* Update EngineOverview to not hit meta engines API on platinum license

* Add Jest test helpers for future shallow/context use

* Update plugin to use new Kibana nav + URL update (#12)

* Update new nav categories to add Enterprise Search + update plugin to use new category

- per @johnbarrierwilson and Matt Riley, Enterprise Search should be under Kibana and above Observability
- Run `node scripts/check_published_api_changes.js --accept` since this new category affects public API

* [URL UPDATE] Change '/app/enterprise_search/app_search' to '/app/app_search'

- This needs to be done because App Search and Workplace search *have* to be registered as separate plugins to have 2 distinct nav links
- Currently Kibana doesn't support nested app names (see: elastic#59190) but potentially will in the future

- To support this change, we need to update applications/index.tsx to NOT handle '/app/enterprise_search' level routing, but instead accept an async imported app component (e.g. AppSearch, WorkplaceSearch).
- AppSearch should now treat its router as root '/' instead of '/app_search'

- (Addl) Per Josh Dover's recommendation, switch to `<Router history={params.history}>` from `<BrowserRouter basename={params.appBasePath}>` since they're deprecating appBasePath

* Update breadcrumbs helper to account for new URLs

- Remove path for Enterprise Search breadcrumb, since '/app/enterprise_search' will not link anywhere meaningful for the foreseeable future, so the Enterprise Search root should not go anywhere
- Update App Search helper to go to root path, per new React Router setup

Test changes:
- Mock custom basepath for App Search tests
- Swap enterpriseSearchBreadcrumbs and appSearchBreadcrumbs test order (since the latter overrides the default mock)

* Add create_first_engine_button telemetry tracking to EmptyState

* Switch plugin URLs back to /app/enterprise_search/app_search

Now that elastic#66455 has been merged in 🎉

* Add i18n formatted messages / translations (#13)

* Add i18n provider and formatted/i18n translated messages

* Update tests to account for new I18nProvider context + FormattedMessage components

- Add new mountWithContext helper that provides all contexts+providers used in top-level app
- Add new shallowWithIntl helper for shallow() components that dive into FormattedMessage

* Format i18n dates and numbers

+ update some mock tests to not throw react-intl invalid date messages

* Update EngineOverviewHeader to disable button on prop

* Address review feedback (#14)

* Fix Prettier linting issues

* Escape App Search API endpoint URLs

- per PR feedback
- querystring should automatically encodeURIComponent / escape query param strings

* Update server plugin.ts to use getStartServices() rather than storing local references from start()

- Per feedback: https://github.com/elastic/kibana/blob/master/src/core/CONVENTIONS.md#applications

- Note: savedObjects.registerType needs to be outside of getStartServices, or an error is thrown

- Side update to registerTelemetryUsageCollector to simplify args

- Update/fix tests to account for changes

* E2E testing (#6)

* Wired up basics for E2E testing

* Added version with App Search

* Updated naming

* Switched configuration around

* Added concept of 'fixtures'

* Figured out how to log in as the enterprise_search user

* Refactored to use an App Search service

* Added some real tests

* Added a README

* Cleanup

* More cleanup

* Error handling + README updatre

* Removed unnecessary files

* Apply suggestions from code review

Co-authored-by: Constance <[email protected]>

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_table.tsx

Co-authored-by: Constance <[email protected]>

* PR feedback - updated README

* Additional lint fixes

Co-authored-by: Constance <[email protected]>

* Add README and CODEOWNERS (#15)

* Add plugin README and CODEOWNERS

* Fix Typescript errors (#16)

* Fix public mocks

* Fix empty states types

* Fix engine table component errors

* Fix engine overview component errors

* Fix setup guide component errors

- SetBreadcrumbs will be fixed in a separate commit

* Fix App Search index errors

* Fix engine overview header component errors

* Fix applications context index errors

* Fix kibana breadcrumb helper errors

* Fix license helper errors

* ❗ Refactor React Router EUI link/button helpers
- in order to fix typescript errors

- this changes the component logic significantly to a react render prop, so that the Link and Button components can have different types - however, end behavior should still remain the same

* Fix telemetry helper errors

* Minor unused var cleanup in plugin files

* Fix telemetry collector/savedobjects errors

* Fix MockRouter type errors and add IRouteDependencies export

- routes will use IRouteDependencies in the next few commits

* Fix engines route errors

* Fix telemetry route errors

* Remove any type from source code

- thanks to Scotty for the inspiration

* Add eslint rules for Enterprise Search plugin

- Add checks for type any, but only on non-test files
- Disable react-hooks/exhaustive-deps, since we're already disabling it in a few files and other plugins also have it turned off

* Cover uncovered lines in engines_table and telemetry tests

* Fixed TS warnings in E2E tests (#17)

* Feedback: Convert static CSS values to EUI variables where possible

* Feedback: Flatten nested CSS where possible

- Prefer setting CSS class overrides on individual EUI components, not on a top-level page

+ Change CSS class casing from kebab-case to camelCase to better match EUI/Kibana

+ Remove unnecessary .euiPageContentHeader margin-bottom override by changing the panelPaddingSize of euiPageContent

+ Decrease engine overview table padding on mobile

* Refactor out components shared with Workplace Search (#18)

* Move getUserName helper to shared

- in preparation for Workplace Search plugin also using this helper

* Move Setup Guide layout to a shared component

* Setup Guide: add extra props for standard/native auth links

Note: It's possible this commit may be unnecessary if we can publish shared Enterprise Search security mode docs

* Update copy per feedback from copy team

* Address various telemetry issues

- saved objects: removing indexing per elastic#43673
- add schema and generate json per elastic#64942
- move definitions over to collectors since saved objects is mostly empty at this point, and schema throws an error when it imports an obj instead of being defined inline
- istanbul ignore saved_objects file since it doesn't have anything meaningful to test but was affecting code coverage

* Disable plugin access if a normal user does not have access to App Search (#19)

* Set up new server security dependency and configs

* Set up access capabilities

* Set up checkAccess helper/caller

* Remove NoUserState component from the public UI

- Since this is now being handled by checkAccess / normal users should never see the plugin at all if they don't have an account/access, the component is no longer needed

* Update server routes to account for new changes

- Remove login redirect catch from routes, since the access helper should now handle that for most users by disabling the plugin (superusers will see a generic cannot connect/error screen)
- Refactor out new config values to a shared mock

* Refactor Enterprise Search http call to hit/return new internal API endpoint

+ pull out the http call to a separate library for upcoming public URL work (so that other files can call it directly as well)

* [Discussion] Increase timeout but add another warning timeout for slow servers

- per recommendation/convo with Brandon

* Register feature control

* Remove no_as_account from UI telemetry

- since we're no longer tracking that in the UI

* Address PR feedback - isSuperUser check

* Public URL support for Elastic Cloud (#21)

* Add server-side public URL route

- Per feedback from Kibana platform team, it's not possible to pass info from server/ to public/ without a HTTP call :[

* Update MockRouter for routes without any payload/params

* Add client-side helper for calling the new public URL API

+ API seems to return a URL a trailing slash, which we need to omit

* Update public/plugin.ts to check and set a public URL

- relies on this.hasCheckedPublicUrl to only make the call once per page load instead of on every page nav

* Fix failing feature control tests

- Split up scenario cases as needed
- Add plugin as an exception alongside ML & Monitoring

* Address PR feedback

- version: kibana
- copy edits
- Sass vars
- code cleanup

* Casing feedback: change all plugin registration IDs from snake_case to camelCase

- note: current remainng snake_case exceptions are telemetry keys
- file names and api endpoints are snake_case per conventions

* Misc security feedback

- remove set
- remove unnecessary capabilities registration
- telemetry namespace agnostic

* Security feedback: add warn logging to telemetry collector

see elastic#66922 (comment)
- add if statement
- pass log dependency around (this is kinda medium, should maybe refactor)
- update tests
- move test file comment to the right file (was meant for telemetry route file)

* Address feedback from Pierre

- Remove unnecessary ServerConfigType
- Remove unnecessary uiCapabilities
- Move registerTelemetryRoute / SavedObjectsServiceStart workaround
- Remove unnecessary license optional chaining

* PR feedback

Address type/typos

* Fix telemetry API call returning 415 on Chrome

- I can't even?? I swear charset=utf-8 fixed the same error a few weeks ago

* Fix failing tests

* Update Enterprise Search functional tests (without host) to run on CI

- Fix incorrect navigateToApp slug (hadn't realized this was a URL, not an ID)
- Update without_host_configured tests to run without API key
- Update README

* Address PR feedback from Pierre

- remove unnecessary authz?
- remove unnecessary content-type json headers
- add loggingSystemMock.collect(mockLogger).error assertion
- reconstrcut new MockRouter on beforeEach for better sandboxing
- fix incorrect describe()s -should be it()
- pull out reusable mockDependencies helper (renamed/extended from mockConfig) for tests that don't particularly use config/log but still want to pass type definitions
- Fix comment copy

Co-authored-by: Jason Stoltzfus <[email protected]>
Co-authored-by: Chris Cressman <[email protected]>
Co-authored-by: scottybollinger <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
# Conflicts:
#	.github/CODEOWNERS
#	x-pack/scripts/functional_tests.js
legrego pushed a commit that referenced this pull request Jan 16, 2025
…re replacements (elastic#206660)

## Summary

Today, when a developer deprecates a feature and replaces its privileges
with those of another feature, we reasonably assume that the new feature
fully replaces the old one in all possible contexts - whether in role
management UIs or in the Spaces feature toggles visibility UI. However,
when deprecated privileges are replaced by the privileges of multiple
features, such as in [this
case](elastic#202863 (comment))
where the Discover/Dashboard/Maps feature privileges are replaced by the
privileges of Discover_v2/Dashboard_v2/Maps_v2, respectively, **and**
the privileges of the Saved Query Management feature, the choice is
ambiguous.

Which of these features should be treated as the replacement for the
deprecated feature in contexts that deal with entire features (like the
Spaces feature toggles visibility UI) rather than individual privileges
(like in role management UIs)? Should all referenced features be
considered replacements? Or just a subset - or even a single feature? If
so, which one? Currently, we treat all referenced features as
replacements for the deprecated feature, which creates problems, as
described in detail in [this
discussion](elastic#202863 (comment)).

This PR allows developers to customize this behavior by specifying which
features Kibana should treat as direct successors to deprecated features
in contexts that deal with whole features rather than individual
privileges:

```ts
deps.features.registerKibanaFeature({
  deprecated: {
    notice: 'The feature is deprecated because … well, there’s a reason.',
    --> replacedBy: ['feature_id_v2'], <--
  },
  id: 'feature_id'
  name: `Case #4 feature ${suffix} (DEPRECATED)`,
  …
});
```

## How to test

1. Run test server
```bash
node scripts/functional_tests_server.js --config x-pack/test/security_api_integration/features.config.ts
```

2. Execute the following request from the Dev Tools (`case_4_feature_a`
is a deprecated feature that is replaced by multiple features and
**doesn't use** `deprecated.replacedBy`)
```http
PUT kbn:/api/spaces/space/default?overwrite=true
{
  "id":"default",
  "name":"Default",
  "description":"This is your default space!",
  "color":"#00bfb3",
  "disabledFeatures":["case_4_feature_a"],
  "_reserved":true,
  "imageUrl":"",
  "initials":"D"
}
```

3. Observe that in response deprecated `case_4_feature_a` is replaced by
two features (you can also check
http://localhost:5620/app/management/kibana/spaces/edit/default to see
how it's reflected in UI)
```http
{
  "id": "default",
  "name": "Default",
  "description": "This is your default space!",
  "color": "#00bfb3",
  "initials": "D",
  "imageUrl": "",
  "disabledFeatures": [
    "case_4_feature_a_v2",
    "case_4_feature_c"
  ],
  "_reserved": true
}
```

4. Execute the following request from the Dev Tools (`case_4_feature_b`
is a deprecated feature that is replaced by multiple features, but
**uses** `deprecated.replacedBy` to set the conceptual
feature-successor)
```http
PUT kbn:/api/spaces/space/default?overwrite=true
{
  "id":"default",
  "name":"Default",
  "description":"This is your default space!",
  "color":"#00bfb3",
  "disabledFeatures":["case_4_feature_b"],
  "_reserved":true,
  "imageUrl":"",
  "initials":"D"
}
```

5. Observe that in response deprecated `case_4_feature_b` is replaced by
a single feature (you can also check
http://localhost:5620/app/management/kibana/spaces/edit/default to see
how it's reflected in UI)
```http
{
  "id": "default",
  "name": "Default",
  "description": "This is your default space!",
  "color": "#00bfb3",
  "initials": "D",
  "imageUrl": "",
  "disabledFeatures": [
    "case_4_feature_b_v2"
  ],
  "_reserved": true
}
```

__Required by:__
elastic#202863 (comment)

//cc @davismcphee
legrego pushed a commit that referenced this pull request Jan 29, 2025
…t explicit feature replacements (elastic#206660) (elastic#206925)

# Backport

This will backport the following commits from `main` to `8.x`:
- [feat(security): extend &#x60;Feature&#x60; definition to support
explicit feature replacements
(elastic#206660)](elastic#206660)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Aleh
Zasypkin","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-16T11:35:32Z","message":"feat(security):
extend `Feature` definition to support explicit feature replacements
(elastic#206660)\n\n## Summary\n\nToday, when a developer deprecates a feature
and replaces its privileges\nwith those of another feature, we
reasonably assume that the new feature\nfully replaces the old one in
all possible contexts - whether in role\nmanagement UIs or in the Spaces
feature toggles visibility UI. However,\nwhen deprecated privileges are
replaced by the privileges of multiple\nfeatures, such as in
[this\ncase](https://github.com/elastic/kibana/pull/202863#discussion_r1892672114)\nwhere
the Discover/Dashboard/Maps feature privileges are replaced by
the\nprivileges of Discover_v2/Dashboard_v2/Maps_v2, respectively,
**and**\nthe privileges of the Saved Query Management feature, the
choice is\nambiguous.\n\nWhich of these features should be treated as
the replacement for the\ndeprecated feature in contexts that deal with
entire features (like the\nSpaces feature toggles visibility UI) rather
than individual privileges\n(like in role management UIs)? Should all
referenced features be\nconsidered replacements? Or just a subset - or
even a single feature? If\nso, which one? Currently, we treat all
referenced features as\nreplacements for the deprecated feature, which
creates problems, as\ndescribed in detail in
[this\ndiscussion](https://github.com/elastic/kibana/pull/202863#discussion_r1892672114).\n\nThis
PR allows developers to customize this behavior by specifying
which\nfeatures Kibana should treat as direct successors to deprecated
features\nin contexts that deal with whole features rather than
individual\nprivileges:\n\n```ts\ndeps.features.registerKibanaFeature({\n
deprecated: {\n notice: 'The feature is deprecated because … well,
there’s a reason.',\n --> replacedBy: ['feature_id_v2'], <--\n },\n id:
'feature_id'\n name: `Case #4 feature ${suffix} (DEPRECATED)`,\n
…\n});\n```\n\n## How to test\n\n1. Run test server\n```bash\nnode
scripts/functional_tests_server.js --config
x-pack/test/security_api_integration/features.config.ts\n```\n\n2.
Execute the following request from the Dev Tools (`case_4_feature_a`\nis
a deprecated feature that is replaced by multiple features
and\n**doesn't use** `deprecated.replacedBy`)\n```http\nPUT
kbn:/api/spaces/space/default?overwrite=true\n{\n \"id\":\"default\",\n
\"name\":\"Default\",\n \"description\":\"This is your default
space!\",\n \"color\":\"#00bfb3\",\n
\"disabledFeatures\":[\"case_4_feature_a\"],\n \"_reserved\":true,\n
\"imageUrl\":\"\",\n \"initials\":\"D\"\n}\n```\n\n3. Observe that in
response deprecated `case_4_feature_a` is replaced by\ntwo features (you
can also
check\nhttp://localhost:5620/app/management/kibana/spaces/edit/default
to see\nhow it's reflected in UI)\n```http\n{\n \"id\": \"default\",\n
\"name\": \"Default\",\n \"description\": \"This is your default
space!\",\n \"color\": \"#00bfb3\",\n \"initials\": \"D\",\n
\"imageUrl\": \"\",\n \"disabledFeatures\": [\n
\"case_4_feature_a_v2\",\n \"case_4_feature_c\"\n ],\n \"_reserved\":
true\n}\n```\n\n4. Execute the following request from the Dev Tools
(`case_4_feature_b`\nis a deprecated feature that is replaced by
multiple features, but\n**uses** `deprecated.replacedBy` to set the
conceptual\nfeature-successor)\n```http\nPUT
kbn:/api/spaces/space/default?overwrite=true\n{\n \"id\":\"default\",\n
\"name\":\"Default\",\n \"description\":\"This is your default
space!\",\n \"color\":\"#00bfb3\",\n
\"disabledFeatures\":[\"case_4_feature_b\"],\n \"_reserved\":true,\n
\"imageUrl\":\"\",\n \"initials\":\"D\"\n}\n```\n\n5. Observe that in
response deprecated `case_4_feature_b` is replaced by\na single feature
(you can also
check\nhttp://localhost:5620/app/management/kibana/spaces/edit/default
to see\nhow it's reflected in UI)\n```http\n{\n \"id\": \"default\",\n
\"name\": \"Default\",\n \"description\": \"This is your default
space!\",\n \"color\": \"#00bfb3\",\n \"initials\": \"D\",\n
\"imageUrl\": \"\",\n \"disabledFeatures\": [\n
\"case_4_feature_b_v2\"\n ],\n \"_reserved\": true\n}\n```\n\n__Required
by:__\nhttps://github.com/elastic/pull/202863#discussion_r1892672114\n\n//cc
@davismcphee","sha":"dd3ce0e7f534279f48be8c125853c89aa92969e2","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Security/Spaces","release_note:skip","Feature:Security/Authorization","v9.0.0","backport:prev-minor"],"title":"feat(security):
extend `Feature` definition to support explicit feature
replacements","number":206660,"url":"https://github.com/elastic/kibana/pull/206660","mergeCommit":{"message":"feat(security):
extend `Feature` definition to support explicit feature replacements
(elastic#206660)\n\n## Summary\n\nToday, when a developer deprecates a feature
and replaces its privileges\nwith those of another feature, we
reasonably assume that the new feature\nfully replaces the old one in
all possible contexts - whether in role\nmanagement UIs or in the Spaces
feature toggles visibility UI. However,\nwhen deprecated privileges are
replaced by the privileges of multiple\nfeatures, such as in
[this\ncase](https://github.com/elastic/kibana/pull/202863#discussion_r1892672114)\nwhere
the Discover/Dashboard/Maps feature privileges are replaced by
the\nprivileges of Discover_v2/Dashboard_v2/Maps_v2, respectively,
**and**\nthe privileges of the Saved Query Management feature, the
choice is\nambiguous.\n\nWhich of these features should be treated as
the replacement for the\ndeprecated feature in contexts that deal with
entire features (like the\nSpaces feature toggles visibility UI) rather
than individual privileges\n(like in role management UIs)? Should all
referenced features be\nconsidered replacements? Or just a subset - or
even a single feature? If\nso, which one? Currently, we treat all
referenced features as\nreplacements for the deprecated feature, which
creates problems, as\ndescribed in detail in
[this\ndiscussion](https://github.com/elastic/kibana/pull/202863#discussion_r1892672114).\n\nThis
PR allows developers to customize this behavior by specifying
which\nfeatures Kibana should treat as direct successors to deprecated
features\nin contexts that deal with whole features rather than
individual\nprivileges:\n\n```ts\ndeps.features.registerKibanaFeature({\n
deprecated: {\n notice: 'The feature is deprecated because … well,
there’s a reason.',\n --> replacedBy: ['feature_id_v2'], <--\n },\n id:
'feature_id'\n name: `Case #4 feature ${suffix} (DEPRECATED)`,\n
…\n});\n```\n\n## How to test\n\n1. Run test server\n```bash\nnode
scripts/functional_tests_server.js --config
x-pack/test/security_api_integration/features.config.ts\n```\n\n2.
Execute the following request from the Dev Tools (`case_4_feature_a`\nis
a deprecated feature that is replaced by multiple features
and\n**doesn't use** `deprecated.replacedBy`)\n```http\nPUT
kbn:/api/spaces/space/default?overwrite=true\n{\n \"id\":\"default\",\n
\"name\":\"Default\",\n \"description\":\"This is your default
space!\",\n \"color\":\"#00bfb3\",\n
\"disabledFeatures\":[\"case_4_feature_a\"],\n \"_reserved\":true,\n
\"imageUrl\":\"\",\n \"initials\":\"D\"\n}\n```\n\n3. Observe that in
response deprecated `case_4_feature_a` is replaced by\ntwo features (you
can also
check\nhttp://localhost:5620/app/management/kibana/spaces/edit/default
to see\nhow it's reflected in UI)\n```http\n{\n \"id\": \"default\",\n
\"name\": \"Default\",\n \"description\": \"This is your default
space!\",\n \"color\": \"#00bfb3\",\n \"initials\": \"D\",\n
\"imageUrl\": \"\",\n \"disabledFeatures\": [\n
\"case_4_feature_a_v2\",\n \"case_4_feature_c\"\n ],\n \"_reserved\":
true\n}\n```\n\n4. Execute the following request from the Dev Tools
(`case_4_feature_b`\nis a deprecated feature that is replaced by
multiple features, but\n**uses** `deprecated.replacedBy` to set the
conceptual\nfeature-successor)\n```http\nPUT
kbn:/api/spaces/space/default?overwrite=true\n{\n \"id\":\"default\",\n
\"name\":\"Default\",\n \"description\":\"This is your default
space!\",\n \"color\":\"#00bfb3\",\n
\"disabledFeatures\":[\"case_4_feature_b\"],\n \"_reserved\":true,\n
\"imageUrl\":\"\",\n \"initials\":\"D\"\n}\n```\n\n5. Observe that in
response deprecated `case_4_feature_b` is replaced by\na single feature
(you can also
check\nhttp://localhost:5620/app/management/kibana/spaces/edit/default
to see\nhow it's reflected in UI)\n```http\n{\n \"id\": \"default\",\n
\"name\": \"Default\",\n \"description\": \"This is your default
space!\",\n \"color\": \"#00bfb3\",\n \"initials\": \"D\",\n
\"imageUrl\": \"\",\n \"disabledFeatures\": [\n
\"case_4_feature_b_v2\"\n ],\n \"_reserved\": true\n}\n```\n\n__Required
by:__\nhttps://github.com/elastic/pull/202863#discussion_r1892672114\n\n//cc
@davismcphee","sha":"dd3ce0e7f534279f48be8c125853c89aa92969e2"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206660","number":206660,"mergeCommit":{"message":"feat(security):
extend `Feature` definition to support explicit feature replacements
(elastic#206660)\n\n## Summary\n\nToday, when a developer deprecates a feature
and replaces its privileges\nwith those of another feature, we
reasonably assume that the new feature\nfully replaces the old one in
all possible contexts - whether in role\nmanagement UIs or in the Spaces
feature toggles visibility UI. However,\nwhen deprecated privileges are
replaced by the privileges of multiple\nfeatures, such as in
[this\ncase](https://github.com/elastic/kibana/pull/202863#discussion_r1892672114)\nwhere
the Discover/Dashboard/Maps feature privileges are replaced by
the\nprivileges of Discover_v2/Dashboard_v2/Maps_v2, respectively,
**and**\nthe privileges of the Saved Query Management feature, the
choice is\nambiguous.\n\nWhich of these features should be treated as
the replacement for the\ndeprecated feature in contexts that deal with
entire features (like the\nSpaces feature toggles visibility UI) rather
than individual privileges\n(like in role management UIs)? Should all
referenced features be\nconsidered replacements? Or just a subset - or
even a single feature? If\nso, which one? Currently, we treat all
referenced features as\nreplacements for the deprecated feature, which
creates problems, as\ndescribed in detail in
[this\ndiscussion](https://github.com/elastic/kibana/pull/202863#discussion_r1892672114).\n\nThis
PR allows developers to customize this behavior by specifying
which\nfeatures Kibana should treat as direct successors to deprecated
features\nin contexts that deal with whole features rather than
individual\nprivileges:\n\n```ts\ndeps.features.registerKibanaFeature({\n
deprecated: {\n notice: 'The feature is deprecated because … well,
there’s a reason.',\n --> replacedBy: ['feature_id_v2'], <--\n },\n id:
'feature_id'\n name: `Case #4 feature ${suffix} (DEPRECATED)`,\n
…\n});\n```\n\n## How to test\n\n1. Run test server\n```bash\nnode
scripts/functional_tests_server.js --config
x-pack/test/security_api_integration/features.config.ts\n```\n\n2.
Execute the following request from the Dev Tools (`case_4_feature_a`\nis
a deprecated feature that is replaced by multiple features
and\n**doesn't use** `deprecated.replacedBy`)\n```http\nPUT
kbn:/api/spaces/space/default?overwrite=true\n{\n \"id\":\"default\",\n
\"name\":\"Default\",\n \"description\":\"This is your default
space!\",\n \"color\":\"#00bfb3\",\n
\"disabledFeatures\":[\"case_4_feature_a\"],\n \"_reserved\":true,\n
\"imageUrl\":\"\",\n \"initials\":\"D\"\n}\n```\n\n3. Observe that in
response deprecated `case_4_feature_a` is replaced by\ntwo features (you
can also
check\nhttp://localhost:5620/app/management/kibana/spaces/edit/default
to see\nhow it's reflected in UI)\n```http\n{\n \"id\": \"default\",\n
\"name\": \"Default\",\n \"description\": \"This is your default
space!\",\n \"color\": \"#00bfb3\",\n \"initials\": \"D\",\n
\"imageUrl\": \"\",\n \"disabledFeatures\": [\n
\"case_4_feature_a_v2\",\n \"case_4_feature_c\"\n ],\n \"_reserved\":
true\n}\n```\n\n4. Execute the following request from the Dev Tools
(`case_4_feature_b`\nis a deprecated feature that is replaced by
multiple features, but\n**uses** `deprecated.replacedBy` to set the
conceptual\nfeature-successor)\n```http\nPUT
kbn:/api/spaces/space/default?overwrite=true\n{\n \"id\":\"default\",\n
\"name\":\"Default\",\n \"description\":\"This is your default
space!\",\n \"color\":\"#00bfb3\",\n
\"disabledFeatures\":[\"case_4_feature_b\"],\n \"_reserved\":true,\n
\"imageUrl\":\"\",\n \"initials\":\"D\"\n}\n```\n\n5. Observe that in
response deprecated `case_4_feature_b` is replaced by\na single feature
(you can also
check\nhttp://localhost:5620/app/management/kibana/spaces/edit/default
to see\nhow it's reflected in UI)\n```http\n{\n \"id\": \"default\",\n
\"name\": \"Default\",\n \"description\": \"This is your default
space!\",\n \"color\": \"#00bfb3\",\n \"initials\": \"D\",\n
\"imageUrl\": \"\",\n \"disabledFeatures\": [\n
\"case_4_feature_b_v2\"\n ],\n \"_reserved\": true\n}\n```\n\n__Required
by:__\nhttps://github.com/elastic/pull/202863#discussion_r1892672114\n\n//cc
@davismcphee","sha":"dd3ce0e7f534279f48be8c125853c89aa92969e2"}}]}]
BACKPORT-->

Co-authored-by: Aleh Zasypkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants