mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
- Layout and message fixes for displaying error messages for the pivot preview in `ml/public/data_frame/components/define_pivot/pivot_preview.tsx - Fixes list of available date field aggregations. - Fix to make sure datepicker is always disabled for pivot wizard. - Fixes incomplete job delete confirm modal message.
This commit is contained in:
parent
5250bab872
commit
93c333cc17
4 changed files with 48 additions and 13 deletions
|
@ -32,11 +32,8 @@ export const pivotAggsFieldSupport = {
|
|||
[KBN_FIELD_TYPES.ATTACHMENT]: [PIVOT_SUPPORTED_AGGS.VALUE_COUNT],
|
||||
[KBN_FIELD_TYPES.BOOLEAN]: [PIVOT_SUPPORTED_AGGS.VALUE_COUNT],
|
||||
[KBN_FIELD_TYPES.DATE]: [
|
||||
PIVOT_SUPPORTED_AGGS.AVG,
|
||||
PIVOT_SUPPORTED_AGGS.CARDINALITY,
|
||||
PIVOT_SUPPORTED_AGGS.MAX,
|
||||
PIVOT_SUPPORTED_AGGS.MIN,
|
||||
PIVOT_SUPPORTED_AGGS.SUM,
|
||||
PIVOT_SUPPORTED_AGGS.VALUE_COUNT,
|
||||
],
|
||||
[KBN_FIELD_TYPES.GEO_POINT]: [PIVOT_SUPPORTED_AGGS.VALUE_COUNT],
|
||||
|
|
|
@ -18,6 +18,7 @@ import {
|
|||
EuiInMemoryTableProps,
|
||||
EuiPanel,
|
||||
EuiProgress,
|
||||
EuiText,
|
||||
EuiTitle,
|
||||
SortDirection,
|
||||
} from '@elastic/eui';
|
||||
|
@ -104,6 +105,29 @@ const PreviewTitle: SFC<PreviewTitleProps> = ({ previewRequest }) => {
|
|||
);
|
||||
};
|
||||
|
||||
interface ErrorMessageProps {
|
||||
message: string;
|
||||
}
|
||||
|
||||
const ErrorMessage: SFC<ErrorMessageProps> = ({ message }) => {
|
||||
const error = JSON.parse(message);
|
||||
|
||||
const statusCodeLabel = i18n.translate('xpack.ml.dataframe.pivotPreview.statusCodeLabel', {
|
||||
defaultMessage: 'Status code',
|
||||
});
|
||||
|
||||
return (
|
||||
<EuiText size="xs">
|
||||
<pre>
|
||||
{(error.message &&
|
||||
error.statusCode &&
|
||||
`${statusCodeLabel}: ${error.statusCode}\n${error.message}`) ||
|
||||
message}
|
||||
</pre>
|
||||
</EuiText>
|
||||
);
|
||||
};
|
||||
|
||||
interface PivotPreviewProps {
|
||||
aggs: PivotAggsConfigDict;
|
||||
groupBy: PivotGroupByConfigDict;
|
||||
|
@ -167,13 +191,30 @@ export const PivotPreview: SFC<PivotPreviewProps> = React.memo(({ aggs, groupBy,
|
|||
color="danger"
|
||||
iconType="cross"
|
||||
>
|
||||
<p>{errorMessage}</p>
|
||||
<ErrorMessage message={errorMessage} />
|
||||
</EuiCallOut>
|
||||
</EuiPanel>
|
||||
);
|
||||
}
|
||||
|
||||
if (dataFramePreviewData.length === 0) {
|
||||
let noDataMessage = i18n.translate(
|
||||
'xpack.ml.dataframe.pivotPreview.dataFramePivotPreviewNoDataCalloutBody',
|
||||
{
|
||||
defaultMessage:
|
||||
'The preview request did not return any data. Please ensure the optional query returns data and that values exist for the field used by group-by and aggregation fields.',
|
||||
}
|
||||
);
|
||||
|
||||
const aggsArr = dictionaryToArray(aggs);
|
||||
if (aggsArr.length === 0 || groupByArr.length === 0) {
|
||||
noDataMessage = i18n.translate(
|
||||
'xpack.ml.dataframe.pivotPreview.dataFramePivotPreviewIncompleteConfigCalloutBody',
|
||||
{
|
||||
defaultMessage: 'Please choose at least one group-by field and aggregation.',
|
||||
}
|
||||
);
|
||||
}
|
||||
return (
|
||||
<EuiPanel grow={false}>
|
||||
<PreviewTitle previewRequest={previewRequest} />
|
||||
|
@ -186,14 +227,7 @@ export const PivotPreview: SFC<PivotPreviewProps> = React.memo(({ aggs, groupBy,
|
|||
)}
|
||||
color="primary"
|
||||
>
|
||||
<p>
|
||||
{i18n.translate(
|
||||
'xpack.ml.dataframe.pivotPreview.dataFramePivotPreviewNoDataCalloutBody',
|
||||
{
|
||||
defaultMessage: 'Please choose at least one group-by field and aggregation.',
|
||||
}
|
||||
)}
|
||||
</p>
|
||||
<p>{noDataMessage}</p>
|
||||
</EuiCallOut>
|
||||
</EuiPanel>
|
||||
);
|
||||
|
|
|
@ -14,6 +14,7 @@ const module = uiModules.get('apps/ml', ['react']);
|
|||
import { IndexPattern } from 'ui/index_patterns';
|
||||
import { I18nContext } from 'ui/i18n';
|
||||
import { IPrivate } from 'ui/private';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
import { InjectorService } from '../../../../common/types/angular';
|
||||
|
||||
// @ts-ignore
|
||||
|
@ -38,6 +39,9 @@ module.directive('mlNewDataFrame', ($injector: InjectorService) => {
|
|||
const kibanaConfig = $injector.get('config');
|
||||
const Private: IPrivate = $injector.get('Private');
|
||||
|
||||
timefilter.disableTimeRangeSelector();
|
||||
timefilter.disableAutoRefreshSelector();
|
||||
|
||||
const createSearchItems: CreateSearchItems = Private(SearchItemsProvider);
|
||||
const { indexPattern, savedSearch, combinedQuery } = createSearchItems();
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ export const DeleteAction: SFC<DeleteActionProps> = ({ deleteJob, item }) => {
|
|||
>
|
||||
<p>
|
||||
{i18n.translate('xpack.ml.dataframe.jobsList.deleteModalBody', {
|
||||
defaultMessage: 'Are you sure you want to delete this job?',
|
||||
defaultMessage: `Are you sure you want to delete this job? The job's target index and optional Kibana index pattern will not be deleted.`,
|
||||
})}
|
||||
</p>
|
||||
</EuiConfirmModal>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue