Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into lens/click-telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
wylieconlon committed Oct 15, 2019
2 parents 4da50b3 + 2c02458 commit b5d54a7
Show file tree
Hide file tree
Showing 386 changed files with 5,119 additions and 4,109 deletions.
2 changes: 1 addition & 1 deletion docs/developer/core/development-elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Kibana exposes two clients on the server and browser for communicating with elasticsearch.
There is an 'admin' client which is used for managing Kibana's state, and a 'data' client for all
other requests. The clients use the {client-ref}/javascript-api/current/index.html[elasticsearch.js library].
other requests. The clients use the {jsclient}/javascript-api/current/index.html[elasticsearch.js library].

[float]
[[client-server]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import React, { useState, useEffect } from 'react';

import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiLink, EuiSuperDatePicker } from '@elastic/eui';
// @ts-ignore
import { EuiSuperUpdateButton } from '@elastic/eui';
import { EuiSuperUpdateButton, OnRefreshProps } from '@elastic/eui';
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import { Toast } from 'src/core/public';
import { TimeRange } from 'src/plugins/data/public';
Expand All @@ -41,10 +41,12 @@ interface Props {
query?: Query;
onSubmit: (payload: { dateRange: TimeRange; query?: Query }) => void;
onChange: (payload: { dateRange: TimeRange; query?: Query }) => void;
onRefresh?: (payload: { dateRange: TimeRange }) => void;
disableAutoFocus?: boolean;
screenTitle?: string;
indexPatterns?: Array<IndexPattern | string>;
intl: InjectedIntl;
isLoading?: boolean;
prepend?: React.ReactNode;
showQueryInput?: boolean;
showDatePicker?: boolean;
Expand Down Expand Up @@ -125,6 +127,18 @@ function QueryBarTopRowUI(props: Props) {
}
}

function onRefresh({ start, end }: OnRefreshProps) {
const retVal = {
dateRange: {
from: start,
to: end,
},
};
if (props.onRefresh) {
props.onRefresh(retVal);
}
}

