Remove left over "refresh index pattern" message from Discover (#85018)

* Remove the unmapped field refresh warning

* Remove unneeded translations

* Remove old imports
This commit is contained in:
Tim Roes 2020-12-05 10:43:09 +01:00 committed by GitHub
parent aa2525c842
commit 2f327543c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 73 deletions

View file

@ -174,18 +174,6 @@ describe('DocViewTable at Discover', () => {
});
}
});
(['noMappingWarning'] as const).forEach((element) => {
const elementExist = check[element];
if (typeof elementExist === 'boolean') {
const el = findTestSubject(rowComponent, element);
it(`renders ${element} for '${check._property}' correctly`, () => {
expect(el.length).toBe(elementExist ? 1 : 0);
});
}
});
});
});

View file

@ -19,7 +19,7 @@
import React, { useState } from 'react';
import { escapeRegExp } from 'lodash';
import { DocViewTableRow } from './table_row';
import { arrayContainsObjects, trimAngularSpan } from './table_helper';
import { trimAngularSpan } from './table_helper';
import { DocViewRenderProps } from '../../doc_views/doc_views_types';
const COLLAPSE_LINE_LENGTH = 350;
@ -72,11 +72,7 @@ export function DocViewTable({
}
}
: undefined;
const isArrayOfObjects =
Array.isArray(flattened[field]) && arrayContainsObjects(flattened[field]);
const displayUnderscoreWarning = !mapping(field) && field.indexOf('_') === 0;
const displayNoMappingWarning =
!mapping(field) && !displayUnderscoreWarning && !isArrayOfObjects;
// Discover doesn't flatten arrays of objects, so for documents with an `object` or `nested` field that
// contains an array, Discover will only detect the top level root field. We want to detect when those
@ -128,7 +124,6 @@ export function DocViewTable({
fieldMapping={mapping(field)}
fieldType={String(fieldType)}
displayUnderscoreWarning={displayUnderscoreWarning}
displayNoMappingWarning={displayNoMappingWarning}
isCollapsed={isCollapsed}
isCollapsible={isCollapsible}
isColumnActive={Array.isArray(columns) && columns.includes(field)}

View file

@ -24,7 +24,6 @@ import { DocViewTableRowBtnFilterRemove } from './table_row_btn_filter_remove';
import { DocViewTableRowBtnToggleColumn } from './table_row_btn_toggle_column';
import { DocViewTableRowBtnCollapse } from './table_row_btn_collapse';
import { DocViewTableRowBtnFilterExists } from './table_row_btn_filter_exists';
import { DocViewTableRowIconNoMapping } from './table_row_icon_no_mapping';
import { DocViewTableRowIconUnderscore } from './table_row_icon_underscore';
import { FieldName } from '../field_name/field_name';
@ -32,7 +31,6 @@ export interface Props {
field: string;
fieldMapping?: FieldMapping;
fieldType: string;
displayNoMappingWarning: boolean;
displayUnderscoreWarning: boolean;
isCollapsible: boolean;
isColumnActive: boolean;
@ -48,7 +46,6 @@ export function DocViewTableRow({
field,
fieldMapping,
fieldType,
displayNoMappingWarning,
displayUnderscoreWarning,
isCollapsible,
isCollapsed,
@ -80,7 +77,6 @@ export function DocViewTableRow({
<DocViewTableRowBtnCollapse onClick={onToggleCollapse} isCollapsed={isCollapsed} />
)}
{displayUnderscoreWarning && <DocViewTableRowIconUnderscore />}
{displayNoMappingWarning && <DocViewTableRowIconNoMapping />}
<div
className={valueClassName}
data-test-subj={`tableDocViewRow-${field}-value`}

View file

@ -1,47 +0,0 @@
/*
* 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.
*/
import React from 'react';
import { EuiIconTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
export function DocViewTableRowIconNoMapping() {
const ariaLabel = i18n.translate('discover.docViews.table.noCachedMappingForThisFieldAriaLabel', {
defaultMessage: 'Warning',
});
const tooltipContent = i18n.translate(
'discover.docViews.table.noCachedMappingForThisFieldTooltip',
{
defaultMessage:
'No cached mapping for this field. Refresh field list from the Management > Index Patterns page',
}
);
return (
<EuiIconTip
aria-label={ariaLabel}
color="warning"
content={tooltipContent}
iconProps={{
className: 'kbnDocViewer__warning',
'data-test-subj': 'noMappingWarning',
}}
size="s"
type="alert"
/>
);
}

View file

@ -1459,8 +1459,6 @@
"discover.docViews.table.filterForValueButtonTooltip": "値でフィルター",
"discover.docViews.table.filterOutValueButtonAriaLabel": "値を除外",
"discover.docViews.table.filterOutValueButtonTooltip": "値を除外",
"discover.docViews.table.noCachedMappingForThisFieldAriaLabel": "警告",
"discover.docViews.table.noCachedMappingForThisFieldTooltip": "このフィールドのキャッシュされたマッピングがありません。管理 > インデックスパターンページからフィールドリストを更新してください",
"discover.docViews.table.tableTitle": "表",
"discover.docViews.table.toggleColumnInTableButtonAriaLabel": "表の列を切り替える",
"discover.docViews.table.toggleColumnInTableButtonTooltip": "表の列を切り替える",

View file

@ -1460,8 +1460,6 @@
"discover.docViews.table.filterForValueButtonTooltip": "筛留值",
"discover.docViews.table.filterOutValueButtonAriaLabel": "筛除值",
"discover.docViews.table.filterOutValueButtonTooltip": "筛除值",
"discover.docViews.table.noCachedMappingForThisFieldAriaLabel": "警告",
"discover.docViews.table.noCachedMappingForThisFieldTooltip": "此字段没有任何已缓存映射。从“管理”>“索引模式”页面刷新字段列表",
"discover.docViews.table.tableTitle": "表",
"discover.docViews.table.toggleColumnInTableButtonAriaLabel": "在表中切换列",
"discover.docViews.table.toggleColumnInTableButtonTooltip": "在表中切换列",