Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Browse files Browse the repository at this point in the history
…plugin/value-suggesions
  • Loading branch information
Liza K committed Oct 3, 2019
2 parents 03cd33c + ab05bbd commit dad955f
Show file tree
Hide file tree
Showing 91 changed files with 6,889 additions and 1,188 deletions.
39 changes: 39 additions & 0 deletions packages/kbn-es-query/src/es_query/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export function buildQueryFromFilters(filters: unknown[], indexPattern: unknown): unknown;
export function buildEsQuery(
indexPattern: unknown,
queries: unknown,
filters: unknown,
config?: {
allowLeadingWildcards: boolean;
queryStringOptions: unknown;
ignoreFilterIfFieldNotInIndex: boolean;
dateFormatTZ?: string | null;
}
): unknown;
export function getEsQueryConfig(config: {
get: (name: string) => unknown;
}): {
allowLeadingWildcards: boolean;
queryStringOptions: unknown;
ignoreFilterIfFieldNotInIndex: boolean;
dateFormatTZ?: string | null;
};
1 change: 1 addition & 0 deletions packages/kbn-es-query/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
* under the License.
*/

export * from './es_query';
export * from './kuery';
export * from './filters';
3 changes: 2 additions & 1 deletion src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

// /// Define plugin function
import { DataPlugin as Plugin, DataSetup } from './plugin';
import { DataPlugin as Plugin, DataSetup, DataStart } from './plugin';

