Go to file
Clint Andrew Hall 3727b5355a
[Canvas] Storybook for testing and development (#29072)
## Summary

This PR adds [Storybook](https://storybook.js.org/) to our testing and development suite.

![screen shot 2019-01-21 at 4 35 32 pm](https://user-images.githubusercontent.com/297604/51502196-9f856780-1d9a-11e9-97bf-07c99c3f279b.png)

This will allow us to:

1. create a site outlining all components within Canvas, including their TS type information;
2. demonstrate usage of all components by example;
3. allow for individual component testing, both manually and by Jest;
4. iterate and fix bugs on individual components *without* having to start up Kibana, in a [HMR](https://webpack.js.org/concepts/hot-module-replacement/) environment;
5. automatically generate [snapshots](https://jestjs.io/docs/en/snapshot-testing) based on any examples written;

This PR also converts a few components to Typescript and adds examples.

## How this can help us, (with examples)

I was inspired to add this when I was fixing #25342.  In order to fix my changes, I had to run elasticsearch and kibana, as well as refresh my page whenever I needed to test a change.  Had I had a Storybook instance, I would have been done much faster.

In this PR, you'll see I converted `AdvancedFilter` from `renderers` and `FontPicker` and `ImageUpload` from `public/components`.  Would you believe I discovered and fixed bugs just by converting to Typescript and writing examples?

### `AdvancedFilter`

- `onChange` and `commit` are not marked as required in `propTypes`, but the component will error out if they're not supplied.
- `commit` was actually being called twice when 'Apply' was clicked.  This was shown in the 'Actions' panel when I was testing it.

### `FontPicker`

- The `fonts` collection was not strongly-typed, therefore any string could be passed to the `value` parameter without error.
- While the code allows for any font string to be given to the component, there is no way to currently select that value, nor type it in within the control.  This is likely a bug in design.
- The `aria-labeledby` attribute in the drop down includes `undefined`.  This is likely a bug in EUI:

![screen shot 2019-01-21 at 4 25 58 pm](https://user-images.githubusercontent.com/297604/51501908-5ed91e80-1d99-11e9-913a-ce1bb5f4e352.png)

## How to use

- `cd x-pack/plugins/canvas/`
- Run `node scripts/storybook` to start up a local development version, with HMR.
- Run `node scripts/storybook_build` to build a complete static version of the book.
- Run `node scripts/jest` which will run the Storyshots test; run `node scripts/jest --updateSnapshot` if source code has changed as expected.

## Future Work

- Adding Jest coverage and output to the info panels, ([this](https://www.npmjs.com/package/@storybook/addon-jest) is *sick* functionality).
- Adding automatic [a11y testing](https://www.npmjs.com/package/@storybook/addon-a11y), (currently [blocked](https://github.com/storybooks/storybook/issues/4889)).
- Adding generic knobs for stories
- Adding more example info, (e.g. who edited last, descriptions, etc).
2019-02-15 10:35:30 -06:00
.ci [ci] remove reference to non-existent phantom file (#29541) 2019-01-29 12:38:01 -08:00
.github Update paths to ui, server, deprecation, plugin_discovery in src/legacy 2019-02-11 10:41:37 -05:00
bin Bump node to 10.15.1 (#27918) 2019-02-05 16:06:59 -06:00
common/graphql [Uptime] Implement EuiSuperDatePicker (#28217) 2019-01-18 13:44:58 -05:00
config Support for multiple Elasticsearch nodes and sniffing (#21928) 2018-12-18 13:22:43 -06:00
data [folder structure] plugins/.data -> data 2016-07-05 14:06:16 -05:00
docs Update vega to version 4 (#30628) 2019-02-14 11:35:05 +01:00
licenses Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
packages Fix plugin-helpers test:server task (#31034) 2019-02-13 22:47:26 -08:00
plugins [folder structure] plugins/.data -> data 2016-07-05 14:06:16 -05:00
scripts Add zh-CN.json translations and respective compatibility checks via i18n tools (#30378) 2019-02-11 14:39:59 +01:00
src Share global filters & queries with coordinate maps vis. (#30595) 2019-02-15 08:43:05 -07:00
style_guides Point to EUI for SASS/CSS guidelines (#27415) 2018-12-18 14:39:38 -05:00
tasks Update paths to ui, server, deprecation, plugin_discovery in src/legacy 2019-02-11 10:41:37 -05:00
test Share global filters & queries with coordinate maps vis. (#30595) 2019-02-15 08:43:05 -07:00
typings Add typings for saved_object_finder (#30067) 2019-02-11 09:38:29 +01:00
utilities Only using known handlers with handlebars (#27061) 2018-12-17 08:29:37 -08:00
webpackShims add polyfill for ChildNode remove (#21797) 2018-08-10 15:21:11 -06:00
x-pack [Canvas] Storybook for testing and development (#29072) 2019-02-15 10:35:30 -06:00
.backportrc.json Fix .backportrc.json to use 7.x instead of 7.1 (#30253) 2019-02-06 10:49:00 -05:00
.browserslistrc Convert all Less files to Sass in Dashboard, using EUI variable scope (#21374) 2018-08-14 19:05:33 -04:00
.editorconfig Apply the same editorconfig rules to both markdown and asciidoc files 2016-09-07 11:41:41 -04:00
.eslintignore Update paths to ui, server, deprecation, plugin_discovery in src/legacy 2019-02-11 10:41:37 -05:00
.eslintrc.js Reintroduce linting rule that requires single-quotes in x-pack. (#30893) 2019-02-14 12:08:37 -08:00
.gitignore Implement built_assets directory (#27468) 2019-01-09 17:30:29 -07:00
.i18nrc.json Update paths to ui, server, deprecation, plugin_discovery in src/legacy 2019-02-11 10:41:37 -05:00
.node-version Bump node to 10.15.1 (#27918) 2019-02-05 16:06:59 -06:00
.nvmrc Bump node to 10.15.1 (#27918) 2019-02-05 16:06:59 -06:00
.prettierrc Increase prettier line width to 100 (#20535) 2018-07-09 22:50:37 +02:00
.sass-lint.yml Dark mode fixes for Visualize charts, TSVB, and Timelion (#30478) 2019-02-14 11:46:56 -05:00
.yarnrc [kbn-pm] Use yarn workspaces for dependencies (#24095) 2018-11-12 12:38:11 -06:00
CONTRIBUTING.md [docs] Improve contributing docs on runing Elasticsearch (#30286) 2019-02-11 07:59:59 -08:00
FAQ.md propose language changes (#10709) 2017-03-05 12:10:32 -05:00
Gruntfile.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
kibana.d.ts Update paths to ui, server, deprecation, plugin_discovery in src/legacy 2019-02-11 10:41:37 -05:00
LICENSE.txt Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
NOTICE.txt [ftr/element] custom scrollIntoView to support fixed header (#28727) 2019-01-16 12:37:40 -08:00
package.json Update vega to version 4 (#30628) 2019-02-14 11:35:05 +01:00
preinstall_check.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
README.md Update paths to ui, server, deprecation, plugin_discovery in src/legacy 2019-02-11 10:41:37 -05:00
STYLEGUIDE.md Point to EUI for SASS/CSS guidelines (#27415) 2018-12-18 14:39:38 -05:00
tsconfig.browser.json [typescript] continue to use the default config in development (#21966) 2018-08-14 15:27:07 -07:00
tsconfig.json Update paths to ui, server, deprecation, plugin_discovery in src/legacy 2019-02-11 10:41:37 -05:00
tsconfig.types.json Add Kibana bootstrap step to generate types exposed by the core and its plugins. (#23686) 2018-10-05 21:00:26 +02:00
tslint.yaml [tslint] ban exclusive tests (#30448) 2019-02-07 17:30:04 -08:00
TYPESCRIPT.md docs(Typescript): Update doc to declare @elastic/eui typings in global typings file (#26160) 2018-11-28 10:46:07 +01:00
yarn.lock [Canvas] Storybook for testing and development (#29072) 2019-02-15 10:35:30 -06:00

Kibana

Kibana is your window into the Elastic Stack. Specifically, it's a browser-based analytics and search dashboard for Elasticsearch.

Getting Started

If you just want to try Kibana out, check out the Elastic Stack Getting Started Page to give it a whirl.

If you're interested in diving a bit deeper and getting a taste of Kibana's capabilities, head over to the Kibana Getting Started Page.

Using a Kibana Release

If you want to use a Kibana release in production, give it a test run, or just play around:

Building and Running Kibana, and/or Contributing Code

You might want to build Kibana locally to contribute some code, test out the latest features, or try out an open PR:

Documentation

Visit Elastic.co for the full Kibana documentation.

For information about building the documentation, see the README in elastic/docs.

Version Compatibility with Elasticsearch

Ideally, you should be running Elasticsearch and Kibana with matching version numbers. If your Elasticsearch has an older version number or a newer major number than Kibana, then Kibana will fail to run. If Elasticsearch has a newer minor or patch number than Kibana, then the Kibana Server will log a warning.

Note: The version numbers below are only examples, meant to illustrate the relationships between different types of version numbers.

Situation Example Kibana version Example ES version Outcome
Versions are the same. 5.1.2 5.1.2 💚 OK
ES patch number is newer. 5.1.2 5.1.5 ⚠️ Logged warning
ES minor number is newer. 5.1.2 5.5.0 ⚠️ Logged warning
ES major number is newer. 5.1.2 6.0.0 🚫 Fatal error
ES patch number is older. 5.1.2 5.1.0 ⚠️ Logged warning
ES minor number is older. 5.1.2 5.0.0 🚫 Fatal error
ES major number is older. 5.1.2 4.0.0 🚫 Fatal error

Questions? Problems? Suggestions?

  • If you've found a bug or want to request a feature, please create a GitHub Issue. Please check to make sure someone else hasn't already created an issue for the same topic.
  • Need help using Kibana? Ask away on our Kibana Discuss Forum and a fellow community member or Elastic engineer will be glad to help you out.