diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index 24f47d70b46cb..bb51ca2c8b0b0 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -285,7 +285,7 @@ function discoverController( // searchSource which applies time range const timeRangeSearchSource = savedSearch.searchSource.create(); timeRangeSearchSource.setField('filter', () => { - return timefilter.createFilter($scope.indexPattern); + return isDefaultTypeIndexPattern($scope.indexPattern) && timefilter.createFilter($scope.indexPattern); }); $scope.searchSource.setParent(timeRangeSearchSource); @@ -391,7 +391,7 @@ function discoverController( $scope.opts = { // number of records to fetch, then paginate through sampleSize: config.get('discover:sampleSize'), - timefield: $scope.indexPattern.timeFieldName, + timefield: isDefaultTypeIndexPattern($scope.indexPattern) && $scope.indexPattern.timeFieldName, savedSearch: savedSearch, indexPatternList: $route.current.locals.ip.list, }; diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js index f1d52ec44d8d7..fabe183099583 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.js @@ -27,7 +27,7 @@ import uiRoutes from 'ui/routes'; import { uiModules } from 'ui/modules'; import template from './edit_index_pattern.html'; import { FieldWildcardProvider } from 'ui/field_wildcard'; -import { IndexPatternListFactory } from 'ui/management'; +import { IndexPatternListFactory } from 'ui/management/index_pattern_list'; import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { SourceFiltersTable } from './source_filters_table'; @@ -201,7 +201,7 @@ uiModules.get('apps/management') }); $scope.$watch('indexPattern.fields', function () { - $scope.editSections = $scope.editSectionsProvider($scope.indexPattern); + $scope.editSections = $scope.editSectionsProvider($scope.indexPattern, indexPatternListProvider); $scope.refreshFilters(); $scope.fields = $scope.indexPattern.getNonScriptedFields(); updateIndexedFieldsTable($scope, $state); diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_sections.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_sections.js index 20a8e49c7eee2..c7f53096bfa6e 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_sections.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_sections.js @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; export function IndicesEditSectionsProvider() { - return function (indexPattern) { + return function (indexPattern, indexPatternListProvider) { const fieldCount = _.countBy(indexPattern.fields, function (field) { return (field.scripted) ? 'scripted' : 'indexed'; }); @@ -33,22 +33,28 @@ export function IndicesEditSectionsProvider() { sourceFilters: indexPattern.sourceFilters ? indexPattern.sourceFilters.length : 0, }); - return [ - { - title: i18n.translate('kbn.management.editIndexPattern.tabs.fieldsHeader', { defaultMessage: 'Fields' }), - index: 'indexedFields', - count: fieldCount.indexed - }, - { + const editSections = []; + + editSections.push({ + title: i18n.translate('kbn.management.editIndexPattern.tabs.fieldsHeader', { defaultMessage: 'Fields' }), + index: 'indexedFields', + count: fieldCount.indexed + }); + + if(indexPatternListProvider.areScriptedFieldsEnabled(indexPattern)) { + editSections.push({ title: i18n.translate('kbn.management.editIndexPattern.tabs.scriptedHeader', { defaultMessage: 'Scripted fields' }), index: 'scriptedFields', count: fieldCount.scripted - }, - { - title: i18n.translate('kbn.management.editIndexPattern.tabs.sourceHeader', { defaultMessage: 'Source filters' }), - index: 'sourceFilters', - count: fieldCount.sourceFilters - } - ]; + }); + } + + editSections.push({ + title: i18n.translate('kbn.management.editIndexPattern.tabs.sourceHeader', { defaultMessage: 'Source filters' }), + index: 'sourceFilters', + count: fieldCount.sourceFilters + }); + + return editSections; }; } diff --git a/src/core_plugins/kibana/public/management/sections/indices/index.js b/src/core_plugins/kibana/public/management/sections/indices/index.js index c8793c7842f17..cc16fa4b24931 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index.js @@ -17,7 +17,8 @@ * under the License. */ -import { management, IndexPatternListFactory } from 'ui/management'; +import { management } from 'ui/management'; +import { IndexPatternListFactory } from 'ui/management/index_pattern_list'; import { IndexPatternCreationFactory } from 'ui/management/index_pattern_creation'; import './create_index_pattern_wizard'; import './edit_index_pattern'; @@ -126,7 +127,7 @@ uiModules.get('apps/management') return 1; } return 0; - }); + }) || []; updateIndexPatternList($scope, indexPatternCreationOptions, $scope.defaultIndex, $scope.indexPatternList); }; diff --git a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js index a50927dd8c3d7..30c4c6fddead0 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js @@ -23,16 +23,18 @@ import PropTypes from 'prop-types'; import { EuiButtonEmpty, EuiBadge, + EuiCallOut, } from '@elastic/eui'; export class List extends Component { static propTypes = { indexPatterns: PropTypes.array, + defaultIndex: PropTypes.string, } - render() { + renderList() { const { indexPatterns } = this.props; - return ( + return indexPatterns && indexPatterns.length ? (
{ indexPatterns.map(pattern => { @@ -51,6 +53,29 @@ export class List extends Component { }) }
+ ) : null; + } + + renderNoDefaultMessage() { + const { defaultIndex } = this.props; + return !defaultIndex ? ( +
+ +
+ ) : null; + } + + render() { + return ( +
+ {this.renderNoDefaultMessage()} + {this.renderList()} +
); } } diff --git a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/index_pattern_list.js b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/index_pattern_list.js index 831b357512516..5c91a359cce9c 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/index_pattern_list.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/index_pattern_list.js @@ -17,29 +17,20 @@ * under the License. */ -import React, { Component, Fragment } from 'react'; -import PropTypes from 'prop-types'; +import React, { Fragment } from 'react'; import { Header } from './components/header'; import { List } from './components/list'; -export class IndexPatternList extends Component { - static propTypes = { - indexPatternCreationOptions: PropTypes.array.isRequired, - defaultIndex: PropTypes.string, - indexPatterns: PropTypes.array.isRequired, - } - - render() { - const { indexPatterns, indexPatternCreationOptions } = this.props; - - return( - -
-
-
- -
- ); - } -} +export const IndexPatternList = ({ + indexPatternCreationOptions, + defaultIndex, + indexPatterns +}) => ( + +
+
+
+ +
+); diff --git a/src/ui/public/agg_types/buckets/histogram.js b/src/ui/public/agg_types/buckets/histogram.js index 4bdf474602d90..5772218ce53be 100644 --- a/src/ui/public/agg_types/buckets/histogram.js +++ b/src/ui/public/agg_types/buckets/histogram.js @@ -19,6 +19,7 @@ import _ from 'lodash'; +import { toastNotifications } from 'ui/notify'; import '../../validate_date_interval'; import chrome from '../../chrome'; import { BucketAggType } from './_bucket_agg_type'; @@ -95,6 +96,12 @@ export const histogramBucketAgg = new BucketAggType({ min: _.get(resp, 'aggregations.minAgg.value'), max: _.get(resp, 'aggregations.maxAgg.value') }); + }) + .catch(() => { + toastNotifications.addWarning(` + Unable to retrieve max and min values to auto-scale histogram buckets. + This may lead to poor visualization performance. + `); }); }, write: function (aggConfig, output) { diff --git a/src/ui/public/agg_types/controls/order_and_size.html b/src/ui/public/agg_types/controls/order_and_size.html index 6a5626b3e140e..0daee545ea149 100644 --- a/src/ui/public/agg_types/controls/order_and_size.html +++ b/src/ui/public/agg_types/controls/order_and_size.html @@ -1,6 +1,6 @@
-
+