kibana/x-pack/plugins/graph
Tim Sullivan 99aa884fa0
Preparation for High Contrast Mode, Analytics Experience domains (#202608)
## Summary

**Reviewers: Please test the code paths affected by this PR. See the
"Risks" section below.**

Part of work for enabling "high contrast mode" in Kibana. See
https://github.com/elastic/kibana/issues/176219.

**Background:**
Kibana will soon have a user profile setting to allow users to enable
"high contrast mode." This setting will activate a flag with
`<EuiProvider>` that causes EUI components to render with higher
contrast visual elements. Consumer plugins and packages need to be
updated selected places where `<EuiProvider>` is wrapped, to pass the
`UserProfileService` service dependency from the CoreStart contract.

**NOTE:** **EUI currently does not yet support the high-contrast mode
flag**, but support for that is expected to come in around 2 weeks.
These first PRs are simply preparing the code by wiring up the
`UserProvideService`.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [X] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [medium/high] The implementor of this change did not manually test
the affected code paths and relied on type-checking and functional tests
to drive the changes. Code owners for this PR need to manually test the
affected code paths.
- [ ] [medium] The `UserProfileService` dependency comes from the
CoreStart contract. If acquiring the service causes synchronous code to
become asynchronous, check for race conditions or errors in rendering
React components. Code owners for this PR need to manually test the
affected code paths.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-12 13:16:07 -06:00
..
common [Move @kbn/config-schema to server] visualization plugins (#191775) 2024-08-30 14:37:29 +02:00
public Preparation for High Contrast Mode, Analytics Experience domains (#202608) 2024-12-12 13:16:07 -06:00
server Added scope field to features config. (#191634) 2024-09-12 19:22:20 -05:00
jest.config.js
kibana.jsonc [Sustainable Kibana Architecture] Update plugins (wave #1) (#195375) 2024-10-25 16:05:27 +02:00
README.md [ftr] automatically determine config run order (#130983) 2022-05-04 17:05:58 -05:00
tsconfig.json [Visualizations] Remove usage of deprecated React rendering utilities (#181491) 2024-04-26 10:55:55 -07:00

Graph app

This is the main source folder of the Graph plugin. It contains all of the Kibana server and client source code. x-pack/test/functional/apps/graph contains additional functional tests.

Graph shows only up in the side bar if your server is running on a platinum or trial license. You can activate a trial license in Management > License Management.

Common commands

  • Run tests yarn test:jest x-pack/plugins/graph --watch
  • Run type check node scripts/type_check.js --project=x-pack/tsconfig.json
  • Run linter node scripts/eslint.js x-pack/plugins/graph
  • Run functional tests (make sure to stop dev server)
    • Server node ./scripts/functional_tests_server.js --config x-pack/test/functional/apps/graph/config.ts
    • Tests node scripts/functional_test_runner.js --config x-pack/test/functional/apps/graph/config.ts

Folder structure

Client public/

Currently state handled by react/redux/saga and the core mutable GraphWorkspace instance, which managing the nodes and edges state. It should be rewritten in typescript and integrated into redux store.

  • apps/ contains all graph app routes
  • components/ contains react components for various parts of the interface. Components can hold local UI state (e.g. current form data), everything else should be passed in from the caller. Styles should reside in a component-specific stylesheet
  • services/ contains the core workspace logic and functions that encapsule other parts of Kibana. Stateful dependencies are passed in from the outside. Components should not rely on services directly but have callbacks passed in. Once the migration to redux/saga is complete, only sagas will use services
  • helpers/ contains side effect free helper functions that can be imported and used from components and services
  • state_management/ contains reducers, action creators, selectors and sagas. It also exports the central store creator
    • Each file covers one functional area (e.g. handling of fields, handling of url templates...)
    • Generally there is no file separation between reducers, action creators, selectors and sagas of the same functional area
    • Sagas may contain cross-references between multiple functional areas (e.g. the loading saga sets fields and meta data). Because of this it is possible that circular imports occur. In this case the sagas are moved to a separate file <functional area>.sagas.ts.
  • types/ contains type definitions for unmigrated GraphWorkspace methods
  • router.tsx is the central entrypoint of the app

Server server/

The Graph server is only forwarding requests to Elasticsearch API and contains very little logic. It will be rewritten soon.