function onSubmit({ query, dateRange }: { query?: Query; dateRange: TimeRange }) {
handleLuceneSyntaxWarning();

Expand Down Expand Up @@ -175,6 +189,7 @@ function QueryBarTopRowUI(props: Props) {
<EuiSuperUpdateButton
needsUpdate={props.isDirty}
isDisabled={isDateRangeInvalid}
isLoading={props.isLoading}
onClick={onClickSubmitButton}
data-test-subj="querySubmitButton"
/>
Expand Down Expand Up @@ -227,6 +242,7 @@ function QueryBarTopRowUI(props: Props) {
isPaused={props.isRefreshPaused}
refreshInterval={props.refreshInterval}
onTimeChange={onTimeChange}
onRefresh={onRefresh}
onRefreshChange={props.onRefreshChange}
showUpdateButton={false}
recentlyUsedRanges={recentlyUsedRanges}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* under the License.
*/

import React from 'react';
import React, { useState, useEffect } from 'react';
import { Subscription } from 'rxjs';
import { Filter } from '@kbn/es-query';
import { CoreStart } from 'src/core/public';
import { DataPublicPluginStart } from 'src/plugins/data/public';
Expand Down Expand Up @@ -64,8 +65,48 @@ export function createSearchBar({
// App name should come from the core application service.
// Until it's available, we'll ask the user to provide it for the pre-wired component.
return (props: StatetfulSearchBarProps) => {
const tfRefreshInterval = timefilter.timefilter.getRefreshInterval();
const fmFilters = filterManager.getFilters();
const [refreshInterval, setRefreshInterval] = useState(tfRefreshInterval.value);
const [refreshPaused, setRefreshPaused] = useState(tfRefreshInterval.pause);

const [filters, setFilters] = useState(fmFilters);

// We do not really need to keep track of the time
// since this is just for initialization
const timeRange = timefilter.timefilter.getTime();
const refreshInterval = timefilter.timefilter.getRefreshInterval();

useEffect(() => {
let isSubscribed = true;
const subscriptions = new Subscription();
subscriptions.add(
timefilter.timefilter.getRefreshIntervalUpdate$().subscribe({
next: () => {
if (isSubscribed) {
const newRefreshInterval = timefilter.timefilter.getRefreshInterval();
setRefreshInterval(newRefreshInterval.value);
setRefreshPaused(newRefreshInterval.pause);
}
},
})
);

subscriptions.add(
filterManager.getUpdates$().subscribe({
next: () => {
if (isSubscribed) {
const newFilters = filterManager.getFilters();
setFilters(newFilters);
}
},
})
);

return () => {
isSubscribed = false;
subscriptions.unsubscribe();
};
}, []);

return (
<KibanaContextProvider
Expand All @@ -80,9 +121,9 @@ export function createSearchBar({
timeHistory={timefilter.history}
dateRangeFrom={timeRange.from}
dateRangeTo={timeRange.to}
refreshInterval={refreshInterval.value}
isRefreshPaused={refreshInterval.pause}
filters={filterManager.getFilters()}
refreshInterval={refreshInterval}
isRefreshPaused={refreshPaused}
filters={filters}
onFiltersUpdated={defaultFiltersUpdated(filterManager)}
onRefreshChange={defaultOnRefreshChange(timefilter)}
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ interface SearchBarInjectedDeps {

export interface SearchBarOwnProps {
indexPatterns?: IndexPattern[];
isLoading?: boolean;
customSubmitButton?: React.ReactNode;
screenTitle?: string;

Expand All @@ -79,6 +80,8 @@ export interface SearchBarOwnProps {
onSavedQueryUpdated?: (savedQuery: SavedQuery) => void;
// User has cleared the active query, your app should clear the entire query bar
onClearSavedQuery?: () => void;

onRefresh?: (payload: { dateRange: TimeRange }) => void;
}

export type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps;
Expand Down Expand Up @@ -377,6 +380,7 @@ class SearchBarUI extends Component<SearchBarProps, State> {
screenTitle={this.props.screenTitle}
onSubmit={this.onQueryBarSubmit}
indexPatterns={this.props.indexPatterns}
isLoading={this.props.isLoading}
prepend={this.props.showFilterBar ? savedQueryManagement : undefined}
showDatePicker={this.props.showDatePicker}
dateRangeFrom={this.state.dateRangeFrom}
Expand All @@ -385,6 +389,7 @@ class SearchBarUI extends Component<SearchBarProps, State> {
refreshInterval={this.props.refreshInterval}
showAutoRefreshOnly={this.props.showAutoRefreshOnly}
showQueryInput={this.props.showQueryInput}
onRefresh={this.props.onRefresh}
onRefreshChange={this.props.onRefreshChange}
onChange={this.onQueryBarChange}
isDirty={this.isDirty()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Query } from '../../query/query_bar';

export * from './components';

type SavedQueryTimeFilter = TimeRange & {
export type SavedQueryTimeFilter = TimeRange & {
refreshInterval: RefreshInterval;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { applyElementStrings } from '../strings';
import { applyElementStrings } from '../../i18n/elements';
import { areaChart } from './area_chart';
import { bubbleChart } from './bubble_chart';
import { debug } from './debug';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { Datatable } from '../../../types';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

const noop = () => {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
// @ts-ignore untyped local
import { Handlebars } from '../../../common/lib/handlebars';
import { Datatable, Render, Style } from '../../../types';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

type Context = Datatable | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { parse } from 'url';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

interface Arguments {
param: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import { compare } from '../compare';
import { functionWrapper } from '../../../../__tests__/helpers/function_wrapper';
import { getFunctionErrors } from '../../../strings';
import { getFunctionErrors } from '../../../../i18n';

const errors = getFunctionErrors().compare;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import { progress } from '../progress';
import { functionWrapper } from '../../../../__tests__/helpers/function_wrapper';
import { getFunctionErrors } from '../../../strings';
import { getFunctionErrors } from '../../../../i18n';
import { fontStyle } from './fixtures/test_styles';

const errors = getFunctionErrors().progress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

interface Arguments {
condition: boolean[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
import { getFunctionErrors } from '../../strings';
import { getFunctionErrors } from '../../../i18n';
import { emptyTable, testTable } from './__tests__/fixtures/test_tables';
import { alterColumn } from './alterColumn';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { omit } from 'lodash';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { Datatable, DatatableColumn, DatatableColumnType } from '../../../types';
import { getFunctionHelp, getFunctionErrors } from '../../strings';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

interface Arguments {
column: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

interface Arguments {
condition: boolean[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { getType } from '@kbn/interpreter/common';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { Datatable } from '../../../types';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

interface Arguments {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import moment from 'moment';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { Position } from '../../../types';
import { getFunctionHelp, getFunctionErrors } from '../../strings';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

interface Arguments {
show: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
import { getFunctionErrors } from '../../strings';
import { getFunctionErrors } from '../../../i18n';
import { testTable } from './__tests__/fixtures/test_tables';
import { axisConfig } from './axisConfig';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

interface Arguments {
when: () => any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

export function clear(): ExpressionFunction<'clear', any, {}, null> {
const { help } = getFunctionHelp().clear;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { omit, pick, find } from 'lodash';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { Datatable, DatatableColumn } from '../../../types';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

interface Arguments {
include: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp, getFunctionErrors } from '../../strings';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

export enum Operation {
EQ = 'eq',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { ContainerStyle, Overflow, BackgroundRepeat, BackgroundSize } from '../../../types';
import { getFunctionHelp, getFunctionErrors } from '../../strings';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';
// @ts-ignore untyped local
import { isValidUrl } from '../../../common/lib/url';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
import { elasticLogo } from '../../lib/elastic_logo';
import { getFunctionErrors } from '../../strings';
import { getFunctionErrors } from '../../../i18n';
import { containerStyle } from './containerStyle';

const errors = getFunctionErrors().containerStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp } from '../../strings';
import { getFunctionHelp } from '../../../i18n';

export function context(): ExpressionFunction<'context', any, {}, any> {
const { help } = getFunctionHelp().context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
import { getFunctionErrors } from '../../strings';
import { getFunctionErrors } from '../../../i18n';
import { csv } from './csv';

const errors = getFunctionErrors().csv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Papa from 'papaparse';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { Datatable } from '../../../types';
import { getFunctionHelp, getFunctionErrors } from '../../strings';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

interface Arguments {
data: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import sinon from 'sinon';
import { functionWrapper } from '../../../__tests__/helpers/function_wrapper';
import { getFunctionErrors } from '../../strings';
import { getFunctionErrors } from '../../../i18n';
import { date } from './date';

const errors = getFunctionErrors().date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import moment from 'moment';
import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/public';
import { getFunctionHelp, getFunctionErrors } from '../../strings';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

interface Arguments {
value: string;
Expand Down
Loading

0 comments on commit b5d54a7

Please sign in to comment.