diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5ff8531861a0..e7ca77ccc22f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,10 +4,10 @@ are a few simple things to check before submitting your pull request that can help with the review process. You should delete these items from your submission, but they are here to help bring them to your attention. ---> - Have you signed the [contributor license agreement](https://www.elastic.co/contributor-agreement)? - Have you followed the [contributor guidelines](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md)? - If submitting code, have you included unit tests that cover the changes? - If submitting code, have you tested and built your code locally prior to submission with `npm test && npm run build`? - If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed. +--> diff --git a/.gitignore b/.gitignore index b04c40f74d13..fbd0bc3f495b 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ selenium ui_framework/doc_site/build !ui_framework/doc_site/build/index.html yarn.lock +.yo-rc.json diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md index a71ad9cce018..5064899781a9 100644 --- a/STYLEGUIDE.md +++ b/STYLEGUIDE.md @@ -7,9 +7,11 @@ recommended for the development of all Kibana plugins. - [Angular](style_guides/angular_style_guide.md) - [React](style_guides/react_style_guide.md) - [CSS](style_guides/css_style_guide.md) +- [SCSS](style_guides/scss_style_guide.md) - [HTML](style_guides/html_style_guide.md) - [API](style_guides/api_style_guide.md) - [Architecture](style_guides/architecture_style_guide.md) +- [Accessibility](style_guides/acecssibility_guide.md) ## Filenames diff --git a/docs/development/core/development-elasticsearch.asciidoc b/docs/development/core/development-elasticsearch.asciidoc index 36e85d04f580..751a507753b9 100644 --- a/docs/development/core/development-elasticsearch.asciidoc +++ b/docs/development/core/development-elasticsearch.asciidoc @@ -31,9 +31,8 @@ Browser clients are exposed through AngularJS services. [source,javascript] ---- uiModules.get('kibana') -.run(function (esAdmin, es) { +.run(function (es) { es.ping() - .then(() => esAdmin.ping()) .catch(err => { console.log('error pinging servers'); }); diff --git a/docs/index-shared1.asciidoc b/docs/index-shared1.asciidoc index 1abb7d8ba7dc..40c7bfd20cdf 100644 --- a/docs/index-shared1.asciidoc +++ b/docs/index-shared1.asciidoc @@ -1,11 +1,5 @@ -////////// -release-state can be: released | prerelease | unreleased -////////// -:release-state: unreleased -:version: 6.1.0 -:major-version: 6.x -:branch: 6.x +include::{asciidoc-dir}/../../shared/versions61.asciidoc[] :docker-image: docker.elastic.co/kibana/kibana:{version} :repo: https://github.com/elastic/kibana/ diff --git a/docs/setup/install.asciidoc b/docs/setup/install.asciidoc index ea4685383c43..25a414843f5c 100644 --- a/docs/setup/install.asciidoc +++ b/docs/setup/install.asciidoc @@ -41,8 +41,8 @@ Docker registry. {kibana-ref}/docker.html[Running Kibana on Docker] IMPORTANT: If your Elasticsearch installation is protected by {xpack-ref}/xpack-security.html[X-Pack Security] -see {xpack-ref}/kibana.html[Using Kibana with X-Pack Security] for additional setup -instructions. +see {kibana-ref}/using-kibana-with-security.html[Configuring Security in Kibana] +for additional setup instructions. include::install/targz.asciidoc[] diff --git a/docs/setup/production.asciidoc b/docs/setup/production.asciidoc index 6010cc9d59f4..042b0ff98768 100644 --- a/docs/setup/production.asciidoc +++ b/docs/setup/production.asciidoc @@ -34,7 +34,8 @@ not exist. X-Pack Security does not currently provide a way to control which users can load which dashboards. For information about setting up Kibana users and how to configure Kibana -to work with X-Pack, see {xpack-ref}/kibana.html[Kibana and Security]. +to work with X-Pack, see +{kibana-ref}/using-kibana-with-security.html[Configuring Security in Kibana]. [float] [[enabling-ssl]] diff --git a/package.json b/package.json index 4c91af445b54..724bc7c73b42 100644 --- a/package.json +++ b/package.json @@ -63,22 +63,23 @@ "mocha": "echo 'use `node scripts/mocha`' && false", "sterilize": "grunt sterilize", "uiFramework:start": "grunt uiFramework:start", - "uiFramework:build": "grunt uiFramework:build" + "uiFramework:build": "grunt uiFramework:build", + "uiFramework:createComponent": "yo ./ui_framework/generator-kui/app/component.js", + "uiFramework:documentComponent": "yo ./ui_framework/generator-kui/app/documentation.js" }, "repository": { "type": "git", "url": "https://github.com/elastic/kibana.git" }, "dependencies": { - "@bigfunger/jsondiffpatch": "0.1.38-webpack", "@elastic/datemath": "2.3.0", + "@elastic/filesaver": "1.1.2", + "@elastic/leaflet-draw": "0.2.3", + "@elastic/leaflet-heat": "0.1.3", + "@elastic/numeral": "2.2.1", + "@elastic/test-subj-selector": "0.2.1", + "@elastic/ui-ace": "0.2.3", "@elastic/webpack-directory-name-as-main": "2.0.2", - "@spalger/filesaver": "1.1.2", - "@spalger/leaflet-draw": "0.2.3", - "@spalger/leaflet-heat": "0.1.3", - "@spalger/numeral": "^2.0.0", - "@spalger/test-subj-selector": "0.2.1", - "@spalger/ui-ace": "0.2.3", "JSONStream": "1.1.1", "accept-language-parser": "1.2.0", "angular": "1.4.7", @@ -158,8 +159,8 @@ "node-fetch": "1.3.2", "pegjs": "0.9.0", "postcss-loader": "1.3.3", - "proxy-from-env": "1.0.0", "prop-types": "15.5.8", + "proxy-from-env": "1.0.0", "pui-react-overlay-trigger": "7.5.4", "pui-react-tooltip": "7.5.4", "querystring-browser": "1.0.4", @@ -203,12 +204,13 @@ "yauzl": "2.7.0" }, "devDependencies": { - "@elastic/eslint-config-kibana": "0.9.0", + "@elastic/eslint-config-kibana": "0.10.0", "@elastic/eslint-import-resolver-kibana": "0.8.1", "@elastic/eslint-plugin-kibana-custom": "1.0.3", "angular-mocks": "1.4.7", "babel-eslint": "7.2.3", "chai": "3.5.0", + "chalk": "2.0.1", "chance": "1.0.6", "cheerio": "0.22.0", "chokidar": "1.6.0", @@ -276,7 +278,9 @@ "supertest": "3.0.0", "supertest-as-promised": "2.0.2", "tree-kill": "1.1.0", - "webpack-dev-server": "1.14.1" + "webpack-dev-server": "1.14.1", + "yeoman-generator": "1.1.1", + "yo": "2.0.0" }, "engines": { "node": "6.11.1", diff --git a/src/core_plugins/kbn_vislib_vis_types/public/controls/gauge_options.html b/src/core_plugins/kbn_vislib_vis_types/public/controls/gauge_options.html index fee2c53a65b5..8ee3baa21cc7 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/controls/gauge_options.html +++ b/src/core_plugins/kbn_vislib_vis_types/public/controls/gauge_options.html @@ -97,16 +97,17 @@ ); @@ -67,7 +67,7 @@ class MarkdownEditor extends Component { ); diff --git a/src/core_plugins/metrics/public/components/panel_config.js b/src/core_plugins/metrics/public/components/panel_config.js index 26aa7fda0ed9..5ec2b849b746 100644 --- a/src/core_plugins/metrics/public/components/panel_config.js +++ b/src/core_plugins/metrics/public/components/panel_config.js @@ -19,7 +19,7 @@ function PanelConfig(props) { if (component) { return React.createElement(component, props); } - return (
Missing panel config for "{model.type}"
); + return (
Missing panel config for “{model.type}”
); } PanelConfig.propTypes = { diff --git a/src/core_plugins/metrics/public/components/panel_config/gauge.js b/src/core_plugins/metrics/public/components/panel_config/gauge.js index 17b690d80e61..b70227b3a7f9 100644 --- a/src/core_plugins/metrics/public/components/panel_config/gauge.js +++ b/src/core_plugins/metrics/public/components/panel_config/gauge.js @@ -1,6 +1,6 @@ import React, { Component, PropTypes } from 'react'; import SeriesEditor from '../series_editor'; -import IndexPattern from '../index_pattern'; +import { IndexPattern } from '../index_pattern'; import Select from 'react-select'; import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; diff --git a/src/core_plugins/metrics/public/components/panel_config/markdown.js b/src/core_plugins/metrics/public/components/panel_config/markdown.js index 28148e150421..8c065ece6c1a 100644 --- a/src/core_plugins/metrics/public/components/panel_config/markdown.js +++ b/src/core_plugins/metrics/public/components/panel_config/markdown.js @@ -1,6 +1,6 @@ import React, { Component, PropTypes } from 'react'; import SeriesEditor from '../series_editor'; -import IndexPattern from '../index_pattern'; +import { IndexPattern } from '../index_pattern'; import AceEditor from 'react-ace'; import 'brace/mode/less'; import Select from 'react-select'; @@ -120,7 +120,7 @@ class MarkdownPanelConfig extends Component { width="100%" name={`ace-css-${model.id}`} setOptions={{ fontSize: '14px' }} - value={ model.markdown_less} + value={model.markdown_less} onChange={this.handleCSSChange} /> diff --git a/src/core_plugins/metrics/public/components/panel_config/metric.js b/src/core_plugins/metrics/public/components/panel_config/metric.js index 99f42955cf57..5879503040a5 100644 --- a/src/core_plugins/metrics/public/components/panel_config/metric.js +++ b/src/core_plugins/metrics/public/components/panel_config/metric.js @@ -1,6 +1,6 @@ import React, { Component, PropTypes } from 'react'; import SeriesEditor from '../series_editor'; -import IndexPattern from '../index_pattern'; +import { IndexPattern } from '../index_pattern'; import createTextHandler from '../lib/create_text_handler'; import ColorRules from '../color_rules'; import YesNo from '../yes_no'; @@ -85,11 +85,13 @@ class MetricPanelConfig extends Component {
this.switchTab('data')} + tabIndex="0" >Data
this.switchTab('options')} + tabIndex="0" >Panel Options
diff --git a/src/core_plugins/metrics/public/components/panel_config/timeseries.js b/src/core_plugins/metrics/public/components/panel_config/timeseries.js index 95cd64c31662..ce81e1b37d1c 100644 --- a/src/core_plugins/metrics/public/components/panel_config/timeseries.js +++ b/src/core_plugins/metrics/public/components/panel_config/timeseries.js @@ -1,7 +1,7 @@ import React, { Component, PropTypes } from 'react'; import SeriesEditor from '../series_editor'; import AnnotationsEditor from '../annotations_editor'; -import IndexPattern from '../index_pattern'; +import { IndexPattern } from '../index_pattern'; import Select from 'react-select'; import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; @@ -146,16 +146,19 @@ class TimeseriesPanelConfig extends Component {
this.switchTab('data')} + tabIndex="0" >Data
this.switchTab('options')} + tabIndex="0" >Panel Options
this.switchTab('annotations')} + tabIndex="0" >Annotations
diff --git a/src/core_plugins/metrics/public/components/panel_config/top_n.js b/src/core_plugins/metrics/public/components/panel_config/top_n.js index 6b0ae6501033..01166f9603ae 100644 --- a/src/core_plugins/metrics/public/components/panel_config/top_n.js +++ b/src/core_plugins/metrics/public/components/panel_config/top_n.js @@ -1,6 +1,6 @@ import React, { Component, PropTypes } from 'react'; import SeriesEditor from '../series_editor'; -import IndexPattern from '../index_pattern'; +import { IndexPattern } from '../index_pattern'; import createTextHandler from '../lib/create_text_handler'; import ColorRules from '../color_rules'; import ColorPicker from '../color_picker'; diff --git a/src/core_plugins/metrics/public/components/series_config.js b/src/core_plugins/metrics/public/components/series_config.js index 3a1883159bd2..b9b19ef70a0b 100644 --- a/src/core_plugins/metrics/public/components/series_config.js +++ b/src/core_plugins/metrics/public/components/series_config.js @@ -1,61 +1,58 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import DataFormatPicker from './data_format_picker'; import createSelectHandler from './lib/create_select_handler'; import createTextHandler from './lib/create_text_handler'; import YesNo from './yes_no'; -import IndexPattern from './index_pattern'; +import { IndexPattern } from './index_pattern'; -class SeriesConfig extends Component { - render() { - const defaults = { offset_time: '', value_template: '' }; - const model = { ...defaults, ...this.props.model }; - const handleSelectChange = createSelectHandler(this.props.onChange); - const handleTextChange = createTextHandler(this.props.onChange); +export const SeriesConfig = props => { + const defaults = { offset_time: '', value_template: '' }; + const model = { ...defaults, ...props.model }; + const handleSelectChange = createSelectHandler(props.onChange); + const handleTextChange = createTextHandler(props.onChange); - return ( -
-
-
- -
Template (eg.{'{{value}}/s'})
- -
Offset series time by (1m, 1h, 1w, 1d)
- -
-
-
Override Index Pattern
- - -
+ return ( +
+
+
+ +
Template (eg.{'{{value}}/s'})
+ +
Offset series time by (1m, 1h, 1w, 1d)
+ +
+
+
Override Index Pattern
+ +
- ); - } - -} +
+ ); +}; SeriesConfig.propTypes = { fields: PropTypes.object, @@ -63,5 +60,3 @@ SeriesConfig.propTypes = { onChange: PropTypes.func }; -export default SeriesConfig; - diff --git a/src/core_plugins/metrics/public/components/split.js b/src/core_plugins/metrics/public/components/split.js index 8cc11b22346d..1ef670c2623e 100644 --- a/src/core_plugins/metrics/public/components/split.js +++ b/src/core_plugins/metrics/public/components/split.js @@ -1,8 +1,8 @@ import React, { Component, PropTypes } from 'react'; import uuid from 'uuid'; -import SplitByTerms from './splits/terms'; -import SplitByFilter from './splits/filter'; +import { SplitByTerms } from './splits/terms'; +import { SplitByFilter } from './splits/filter'; import SplitByFilters from './splits/filters'; import SplitByEverything from './splits/everything'; diff --git a/src/core_plugins/metrics/public/components/splits/filter.js b/src/core_plugins/metrics/public/components/splits/filter.js index dab31fd56f8b..3805f25eef0c 100644 --- a/src/core_plugins/metrics/public/components/splits/filter.js +++ b/src/core_plugins/metrics/public/components/splits/filter.js @@ -1,40 +1,34 @@ import createTextHandler from '../lib/create_text_handler'; import createSelectHandler from '../lib/create_select_handler'; import GroupBySelect from './group_by_select'; -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; -class SplitByFilter extends Component { - - render() { - const { onChange } = this.props; - const defaults = { filter: '' }; - const model = { ...defaults, ...this.props.model }; - const handleTextChange = createTextHandler(onChange); - const handleSelectChange = createSelectHandler(onChange); - return ( -
-
Group By
-
- -
-
Query String
- { + const { onChange } = props; + const defaults = { filter: '' }; + const model = { ...defaults, ...props.model }; + const handleTextChange = createTextHandler(onChange); + const handleSelectChange = createSelectHandler(onChange); + return ( +
+
Group By
+
+
- ); - } - -} +
Query String
+ +
+ ); +}; SplitByFilter.propTypes = { model: PropTypes.object, onChange: PropTypes.func }; - -export default SplitByFilter; diff --git a/src/core_plugins/metrics/public/components/splits/group_by_select.js b/src/core_plugins/metrics/public/components/splits/group_by_select.js index f6904175ed6a..02cbef254ecb 100644 --- a/src/core_plugins/metrics/public/components/splits/group_by_select.js +++ b/src/core_plugins/metrics/public/components/splits/group_by_select.js @@ -10,9 +10,9 @@ function GroupBySelect(props) { return ( +
Group By
+
+ -
Order By
-
- -
- ); - } - -} +
By
+
+ +
+
Top
+ +
Order By
+
+ +
+
+ ); +}; SplitByTerms.propTypes = { model: PropTypes.object, @@ -65,5 +61,3 @@ SplitByTerms.propTypes = { indexPattern: PropTypes.string, fields: PropTypes.object }; - -export default SplitByTerms; diff --git a/src/core_plugins/metrics/public/components/vis_editor_visualization.js b/src/core_plugins/metrics/public/components/vis_editor_visualization.js index 176655b72590..ecb3db08e300 100644 --- a/src/core_plugins/metrics/public/components/vis_editor_visualization.js +++ b/src/core_plugins/metrics/public/components/vis_editor_visualization.js @@ -61,7 +61,7 @@ class VisEditorVisualization extends Component { if (autoApply) applyMessage = 'The changes will be automatically applied.'; const applyButton = (
-
Auto Apply
+
Auto Apply
-
+
{ label }
@@ -47,7 +47,7 @@ function VisPicker(props) { ); diff --git a/src/core_plugins/metrics/public/components/vis_types/gauge/series.js b/src/core_plugins/metrics/public/components/vis_types/gauge/series.js index 91ad826a7dcb..2aa6f122ff45 100644 --- a/src/core_plugins/metrics/public/components/vis_types/gauge/series.js +++ b/src/core_plugins/metrics/public/components/vis_types/gauge/series.js @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import ColorPicker from '../../color_picker'; import AddDeleteButtons from '../../add_delete_buttons'; -import SeriesConfig from '../../series_config'; +import { SeriesConfig } from '../../series_config'; import Sortable from 'react-anything-sortable'; import Split from '../../split'; import Tooltip from '../../tooltip'; @@ -125,13 +125,13 @@ function GaugeSeries(props) { >
-
+
{ colorPicker }
diff --git a/src/core_plugins/metrics/public/components/vis_types/markdown/series.js b/src/core_plugins/metrics/public/components/vis_types/markdown/series.js index 5318038935a0..471dd47048a3 100644 --- a/src/core_plugins/metrics/public/components/vis_types/markdown/series.js +++ b/src/core_plugins/metrics/public/components/vis_types/markdown/series.js @@ -1,6 +1,6 @@ import React, { PropTypes } from 'react'; import AddDeleteButtons from '../../add_delete_buttons'; -import SeriesConfig from '../../series_config'; +import { SeriesConfig } from '../../series_config'; import Sortable from 'react-anything-sortable'; import Split from '../../split'; import createAggRowRender from '../../lib/create_agg_row_render'; @@ -100,18 +100,18 @@ function MarkdownSeries(props) { >
-
+
diff --git a/src/core_plugins/metrics/public/components/vis_types/metric/series.js b/src/core_plugins/metrics/public/components/vis_types/metric/series.js index 64960748a033..e85314267355 100644 --- a/src/core_plugins/metrics/public/components/vis_types/metric/series.js +++ b/src/core_plugins/metrics/public/components/vis_types/metric/series.js @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import ColorPicker from '../../color_picker'; import AddDeleteButtons from '../../add_delete_buttons'; -import SeriesConfig from '../../series_config'; +import { SeriesConfig } from '../../series_config'; import Sortable from 'react-anything-sortable'; import Split from '../../split'; import Tooltip from '../../tooltip'; @@ -125,13 +125,13 @@ function MetricSeries(props) { >
-
+
{ colorPicker }
diff --git a/src/core_plugins/metrics/public/components/vis_types/timeseries/config.js b/src/core_plugins/metrics/public/components/vis_types/timeseries/config.js index 97fee28ca252..667cb926544f 100644 --- a/src/core_plugins/metrics/public/components/vis_types/timeseries/config.js +++ b/src/core_plugins/metrics/public/components/vis_types/timeseries/config.js @@ -4,7 +4,7 @@ import DataFormatPicker from '../../data_format_picker'; import createSelectHandler from '../../lib/create_select_handler'; import YesNo from '../../yes_no'; import createTextHandler from '../../lib/create_text_handler'; -import IndexPattern from '../../index_pattern'; +import { IndexPattern } from '../../index_pattern'; function TimeseriesConfig(props) { const handleSelectChange = createSelectHandler(props.onChange); diff --git a/src/core_plugins/metrics/public/components/vis_types/timeseries/series.js b/src/core_plugins/metrics/public/components/vis_types/timeseries/series.js index d632b65cf5b3..b6db23e0cad1 100644 --- a/src/core_plugins/metrics/public/components/vis_types/timeseries/series.js +++ b/src/core_plugins/metrics/public/components/vis_types/timeseries/series.js @@ -125,13 +125,13 @@ function TimeseriesSeries(props) { >
-
+
{ colorPicker }
diff --git a/src/core_plugins/metrics/public/components/vis_types/timeseries/vis.js b/src/core_plugins/metrics/public/components/vis_types/timeseries/vis.js index 2beab3fcdfff..0b8cc84f589c 100644 --- a/src/core_plugins/metrics/public/components/vis_types/timeseries/vis.js +++ b/src/core_plugins/metrics/public/components/vis_types/timeseries/vis.js @@ -80,8 +80,11 @@ function TimeseriesVisualization(props) { }); const interval = series.reduce((currentInterval, item) => { - const seriesInterval = item.data[1][0] - item.data[0][0]; - if (!currentInterval || seriesInterval < currentInterval) return seriesInterval; + if (item.data.length > 1) { + const seriesInterval = item.data[1][0] - item.data[0][0]; + if (!currentInterval || seriesInterval < currentInterval) return seriesInterval; + } + return currentInterval; }, 0); let axisCount = 1; diff --git a/src/core_plugins/metrics/public/components/vis_types/top_n/series.js b/src/core_plugins/metrics/public/components/vis_types/top_n/series.js index 2049e5aac5e7..93e81b8f5084 100644 --- a/src/core_plugins/metrics/public/components/vis_types/top_n/series.js +++ b/src/core_plugins/metrics/public/components/vis_types/top_n/series.js @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import ColorPicker from '../../color_picker'; import AddDeleteButtons from '../../add_delete_buttons'; -import SeriesConfig from '../../series_config'; +import { SeriesConfig } from '../../series_config'; import Sortable from 'react-anything-sortable'; import Split from '../../split'; import Tooltip from '../../tooltip'; @@ -120,13 +120,13 @@ function TopNSeries(props) { >
-
+
{ colorPicker }
diff --git a/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js b/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js index 839b79c56fcf..522e73fb1532 100644 --- a/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js +++ b/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js @@ -1,5 +1,6 @@ import { validateInterval } from '../lib/validate_interval'; import { dashboardContextProvider } from 'plugins/kibana/dashboard/dashboard_context'; +import { timezoneProvider } from 'ui/vis/lib/timezone'; const MetricsRequestHandlerProvider = function (Private, Notifier, config, timefilter, $http) { const dashboardContext = Private(dashboardContextProvider); @@ -8,12 +9,13 @@ const MetricsRequestHandlerProvider = function (Private, Notifier, config, timef return { name: 'metrics', handler: function (vis /*, appState, uiState, queryFilter*/) { + const timezone = Private(timezoneProvider)(); return new Promise((resolve) => { const panel = vis.params; if (panel && panel.id) { const params = { - timerange: timefilter.getBounds(), + timerange: { timezone, ...timefilter.getBounds() }, filters: [dashboardContext()], panels: [panel] }; diff --git a/src/core_plugins/metrics/public/visualizations/components/resize.js b/src/core_plugins/metrics/public/visualizations/components/resize.js index 6af1d54749a6..4f2c3fa50a1c 100644 --- a/src/core_plugins/metrics/public/visualizations/components/resize.js +++ b/src/core_plugins/metrics/public/visualizations/components/resize.js @@ -29,7 +29,7 @@ class Resize extends Component { const el = findDOMNode(this.el); const currentWidth = el.parentNode.clientWidth; const currentHeight = el.parentNode.clientHeight; - this.setState({ currentHeight, currentWidth }); + this.setState({ currentHeight, currentWidth }); // eslint-disable-line react/no-did-mount-set-state this.checkSize(); } diff --git a/src/core_plugins/metrics/public/visualizations/components/timeseries.js b/src/core_plugins/metrics/public/visualizations/components/timeseries.js index 377297544df9..dafb91ea2e1f 100644 --- a/src/core_plugins/metrics/public/visualizations/components/timeseries.js +++ b/src/core_plugins/metrics/public/visualizations/components/timeseries.js @@ -123,12 +123,12 @@ class Timeseries extends Component { (row, i) => { const classes = ['rhythm_chart__legend_item']; const key = row.id; if (!_.includes(props.seriesFilter, row.id)) classes.push('disabled'); - if (row.label == null || row.legend === false) return (
); + if (row.label == null || row.legend === false) return (
); return (
props.onToggle(event, row.id) } - key={ key } + className={classes.join(' ')} + onClick={event => props.onToggle(event, row.id)} + key={key} >
diff --git a/src/core_plugins/metrics/server/lib/vis_data/__tests__/build_request_body.js b/src/core_plugins/metrics/server/lib/vis_data/__tests__/build_request_body.js index 93b6802b509a..4d8d93e96bba 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/__tests__/build_request_body.js +++ b/src/core_plugins/metrics/server/lib/vis_data/__tests__/build_request_body.js @@ -49,6 +49,7 @@ const body = JSON.parse(` } ], "timerange": { + "timezone": "UTC", "max": "2017-01-26T20:52:35.881Z", "min": "2017-01-26T20:37:35.881Z" } @@ -104,6 +105,7 @@ describe('buildRequestBody(req)', () => { 'field': '@timestamp', 'interval': '10s', 'min_doc_count': 0, + 'time_zone': 'UTC', 'extended_bounds': { 'min': 1485463055881, 'max': 1485463955881 diff --git a/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js b/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js index cdf84b26c0c5..9b90ac3cd2ee 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js +++ b/src/core_plugins/metrics/server/lib/vis_data/get_annotations.js @@ -9,7 +9,7 @@ function validAnnotation(annotation) { annotation.template; } -export default (req, panel) => { +export default async (req, panel) => { const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('data'); const bodies = panel.annotations .filter(validAnnotation) @@ -31,22 +31,22 @@ export default (req, panel) => { }); if (!bodies.length) return { responses: [] }; - return callWithRequest(req, 'msearch', { - body: bodies.reduce((acc, item) => acc.concat(item), []) - }) - .then(resp => { - const results = {}; - panel.annotations - .filter(validAnnotation) - .forEach((annotation, index) => { - const data = resp.responses[index]; - results[annotation.id] = handleAnnotationResponse(data, annotation); - }); - return results; - }) - .catch(error => { - if (error.message === 'missing-indices') return {}; - throw error; + try { + const resp = await callWithRequest(req, 'msearch', { + body: bodies.reduce((acc, item) => acc.concat(item), []) }); + const results = {}; + panel.annotations + .filter(validAnnotation) + .forEach((annotation, index) => { + const data = resp.responses[index]; + results[annotation.id] = handleAnnotationResponse(data, annotation); + }); + return results; + } catch (error) { + if (error.message === 'missing-indices') return { responses: [] }; + throw error; + } + }; diff --git a/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js b/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js index dd00dc4dda6f..d0528ea24df1 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js +++ b/src/core_plugins/metrics/server/lib/vis_data/get_panel_data.js @@ -21,7 +21,7 @@ export default function getPanelData(req) { }; }) .then(resp => { - if (!panel.annotations) return resp; + if (!panel.annotations || panel.annotations.length === 0) return resp; return getAnnotations(req, panel).then(annotations => { resp[panel.id].annotations = annotations; return resp; diff --git a/src/core_plugins/metrics/server/lib/vis_data/handle_error_response.js b/src/core_plugins/metrics/server/lib/vis_data/handle_error_response.js index 6a8a8d1c08c1..f322277d74b9 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/handle_error_response.js +++ b/src/core_plugins/metrics/server/lib/vis_data/handle_error_response.js @@ -7,10 +7,16 @@ export default panel => error => { } catch (e) { errorResponse = error.response; } + if (!errorResponse) { + errorResponse = { + message: error.message, + stack: error.stack + }; + } result[panel.id] = { id: panel.id, statusCode: error.statusCode, - error: errorResponse || error, + error: errorResponse, series: [] }; return result; diff --git a/src/core_plugins/metrics/server/lib/vis_data/handle_response_body.js b/src/core_plugins/metrics/server/lib/vis_data/handle_response_body.js index a2d531bed213..e08b265560f8 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/handle_response_body.js +++ b/src/core_plugins/metrics/server/lib/vis_data/handle_response_body.js @@ -1,5 +1,6 @@ import buildProcessorFunction from './build_processor_function'; import processors from './response_processors/series'; +import { get } from 'lodash'; export default function handleResponseBody(panel) { return resp => { @@ -8,7 +9,13 @@ export default function handleResponseBody(panel) { err.response = JSON.stringify(resp); throw err; } - const keys = Object.keys(resp.aggregations); + const aggregations = get(resp, 'aggregations'); + if (!aggregations) { + const message = `The aggregations key is missing from the response, + check your permissions for this request.`; + throw Error(message); + } + const keys = Object.keys(aggregations); if (keys.length !== 1) throw Error('There should only be one series per request.'); const seriesId = keys[0]; const series = panel.series.find(s => s.id === seriesId); diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/date_histogram.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/date_histogram.js index 08d51dc05ca7..f64ab9ad5fba 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/date_histogram.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/annotations/date_histogram.js @@ -6,10 +6,12 @@ export default function dateHistogram(req, panel, annotation) { const timeField = annotation.time_field; const { bucketSize, intervalString } = getBucketSize(req, 'auto'); const { from, to } = getTimerange(req); + const { timezone:time_zone } = req.payload.timerange; _.set(doc, `aggs.${annotation.id}.date_histogram`, { field: timeField, interval: intervalString, min_doc_count: 0, + time_zone, extended_bounds: { min: from.valueOf(), max: to.valueOf() - (bucketSize * 1000) diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js index f14f649d4b71..cb0046f6e7ed 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/__tests__/date_histogram.js @@ -11,6 +11,7 @@ describe('dateHistogram(req, panel, series)', () => { req = { payload: { timerange: { + timezone: 'UTC', min: '2017-01-01T00:00:00Z', max: '2017-01-01T01:00:00Z' } @@ -42,6 +43,7 @@ describe('dateHistogram(req, panel, series)', () => { field: '@timestamp', interval: '10s', min_doc_count: 0, + time_zone: 'UTC', extended_bounds: { min: 1483228800000, max: 1483232400000 @@ -67,6 +69,7 @@ describe('dateHistogram(req, panel, series)', () => { field: '@timestamp', interval: '10s', min_doc_count: 0, + time_zone: 'UTC', extended_bounds: { min: 1483225200000, max: 1483228800000 @@ -95,6 +98,7 @@ describe('dateHistogram(req, panel, series)', () => { field: 'timestamp', interval: '20s', min_doc_count: 0, + time_zone: 'UTC', extended_bounds: { min: 1483228800000, max: 1483232400000 diff --git a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js index 2dcac4ce0942..fcbb07a6f273 100644 --- a/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js +++ b/src/core_plugins/metrics/server/lib/vis_data/request_processors/series/date_histogram.js @@ -7,11 +7,13 @@ export default function dateHistogram(req, panel, series) { const { timeField, interval } = getIntervalAndTimefield(panel, series); const { intervalString } = getBucketSize(req, interval); const { from, to } = offsetTime(req, series.offset_time); + const { timezone:time_zone } = req.payload.timerange; set(doc, `aggs.${series.id}.aggs.timeseries.date_histogram`, { field: timeField, interval: intervalString, min_doc_count: 0, + time_zone, extended_bounds: { min: from.valueOf(), max: to.valueOf() diff --git a/src/core_plugins/table_vis/public/table_vis_params.html b/src/core_plugins/table_vis/public/table_vis_params.html index 16c24dc67cf6..662f5c9a77a6 100644 --- a/src/core_plugins/table_vis/public/table_vis_params.html +++ b/src/core_plugins/table_vis/public/table_vis_params.html @@ -1,6 +1,6 @@
- - + +
@@ -32,10 +32,10 @@
- +
diff --git a/src/core_plugins/tile_map/public/editors/tile_map.html b/src/core_plugins/tile_map/public/editors/tile_map.html index 20e940107d85..1aefe62323c5 100644 --- a/src/core_plugins/tile_map/public/editors/tile_map.html +++ b/src/core_plugins/tile_map/public/editors/tile_map.html @@ -1,7 +1,9 @@
- -
- + @@ -58,7 +62,7 @@ Warning - +

@@ -72,6 +76,7 @@

data-test-subj="fieldIncreasePopularityButton" type="button" ng-click="editor.field.count = editor.field.count + 1" - aria-label="Plus" + aria-label="Increment popularity" class="kuiButton kuiButton--basic" >
- + + class="form-control" + >
- + + id="scriptFieldColorPattern" + ng-model="color.regex" + class="form-control" + >
- + + class="form-control" + >
- + + class="form-control" + >
- -
+ +
123456
diff --git a/src/ui/public/field_format_editor/editors/date/date.html b/src/ui/public/field_format_editor/editors/date/date.html index b40adaf006f0..c92565902dff 100644 --- a/src/ui/public/field_format_editor/editors/date/date.html +++ b/src/ui/public/field_format_editor/editors/date/date.html @@ -5,7 +5,7 @@ -

- + - +
- diff --git a/src/core_plugins/kibana/common/field_formats/types/_numeral.js b/src/core_plugins/kibana/common/field_formats/types/_numeral.js index e0665eb45f7e..07722f722ed1 100644 --- a/src/core_plugins/kibana/common/field_formats/types/_numeral.js +++ b/src/core_plugins/kibana/common/field_formats/types/_numeral.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import numeral from '@spalger/numeral'; +import numeral from '@elastic/numeral'; import { FieldFormat } from '../../../../../ui/field_formats/field_format'; const numeralInst = numeral(); diff --git a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js index 8fe4a783050e..876a55c46bfc 100644 --- a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js +++ b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js @@ -27,12 +27,12 @@ export function DashboardListingController($injector, $scope) { const sortableProperties = new SortableProperties([ { name: 'title', - getValue: item => item.title, + getValue: item => item.title.toLowerCase(), isAscending: true, }, { name: 'description', - getValue: item => item.description, + getValue: item => item.description.toLowerCase(), isAscending: true } ], diff --git a/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.js b/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.js index 564d3d0912f6..6cca9f6054a0 100644 --- a/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.js +++ b/src/core_plugins/kibana/public/dashboard/top_nav/clone_modal.js @@ -42,7 +42,7 @@ export class DashboardCloneModal extends React.Component { data-tests-subj="dashboardCloneModal" aria-label="Clone a dashboard" className="dashboardCloneModal" - onKeyDown={ this.onKeyDown } + onKeyDown={this.onKeyDown} > @@ -58,8 +58,8 @@ export class DashboardCloneModal extends React.Component { autoFocus data-test-subj="clonedDashboardTitle" className="kuiTextInput kuiTextInput--large" - value={ this.state.newDashboardName } - onChange={ this.onInputChange } + value={this.state.newDashboardName} + onChange={this.onInputChange} /> @@ -68,14 +68,14 @@ export class DashboardCloneModal extends React.Component { Cancel Confirm Clone diff --git a/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html b/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html index f4d24cf3d2f4..990e5748415e 100644 --- a/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html +++ b/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html @@ -1,4 +1,4 @@ - +
diff --git a/src/core_plugins/kibana/public/management/app.html b/src/core_plugins/kibana/public/management/app.html index 6883679dbb32..034ea014aa01 100644 --- a/src/core_plugins/kibana/public/management/app.html +++ b/src/core_plugins/kibana/public/management/app.html @@ -14,9 +14,9 @@
- +

{{::section.display}} - +

-
+
item.title, + getValue: item => item.title.toLowerCase(), isAscending: true, }, { name: 'type', - getValue: item => item.type.title, + getValue: item => item.type.title.toLowerCase(), isAscending: true, } ], diff --git a/src/core_plugins/metrics/public/components/add_delete_buttons.js b/src/core_plugins/metrics/public/components/add_delete_buttons.js index 38ebfc1bbbec..215a8ed9ffe1 100644 --- a/src/core_plugins/metrics/public/components/add_delete_buttons.js +++ b/src/core_plugins/metrics/public/components/add_delete_buttons.js @@ -8,7 +8,7 @@ function AddDeleteButtons(props) { } return ( - + @@ -20,7 +20,7 @@ function AddDeleteButtons(props) { } return ( - + @@ -32,7 +32,7 @@ function AddDeleteButtons(props) { if (props.onClone && !props.disableAdd) { clone = ( - + diff --git a/src/core_plugins/metrics/public/components/aggs/derivative.js b/src/core_plugins/metrics/public/components/aggs/derivative.js index 7206f33e21c6..03cfd49adf63 100644 --- a/src/core_plugins/metrics/public/components/aggs/derivative.js +++ b/src/core_plugins/metrics/public/components/aggs/derivative.js @@ -1,4 +1,4 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggSelect from './agg_select'; import MetricSelect from './metric_select'; import AggRow from './agg_row'; @@ -6,57 +6,53 @@ import createChangeHandler from '../lib/create_change_handler'; import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; -class DerivativeAgg extends Component { +export const DerivativeAgg = props => { + const { siblings } = props; - render() { - const { siblings } = this.props; + const defaults = { unit: '' }; + const model = { ...defaults, ...props.model }; - const defaults = { unit: '' }; - const model = { ...defaults, ...this.props.model }; + const handleChange = createChangeHandler(props.onChange, model); + const handleSelectChange = createSelectHandler(handleChange); + const handleTextChange = createTextHandler(handleChange); - const handleChange = createChangeHandler(this.props.onChange, model); - const handleSelectChange = createSelectHandler(handleChange); - const handleTextChange = createTextHandler(handleChange); - - return ( - -
-
Aggregation
- -
-
-
Metric
- -
-
-
Units (1s, 1m, etc)
- -
-
- ); - } - -} + return ( + +
+
Aggregation
+ +
+
+
Metric
+ +
+
+
Units (1s, 1m, etc)
+ +
+
+ ); +}; DerivativeAgg.propTypes = { disableDelete: PropTypes.bool, @@ -69,5 +65,3 @@ DerivativeAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default DerivativeAgg; diff --git a/src/core_plugins/metrics/public/components/aggs/filter_ratio.js b/src/core_plugins/metrics/public/components/aggs/filter_ratio.js index 734f8ddb6355..94098e3bd363 100644 --- a/src/core_plugins/metrics/public/components/aggs/filter_ratio.js +++ b/src/core_plugins/metrics/public/components/aggs/filter_ratio.js @@ -1,4 +1,4 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggSelect from './agg_select'; import FieldSelect from './field_select'; import AggRow from './agg_row'; @@ -6,94 +6,90 @@ import createChangeHandler from '../lib/create_change_handler'; import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; -class FilterRatioAgg extends Component { +export const FilterRatioAgg = props => { + const { + series, + fields, + panel + } = props; - render() { - const { - series, - fields, - panel - } = this.props; + const handleChange = createChangeHandler(props.onChange, props.model); + const handleSelectChange = createSelectHandler(handleChange); + const handleTextChange = createTextHandler(handleChange); + const indexPattern = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; - const handleChange = createChangeHandler(this.props.onChange, this.props.model); - const handleSelectChange = createSelectHandler(handleChange); - const handleTextChange = createTextHandler(handleChange); - const indexPattern = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; + const defaults = { + numerator: '*', + denominator: '*', + metric_agg: 'count' + }; - const defaults = { - numerator: '*', - denominator: '*', - metric_agg: 'count' - }; + const model = { ...defaults, ...props.model }; - const model = { ...defaults, ...this.props.model }; - - return ( - -
-
-
-
Aggregation
- -
-
-
Numerator
- -
-
-
Denominator
- -
+ return ( + +
+
+
+
Aggregation
+ +
+
+
Numerator
+
-
+
+
Denominator
+ +
+
+
+
+
Metric Aggregation
+ +
+ { model.metric_agg !== 'count' ? (
-
Metric Aggregation
- Field
+ -
- { model.metric_agg !== 'count' ? ( -
-
Field
- -
) : null } -
+
) : null }
- - ); - } - -} +
+
+ ); +}; FilterRatioAgg.propTypes = { disableDelete: PropTypes.bool, @@ -106,5 +102,3 @@ FilterRatioAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default FilterRatioAgg; diff --git a/src/core_plugins/metrics/public/components/aggs/moving_average.js b/src/core_plugins/metrics/public/components/aggs/moving_average.js index b2c12aa7aa99..4f9ad7bc26dc 100644 --- a/src/core_plugins/metrics/public/components/aggs/moving_average.js +++ b/src/core_plugins/metrics/public/components/aggs/moving_average.js @@ -1,4 +1,4 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggRow from './agg_row'; import AggSelect from './agg_select'; import MetricSelect from './metric_select'; @@ -8,106 +8,103 @@ import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; import createNumberHandler from '../lib/create_number_handler'; -class MovingAverageAgg extends Component { - render() { - const { siblings } = this.props; - const defaults = { - settings: '', - minimize: 0, - window: '', - model: 'simple' - }; - const model = { ...defaults, ...this.props.model }; - const handleChange = createChangeHandler(this.props.onChange, model); - const handleSelectChange = createSelectHandler(handleChange); - const handleTextChange = createTextHandler(handleChange); - const handleNumberChange = createNumberHandler(handleChange); - const modelOptions = [ - { label: 'Simple', value: 'simple' }, - { label: 'Linear', value: 'linear' }, - { label: 'Exponentially Weighted', value: 'ewma' }, - { label: 'Holt-Linear', value: 'holt' }, - { label: 'Holt-Winters', value: 'holt_winters' } - ]; - const minimizeOptions = [ - { label: 'True', value: 1 }, - { label: 'False', value: 0 } - ]; - return ( - -
-
-
-
Aggregation
- -
-
-
Metric
- -
+export const MovingAverageAgg = props => { + const { siblings } = props; + const defaults = { + settings: '', + minimize: 0, + window: '', + model: 'simple' + }; + const model = { ...defaults, ...props.model }; + const handleChange = createChangeHandler(props.onChange, model); + const handleSelectChange = createSelectHandler(handleChange); + const handleTextChange = createTextHandler(handleChange); + const handleNumberChange = createNumberHandler(handleChange); + const modelOptions = [ + { label: 'Simple', value: 'simple' }, + { label: 'Linear', value: 'linear' }, + { label: 'Exponentially Weighted', value: 'ewma' }, + { label: 'Holt-Linear', value: 'holt' }, + { label: 'Holt-Winters', value: 'holt_winters' } + ]; + const minimizeOptions = [ + { label: 'True', value: 1 }, + { label: 'False', value: 0 } + ]; + return ( + +
+
+
+
Aggregation
+
-
-
-
Model
- -
-
-
Minimize
- -
+
+
+
+
Model
+ +
+
+
Minimize
+ +
+
+
+ + ); +}; MovingAverageAgg.propTypes = { disableDelete: PropTypes.bool, @@ -120,5 +117,3 @@ MovingAverageAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default MovingAverageAgg; diff --git a/src/core_plugins/metrics/public/components/aggs/percentile.js b/src/core_plugins/metrics/public/components/aggs/percentile.js index 0573797d0ff4..4bd24b98adae 100644 --- a/src/core_plugins/metrics/public/components/aggs/percentile.js +++ b/src/core_plugins/metrics/public/components/aggs/percentile.js @@ -114,7 +114,7 @@ Percentiles.propTypes = { }; -class PercentileAgg extends Component { +class PercentileAgg extends Component { // eslint-disable-line react/no-multi-comp componentWillMount() { if (!this.props.model.percentiles) { diff --git a/src/core_plugins/metrics/public/components/aggs/percentile_rank.js b/src/core_plugins/metrics/public/components/aggs/percentile_rank.js index e5c32a2c291e..de02f27856b5 100644 --- a/src/core_plugins/metrics/public/components/aggs/percentile_rank.js +++ b/src/core_plugins/metrics/public/components/aggs/percentile_rank.js @@ -1,4 +1,4 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggSelect from './agg_select'; import FieldSelect from './field_select'; import AggRow from './agg_row'; @@ -6,60 +6,55 @@ import createChangeHandler from '../lib/create_change_handler'; import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; -class PercentileRankAgg extends Component { +export const PercentileRankAgg = props => { + const { series, panel, fields } = props; + const defaults = { value: '' }; + const model = { ...defaults, ...props.model }; - render() { - const { series, panel, fields } = this.props; - const defaults = { value: '' }; - const model = { ...defaults, ...this.props.model }; + const handleChange = createChangeHandler(props.onChange, model); + const handleSelectChange = createSelectHandler(handleChange); + const handleTextChange = createTextHandler(handleChange); + const indexPattern = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; - const handleChange = createChangeHandler(this.props.onChange, model); - const handleSelectChange = createSelectHandler(handleChange); - const handleTextChange = createTextHandler(handleChange); - - const indexPattern = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; - - return ( - -
-
Aggregation
- -
-
-
Field
- -
-
-
Value
- -
-
- ); - } - -} + return ( + +
+
Aggregation
+ +
+
+
Field
+ +
+
+
Value
+ +
+
+ ); +}; PercentileRankAgg.propTypes = { disableDelete: PropTypes.bool, @@ -72,6 +67,3 @@ PercentileRankAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default PercentileRankAgg; - diff --git a/src/core_plugins/metrics/public/components/aggs/positive_only.js b/src/core_plugins/metrics/public/components/aggs/positive_only.js index afb243c6effc..543c814a7595 100644 --- a/src/core_plugins/metrics/public/components/aggs/positive_only.js +++ b/src/core_plugins/metrics/public/components/aggs/positive_only.js @@ -1,51 +1,47 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggSelect from './agg_select'; import MetricSelect from './metric_select'; import AggRow from './agg_row'; import createChangeHandler from '../lib/create_change_handler'; import createSelectHandler from '../lib/create_select_handler'; -class PositiveOnlyAgg extends Component { - - render() { - const { siblings } = this.props; - - const defaults = { unit: '' }; - const model = { ...defaults, ...this.props.model }; - - const handleChange = createChangeHandler(this.props.onChange, model); - const handleSelectChange = createSelectHandler(handleChange); - - return ( - -
-
Aggregation
- -
-
-
Metric
- -
-
- ); - } - -} +export const PositiveOnlyAgg = props => { + const { siblings } = props; + + const defaults = { unit: '' }; + const model = { ...defaults, ...props.model }; + + const handleChange = createChangeHandler(props.onChange, model); + const handleSelectChange = createSelectHandler(handleChange); + + return ( + +
+
Aggregation
+ +
+
+
Metric
+ +
+
+ ); +}; PositiveOnlyAgg.propTypes = { disableDelete: PropTypes.bool, @@ -58,5 +54,3 @@ PositiveOnlyAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default PositiveOnlyAgg; diff --git a/src/core_plugins/metrics/public/components/aggs/serial_diff.js b/src/core_plugins/metrics/public/components/aggs/serial_diff.js index 1b102390c80a..33d20a3a1e16 100644 --- a/src/core_plugins/metrics/public/components/aggs/serial_diff.js +++ b/src/core_plugins/metrics/public/components/aggs/serial_diff.js @@ -1,4 +1,4 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggSelect from './agg_select'; import MetricSelect from './metric_select'; import AggRow from './agg_row'; @@ -6,56 +6,52 @@ import createChangeHandler from '../lib/create_change_handler'; import createSelectHandler from '../lib/create_select_handler'; import createNumberHandler from '../lib/create_number_handler'; -class SerialDiffAgg extends Component { +export const SerialDiffAgg = props => { + const { siblings } = props; + const defaults = { lag: '' }; + const model = { ...defaults, ...props.model }; - render() { - const { siblings } = this.props; - const defaults = { lag: '' }; - const model = { ...defaults, ...this.props.model }; + const handleChange = createChangeHandler(props.onChange, model); + const handleSelectChange = createSelectHandler(handleChange); + const handleNumberChange = createNumberHandler(handleChange); - const handleChange = createChangeHandler(this.props.onChange, model); - const handleSelectChange = createSelectHandler(handleChange); - const handleNumberChange = createNumberHandler(handleChange); - - return ( - -
-
Aggregation
- -
-
-
Metric
- -
-
-
Lag
- -
-
- ); - } - -} + return ( + +
+
Aggregation
+ +
+
+
Metric
+ +
+
+
Lag
+ +
+
+ ); +}; SerialDiffAgg.propTypes = { disableDelete: PropTypes.bool, @@ -68,6 +64,3 @@ SerialDiffAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default SerialDiffAgg; - diff --git a/src/core_plugins/metrics/public/components/aggs/static.js b/src/core_plugins/metrics/public/components/aggs/static.js index 7193c0bd8beb..d383eb21f16b 100644 --- a/src/core_plugins/metrics/public/components/aggs/static.js +++ b/src/core_plugins/metrics/public/components/aggs/static.js @@ -1,62 +1,58 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggSelect from './agg_select'; import AggRow from './agg_row'; import createChangeHandler from '../lib/create_change_handler'; import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; -class FilterRatioAgg extends Component { +export const Static = props => { + const handleChange = createChangeHandler(props.onChange, props.model); + const handleSelectChange = createSelectHandler(handleChange); + const handleTextChange = createTextHandler(handleChange); - render() { - const handleChange = createChangeHandler(this.props.onChange, this.props.model); - const handleSelectChange = createSelectHandler(handleChange); - const handleTextChange = createTextHandler(handleChange); + const defaults = { + numerator: '*', + denominator: '*', + metric_agg: 'count' + }; - const defaults = { - numerator: '*', - denominator: '*', - metric_agg: 'count' - }; + const model = { ...defaults, ...props.model }; - const model = { ...defaults, ...this.props.model }; - - return ( - -
-
-
-
Aggregation
- -
-
-
Static Value
- -
+ return ( + +
+
+
+
Aggregation
+ +
+
+
Static Value
+
- - ); - } - -} +
+
+ ); +}; -FilterRatioAgg.propTypes = { +Static.propTypes = { disableDelete: PropTypes.bool, fields: PropTypes.object, model: PropTypes.object, @@ -67,6 +63,3 @@ FilterRatioAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default FilterRatioAgg; - diff --git a/src/core_plugins/metrics/public/components/aggs/std_deviation.js b/src/core_plugins/metrics/public/components/aggs/std_deviation.js index e9b38f4a3c6a..803d0e240e3d 100644 --- a/src/core_plugins/metrics/public/components/aggs/std_deviation.js +++ b/src/core_plugins/metrics/public/components/aggs/std_deviation.js @@ -1,4 +1,4 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import AggSelect from './agg_select'; import FieldSelect from './field_select'; import AggRow from './agg_row'; @@ -7,74 +7,70 @@ import createChangeHandler from '../lib/create_change_handler'; import createSelectHandler from '../lib/create_select_handler'; import createTextHandler from '../lib/create_text_handler'; -class StandardDeviationAgg extends Component { +export const StandardDeviationAgg = props => { + const { series, panel, fields } = props; + const defaults = { sigma: '' }; + const model = { ...defaults, ...props.model }; - render() { - const { series, panel, fields } = this.props; - const defaults = { sigma: '' }; - const model = { ...defaults, ...this.props.model }; + const modeOptions = [ + { label: 'Raw', value: 'raw' }, + { label: 'Upper Bound', value: 'upper' }, + { label: 'Lower Bound', value: 'lower' }, + { label: 'Bounds Band', value: 'band' } + ]; - const modeOptions = [ - { label: 'Raw', value: 'raw' }, - { label: 'Upper Bound', value: 'upper' }, - { label: 'Lower Bound', value: 'lower' }, - { label: 'Bounds Band', value: 'band' } - ]; + const handleChange = createChangeHandler(props.onChange, model); + const handleSelectChange = createSelectHandler(handleChange); + const handleTextChange = createTextHandler(handleChange); - const handleChange = createChangeHandler(this.props.onChange, model); - const handleSelectChange = createSelectHandler(handleChange); - const handleTextChange = createTextHandler(handleChange); + const indexPattern = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; - const indexPattern = series.override_index_pattern && series.series_index_pattern || panel.index_pattern; - - return ( - -
-
Aggregation
- -
-
-
Field
- -
-
-
Sigma
- -
-
-
Mode
- +
+
+
Mode
+ -
- ); - - const modeOptions = [ - { label: 'Raw', value: 'raw' }, - { label: 'Upper Bound', value: 'upper' }, - { label: 'Lower Bound', value: 'lower' }, - { label: 'Bounds Band', value: 'band' } - ]; + const stdDev = {}; + if (model.type === 'std_deviation_bucket') { + stdDev.sigma = ( +
+
Sigma
+ +
+ ); - stdDev.mode = ( -
-
Mode
- +
); } -} + return ( + +
+
Aggregation
+ +
+
+
Metric
+ +
+ { stdDev.sigma } + { stdDev.mode } +
+ ); +}; StandardSiblingAgg.propTypes = { disableDelete: PropTypes.bool, @@ -95,5 +91,3 @@ StandardSiblingAgg.propTypes = { series: PropTypes.object, siblings: PropTypes.array, }; - -export default StandardSiblingAgg; diff --git a/src/core_plugins/metrics/public/components/color_picker.js b/src/core_plugins/metrics/public/components/color_picker.js index 30276b35b51e..01ff23857b54 100644 --- a/src/core_plugins/metrics/public/components/color_picker.js +++ b/src/core_plugins/metrics/public/components/color_picker.js @@ -82,7 +82,7 @@ class ColorPicker extends Component { onClick={this.handleClose} />
diff --git a/src/core_plugins/metrics/public/components/custom_color_picker.js b/src/core_plugins/metrics/public/components/custom_color_picker.js index 382aec8a116a..5f3bd4f81853 100644 --- a/src/core_plugins/metrics/public/components/custom_color_picker.js +++ b/src/core_plugins/metrics/public/components/custom_color_picker.js @@ -66,21 +66,21 @@ export class CustomColorPicker extends Component {
-
-
+
+
-
+
-
+
{ reason }
{ scriptStack.join('\n')}
); - } else { - const reason = _.get(error, 'error.caused_by.reason'); + } else if (reason) { additionalInfo = (
{ reason }
diff --git a/src/core_plugins/metrics/public/components/index_pattern.js b/src/core_plugins/metrics/public/components/index_pattern.js index bd19c53e0b1b..10f9953e56bb 100644 --- a/src/core_plugins/metrics/public/components/index_pattern.js +++ b/src/core_plugins/metrics/public/components/index_pattern.js @@ -1,63 +1,61 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import FieldSelect from './aggs/field_select'; import createSelectHandler from './lib/create_select_handler'; import createTextHandler from './lib/create_text_handler'; import YesNo from './yes_no'; -class IndexPattern extends Component { - render() { - const { fields, prefix } = this.props; - const handleSelectChange = createSelectHandler(this.props.onChange); - const handleTextChange = createTextHandler(this.props.onChange); - const timeFieldName = `${prefix}time_field`; - const indexPatternName = `${prefix}index_pattern`; - const intervalName = `${prefix}interval`; - const dropBucketName = `${prefix}drop_last_bucket`; +export const IndexPattern = props => { + const { fields, prefix } = props; + const handleSelectChange = createSelectHandler(props.onChange); + const handleTextChange = createTextHandler(props.onChange); + const timeFieldName = `${prefix}time_field`; + const indexPatternName = `${prefix}index_pattern`; + const intervalName = `${prefix}interval`; + const dropBucketName = `${prefix}drop_last_bucket`; - const defaults = { - [indexPatternName]: '*', - [intervalName]: 'auto', - [dropBucketName]: 1 - }; + const defaults = { + [indexPatternName]: '*', + [intervalName]: 'auto', + [dropBucketName]: 1 + }; - const model = { ...defaults, ...this.props.model }; - return ( -
-
Index Pattern
- -
Time Field
-
- -
-
Interval (auto, 1m, 1d, 1w, 1y)
- -
Drop Last Bucket
- +
Index Pattern
+ +
Time Field
+
+
- ); - } -} +
Interval (auto, 1m, 1d, 1w, 1y)
+ +
Drop Last Bucket
+ +
+ ); +}; IndexPattern.defaultProps = { prefix: '', @@ -73,5 +71,3 @@ IndexPattern.propTypes = { disabled: PropTypes.bool, className: PropTypes.string }; - -export default IndexPattern; diff --git a/src/core_plugins/metrics/public/components/lib/agg_to_component.js b/src/core_plugins/metrics/public/components/lib/agg_to_component.js index 14a1c7e552cb..9a6b0369b26f 100644 --- a/src/core_plugins/metrics/public/components/lib/agg_to_component.js +++ b/src/core_plugins/metrics/public/components/lib/agg_to_component.js @@ -1,45 +1,45 @@ -import MovingAverage from '../aggs/moving_average'; -import Derivative from '../aggs/derivative'; +import { MovingAverageAgg } from '../aggs/moving_average'; +import { DerivativeAgg } from '../aggs/derivative'; import Calculation from '../aggs/calculation'; import StdAgg from '../aggs/std_agg'; import Percentile from '../aggs/percentile'; import CumulativeSum from '../aggs/cumulative_sum'; -import StdDeviation from '../aggs/std_deviation'; -import StdSibling from '../aggs/std_sibling'; +import { StandardDeviationAgg } from '../aggs/std_deviation'; +import { StandardSiblingAgg } from '../aggs/std_sibling'; import SeriesAgg from '../aggs/series_agg'; -import SerialDiff from '../aggs/serial_diff'; -import PositiveOnly from '../aggs/positive_only'; -import FilterRatio from '../aggs/filter_ratio'; -import PercentileRank from '../aggs/percentile_rank'; -import Static from '../aggs/static'; +import { SerialDiffAgg } from '../aggs/serial_diff'; +import { PositiveOnlyAgg } from '../aggs/positive_only'; +import { FilterRatioAgg } from '../aggs/filter_ratio'; +import { PercentileRankAgg } from '../aggs/percentile_rank'; +import { Static } from '../aggs/static'; export default { count: StdAgg, avg: StdAgg, max: StdAgg, min: StdAgg, sum: StdAgg, - std_deviation: StdDeviation, + std_deviation: StandardDeviationAgg, sum_of_squares: StdAgg, variance: StdAgg, - avg_bucket: StdSibling, - max_bucket: StdSibling, - min_bucket: StdSibling, - sum_bucket: StdSibling, - variance_bucket: StdSibling, - sum_of_squares_bucket: StdSibling, - std_deviation_bucket: StdSibling, + avg_bucket: StandardSiblingAgg, + max_bucket: StandardSiblingAgg, + min_bucket: StandardSiblingAgg, + sum_bucket: StandardSiblingAgg, + variance_bucket: StandardSiblingAgg, + sum_of_squares_bucket: StandardSiblingAgg, + std_deviation_bucket: StandardSiblingAgg, percentile: Percentile, - percentile_rank: PercentileRank, + percentile_rank: PercentileRankAgg, cardinality: StdAgg, value_count: StdAgg, calculation: Calculation, cumulative_sum: CumulativeSum, - moving_average: MovingAverage, - derivative: Derivative, + moving_average: MovingAverageAgg, + derivative: DerivativeAgg, series_agg: SeriesAgg, - serial_diff: SerialDiff, - filter_ratio: FilterRatio, - positive_only: PositiveOnly, + serial_diff: SerialDiffAgg, + filter_ratio: FilterRatioAgg, + positive_only: PositiveOnlyAgg, static: Static }; diff --git a/src/core_plugins/metrics/public/components/lib/tick_formatter.js b/src/core_plugins/metrics/public/components/lib/tick_formatter.js index 5508f162f4c6..dff3a7b6b20f 100644 --- a/src/core_plugins/metrics/public/components/lib/tick_formatter.js +++ b/src/core_plugins/metrics/public/components/lib/tick_formatter.js @@ -1,4 +1,4 @@ -import numeral from '@spalger/numeral'; +import numeral from '@elastic/numeral'; import _ from 'lodash'; import handlebars from 'handlebars/dist/handlebars'; diff --git a/src/core_plugins/metrics/public/components/markdown_editor.js b/src/core_plugins/metrics/public/components/markdown_editor.js index 5d1913b949a1..2b4bc7baac66 100644 --- a/src/core_plugins/metrics/public/components/markdown_editor.js +++ b/src/core_plugins/metrics/public/components/markdown_editor.js @@ -48,7 +48,7 @@ class MarkdownEditor extends Component {
- "{ value }" + “{ value }”
- [ [ "{date}", "{value}" ], ... ] + [ [ “{date}”, “{value}” ], ... ]
- +
@@ -68,7 +73,7 @@

Label Template Help - +

Label Template Help @@ -118,7 +123,11 @@

- +

diff --git a/src/ui/public/field_format_editor/pattern/pattern.html b/src/ui/public/field_format_editor/pattern/pattern.html index 454f49ec03c5..9ad2cd83f045 100644 --- a/src/ui/public/field_format_editor/pattern/pattern.html +++ b/src/ui/public/field_format_editor/pattern/pattern.html @@ -1,11 +1,14 @@ -
- +
+ +
+ + + inputs="inputs"> +
- - - diff --git a/src/ui/public/field_format_editor/pattern/pattern.js b/src/ui/public/field_format_editor/pattern/pattern.js index 8682a8166f4c..adc3aa5030e3 100644 --- a/src/ui/public/field_format_editor/pattern/pattern.js +++ b/src/ui/public/field_format_editor/pattern/pattern.js @@ -7,9 +7,12 @@ uiModules .directive('fieldFormatEditorPattern', function () { return { restrict: 'E', + replace: true, template: patternTemplate, require: ['ngModel', '^fieldEditor'], - scope: true, + scope: { + id: '@' + }, link: function ($scope, $el, attrs, cntrls) { const ngModelCntrl = cntrls[0]; diff --git a/src/ui/public/filter_bar/filter_bar.html b/src/ui/public/filter_bar/filter_bar.html index d1e10b22e318..ca02b34f8f4f 100644 --- a/src/ui/public/filter_bar/filter_bar.html +++ b/src/ui/public/filter_bar/filter_bar.html @@ -1,117 +1,125 @@ -
-
-
    -
  • Apply these filters?
  • -
  • {{ filter.meta.key }}: {{ filter.meta.value }}
  • -
  • Change time to: {{changeTimeFilter.meta.value}}
  • -
  • -
    - +
    +
    + +
      +
    • Apply these filters?
    • +
    • {{ filter.meta.key }}: {{ filter.meta.value }}
    • +
    • Change time to: {{changeTimeFilter.meta.value}}
    • +
    • +
      + - -
      -
    • -
    - -
    - -
    - + +
    +
  • +
+ +