export function plugin() {
return new Plugin();
Expand All @@ -28,6 +28,7 @@ export function plugin() {

/** @public types */
export type DataSetup = DataSetup;
export type DataStart = DataStart;

export { FilterBar, ApplyFiltersPopover } from './filter';
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ export interface SearchBarOwnProps {
showFilterBar?: boolean;
showDatePicker?: boolean;
showAutoRefreshOnly?: boolean;
showSaveQuery?: boolean;

onRefreshChange?: (options: { isPaused: boolean; refreshInterval: number }) => void;
// Query bar - should be in SearchBarInjectedDeps
query?: Query;
// Show when user has privileges to save
showSaveQuery?: boolean;
savedQuery?: SavedQuery;
onQuerySubmit?: (payload: { dateRange: TimeRange; query?: Query }) => void;
// User has saved the current state as a saved query
onSaved?: (savedQuery: SavedQuery) => void;
// User has modified the saved query, your app should persist the update
onSavedQueryUpdated?: (savedQuery: SavedQuery) => void;
// User has cleared the active query, your app should clear the entire query bar
onClearSavedQuery?: () => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
EuiTitle,
EuiFlexGroup,
EuiFlexItem,
EuiSpacer,
EuiBetaBadge,
EuiButtonEmpty
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand All @@ -24,28 +22,9 @@ const TransactionBreakdownHeader: React.FC<{
<EuiFlexItem>
<EuiTitle size="xs">
<h3>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
{i18n.translate('xpack.apm.transactionBreakdown.chartTitle', {
defaultMessage: 'Time spent by span type'
})}
</EuiFlexItem>
<EuiSpacer size="xs" />
<EuiFlexItem grow={false}>
<EuiBetaBadge
label={i18n.translate('xpack.apm.ui.betaBadgeLabel', {
defaultMessage: 'Beta'
})}
tooltipContent={i18n.translate(
'xpack.apm.ui.betaBadgeTooltipTitle',
{
defaultMessage:
'This feature is still in development. If you have feedback, please reach out in our Discuss forum.'
}
)}
/>
</EuiFlexItem>
</EuiFlexGroup>
{i18n.translate('xpack.apm.transactionBreakdown.chartTitle', {
defaultMessage: 'Time spent by span type'
})}
</h3>
</EuiTitle>
</EuiFlexItem>
Expand Down
27 changes: 27 additions & 0 deletions x-pack/legacy/plugins/canvas/i18n/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,33 @@ export const ComponentStrings = {
defaultMessage: 'Closes keyboard shortcuts reference',
}),
},
PageManager: {
getPageNumberAriaLabel: (pageNumber: number) =>
i18n.translate('xpack.canvas.pageManager.pageNumberAriaLabel', {
defaultMessage: 'Load page number {pageNumber}',
values: {
pageNumber,
},
}),
},
PagePreviewPageControls: {
getClonePageAriaLabel: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.clonePageAriaLabel', {
defaultMessage: 'Clone page',
}),
getClonePageTooltip: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.clonePageTooltip', {
defaultMessage: 'Clone',
}),
getDeletePageAriaLabel: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.deletePageAriaLabel', {
defaultMessage: 'Delete page',
}),
getDeletePageTooltip: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.deletePageTooltip', {
defaultMessage: 'Delete',
}),
},
Toolbar: {
getEditorButtonLabel: () =>
i18n.translate('xpack.canvas.toolbar.editorButtonLabel', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { ConfirmModal } from '../confirm_modal';
import { Link } from '../link';
import { PagePreview } from '../page_preview';

import { ComponentStrings } from '../../../i18n';

const { PageManager: strings } = ComponentStrings;

export class PageManager extends React.PureComponent {
static propTypes = {
isWriteable: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -154,7 +158,7 @@ export class PageManager extends React.PureComponent {
<Link
name="loadWorkpad"
params={{ id: workpadId, page: pageNumber }}
aria-label={`Load page number ${pageNumber}`}
aria-label={strings.getPageNumberAriaLabel(pageNumber)}
>
{Style.it(
workpadCSS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import React from 'react';
import PropTypes from 'prop-types';
import { EuiFlexGroup, EuiFlexItem, EuiButtonIcon, EuiToolTip } from '@elastic/eui';

import { ComponentStrings } from '../../../i18n';

const { PagePreviewPageControls: strings } = ComponentStrings;

export const PageControls = ({ pageId, onDelete, onDuplicate }) => {
const handleDuplicate = ev => {
ev.preventDefault();
Expand All @@ -26,16 +30,20 @@ export const PageControls = ({ pageId, onDelete, onDuplicate }) => {
justifyContent="spaceBetween"
>
<EuiFlexItem grow={false}>
<EuiToolTip content="Clone">
<EuiButtonIcon iconType="copy" aria-label="Clone page" onClick={handleDuplicate} />
<EuiToolTip content={strings.getClonePageTooltip()}>
<EuiButtonIcon
iconType="copy"
aria-label={strings.getClonePageAriaLabel()}
onClick={handleDuplicate}
/>
</EuiToolTip>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiToolTip content="Delete">
<EuiToolTip content={strings.getDeletePageTooltip()}>
<EuiButtonIcon
color="danger"
iconType="trash"
aria-label="Delete Page"
aria-label={strings.getDeletePageAriaLabel()}
onClick={handleDelete}
/>
</EuiToolTip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@

import * as rt from 'io-ts';

import {
badRequestErrorRT,
conflictErrorRT,
forbiddenErrorRT,
metricStatisticsRT,
timeRangeRT,
} from '../../shared';
import { badRequestErrorRT, conflictErrorRT, forbiddenErrorRT, timeRangeRT } from '../../shared';

export const LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH =
'/api/infra/log_analysis/results/log_entry_rate';
Expand Down Expand Up @@ -43,12 +37,15 @@ export const logEntryRateAnomaly = rt.type({
typicalLogEntryRate: rt.number,
});

export const logEntryRateHistogramBucket = rt.type({
export const logEntryRateDataSetRT = rt.type({
analysisBucketCount: rt.number,
anomalies: rt.array(logEntryRateAnomaly),
duration: rt.number,
logEntryRateStats: metricStatisticsRT,
modelLowerBoundStats: metricStatisticsRT,
modelUpperBoundStats: metricStatisticsRT,
averageActualLogEntryRate: rt.number,
dataSetId: rt.string,
});

export const logEntryRateHistogramBucket = rt.type({
dataSets: rt.array(logEntryRateDataSetRT),
startTime: rt.number,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { fold } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';
import { identity } from 'fp-ts/lib/function';
import { kfetch } from 'ui/kfetch';

import {
getLogEntryRateRequestPayloadRT,
getLogEntryRateSuccessReponsePayloadRT,
LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH,
} from '../../../../../common/http_api/log_analysis';
import { createPlainError, throwErrors } from '../../../../../common/runtime_types';

export const callGetLogEntryRateAPI = async (
sourceId: string,
startTime: number,
endTime: number,
bucketDuration: number
) => {
const response = await kfetch({
method: 'POST',
pathname: LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH,
body: JSON.stringify(
getLogEntryRateRequestPayloadRT.encode({
data: {
sourceId,
timeRange: {
startTime,
endTime,
},
bucketDuration,
},
})
),
});
return pipe(
getLogEntryRateSuccessReponsePayloadRT.decode(response),
fold(throwErrors(createPlainError), identity)
);
};

This file was deleted.

Loading

0 comments on commit dad955f

Please sign in to comment.