From e97b96eb92352d29ad2de753103d26f4d38083fb Mon Sep 17 00:00:00 2001
From: KHeo
Date: Tue, 17 Sep 2019 16:53:52 +0900
Subject: [PATCH 01/10] Prettierize.
---
.../components/header/header.js | 52 ++--
.../components/header/header.js | 18 +-
.../step_index_pattern/step_index_pattern.js | 75 +++---
.../advanced_options/advanced_options.js | 63 +++--
.../components/time_field/time_field.js | 39 ++-
.../step_time_field/step_time_field.js | 101 ++++----
.../components/table/table.js | 135 ++++++----
.../components/table/table.js | 167 +++++++------
.../components/add_filter/add_filter.js | 24 +-
.../components/table/table.js | 51 ++--
.../objects_table/components/flyout/flyout.js | 232 ++++++++---------
.../components/relationships/relationships.js | 72 +++---
.../objects_table/components/table/table.js | 132 +++++-----
.../components/objects_table/objects_table.js | 135 +++++-----
.../settings/components/field/field.js | 234 ++++++++++--------
.../sections/settings/components/form/form.js | 17 +-
.../settings/components/search/search.js | 24 +-
17 files changed, 802 insertions(+), 769 deletions(-)
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.js
index 40a5fa23a23ad..6b0552f736667 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.js
@@ -39,7 +39,7 @@ const HeaderUi = ({
isIncludingSystemIndices,
onChangeIncludingSystemIndices,
isBeta,
- intl
+ intl,
}) => (
@@ -48,20 +48,20 @@ const HeaderUi = ({
id="kbn.management.createIndexPatternHeader"
defaultMessage="Create {indexPatternName}"
values={{
- indexPatternName
+ indexPatternName,
}}
/>
- { isBeta ? (
+ {isBeta ? (
{' '}
- ) : null }
+ ) : null}
@@ -77,31 +77,29 @@ const HeaderUi = ({
- {
- showSystemIndices ? (
-
-
+ }
- id="checkboxShowSystemIndices"
- checked={isIncludingSystemIndices}
- onChange={onChangeIncludingSystemIndices}
- />
-
- ) : null
- }
+ />
+ }
+ id="checkboxShowSystemIndices"
+ checked={isIncludingSystemIndices}
+ onChange={onChangeIncludingSystemIndices}
+ />
+
+ ) : null}
- {
- prompt ? (
-
-
- {prompt}
-
- ) : null
- }
-
+ {prompt ? (
+
+
+ {prompt}
+
+ ) : null}
+
);
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js
index aab39f8851ef7..14a5588f748f7 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js
@@ -52,17 +52,17 @@ export const HeaderComponent = ({
/>
-
+
-
+
}
+ label={
+
+ }
isInvalid={isInputInvalid}
error={errors}
helpText={
@@ -88,7 +88,7 @@ export const HeaderComponent = ({
name="indexPattern"
placeholder={intl.formatMessage({
id: 'kbn.management.createIndexPattern.step.indexPatternPlaceholder',
- defaultMessage: 'index-name-*'
+ defaultMessage: 'index-name-*',
})}
value={query}
isInvalid={isInputInvalid}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js
index 60b5cb2dd8dae..e110e1b7755a8 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js
@@ -26,18 +26,14 @@ import {
containsIllegalCharacters,
getMatchedIndices,
canAppendWildcard,
- ensureMinimumTime
+ ensureMinimumTime,
} from '../../lib';
import { LoadingIndices } from './components/loading_indices';
import { StatusMessage } from './components/status_message';
import { IndicesList } from './components/indices_list';
import { Header } from './components/header';
-import {
- EuiPanel,
- EuiSpacer,
- EuiCallOut,
-} from '@elastic/eui';
+import { EuiPanel, EuiSpacer, EuiCallOut } from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import chrome from 'ui/chrome';
@@ -53,11 +49,11 @@ export class StepIndexPatternComponent extends Component {
indexPatternCreationType: PropTypes.object.isRequired,
goToNextStep: PropTypes.func.isRequired,
initialQuery: PropTypes.string,
- }
+ };
static defaultProps = {
initialQuery: uiSettings.get('indexPattern:placeholder'),
- }
+ };
constructor(props) {
super(props);
@@ -90,13 +86,15 @@ export class StepIndexPatternComponent extends Component {
const { savedObjects } = await this.props.savedObjectsClient.find({
type: 'index-pattern',
fields: ['title'],
- perPage: 10000
+ perPage: 10000,
});
- const existingIndexPatterns = savedObjects.map(obj => obj && obj.attributes ? obj.attributes.title : '');
+ const existingIndexPatterns = savedObjects.map(obj =>
+ obj && obj.attributes ? obj.attributes.title : ''
+ );
this.setState({ existingIndexPatterns });
- }
+ };
- fetchIndices = async (query) => {
+ fetchIndices = async query => {
const { esService, indexPatternCreationType } = this.props;
const { existingIndexPatterns } = this.state;
@@ -108,7 +106,9 @@ export class StepIndexPatternComponent extends Component {
this.setState({ isLoadingIndices: true, indexPatternExists: false });
if (query.endsWith('*')) {
- const exactMatchedIndices = await ensureMinimumTime(getIndices(esService, indexPatternCreationType, query, MAX_SEARCH_SIZE));
+ const exactMatchedIndices = await ensureMinimumTime(
+ getIndices(esService, indexPatternCreationType, query, MAX_SEARCH_SIZE)
+ );
// If the search changed, discard this state
if (query !== this.lastQuery) {
return;
@@ -117,10 +117,7 @@ export class StepIndexPatternComponent extends Component {
return;
}
- const [
- partialMatchedIndices,
- exactMatchedIndices,
- ] = await ensureMinimumTime([
+ const [partialMatchedIndices, exactMatchedIndices] = await ensureMinimumTime([
getIndices(esService, indexPatternCreationType, `${query}*`, MAX_SEARCH_SIZE),
getIndices(esService, indexPatternCreationType, query, MAX_SEARCH_SIZE),
]);
@@ -133,9 +130,9 @@ export class StepIndexPatternComponent extends Component {
this.setState({
partialMatchedIndices,
exactMatchedIndices,
- isLoadingIndices: false
+ isLoadingIndices: false,
});
- }
+ };
onQueryChanged = e => {
const { appendedWildcard } = this.state;
@@ -156,7 +153,7 @@ export class StepIndexPatternComponent extends Component {
this.lastQuery = query;
this.setState({ query, showingIndexPatternQueryErrors: !!query.length });
this.fetchIndices(query);
- }
+ };
renderLoadingState() {
const { isLoadingIndices } = this.state;
@@ -165,9 +162,7 @@ export class StepIndexPatternComponent extends Component {
return null;
}
- return (
-
- );
+ return ;
}
renderStatusMessage(matchedIndices) {
@@ -195,9 +190,7 @@ export class StepIndexPatternComponent extends Component {
return null;
}
- const indicesToList = query.length
- ? visibleIndices
- : allIndices;
+ const indicesToList = query.length ? visibleIndices : allIndices;
return (
}
+ title={
+
+ }
iconType="help"
color="warning"
/>
@@ -230,11 +225,18 @@ export class StepIndexPatternComponent extends Component {
renderHeader({ exactMatchedIndices: indices }) {
const { goToNextStep, indexPatternCreationType, intl } = this.props;
- const { query, showingIndexPatternQueryErrors, indexPatternExists, indexPatternName } = this.state;
+ const {
+ query,
+ showingIndexPatternQueryErrors,
+ indexPatternExists,
+ indexPatternName,
+ } = this.state;
let containsErrors = false;
const errors = [];
- const characterList = this.ILLEGAL_CHARACTERS.slice(0, this.ILLEGAL_CHARACTERS.length - 1).join(', ');
+ const characterList = this.ILLEGAL_CHARACTERS.slice(0, this.ILLEGAL_CHARACTERS.length - 1).join(
+ ', '
+ );
const checkIndices = indexPatternCreationType.checkIndicesForErrors(indices);
if (!query || !query.length || query === '.' || query === '..') {
@@ -244,7 +246,8 @@ export class StepIndexPatternComponent extends Component {
const errorMessage = intl.formatMessage(
{
id: 'kbn.management.createIndexPattern.step.invalidCharactersErrorMessage',
- defaultMessage: 'A {indexPatternName} cannot contain spaces or the characters: {characterList}'
+ defaultMessage:
+ 'A {indexPatternName} cannot contain spaces or the characters: {characterList}',
},
{ characterList, indexPatternName }
);
@@ -288,11 +291,11 @@ export class StepIndexPatternComponent extends Component {
return (
{this.renderHeader(matchedIndices)}
-
+
{this.renderLoadingState(matchedIndices)}
{this.renderIndexPatternExists()}
{this.renderStatusMessage(matchedIndices)}
-
+
{this.renderList(matchedIndices)}
);
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.js
index 3126dcf5430f6..7e7326f47073e 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.js
@@ -19,13 +19,7 @@
import React from 'react';
-import {
- EuiForm,
- EuiFormRow,
- EuiFieldText,
- EuiButtonEmpty,
- EuiSpacer,
-} from '@elastic/eui';
+import { EuiForm, EuiFormRow, EuiFieldText, EuiButtonEmpty, EuiSpacer } from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
@@ -41,35 +35,35 @@ export const AdvancedOptionsComponent = ({
iconType={isVisible ? 'arrowDown' : 'arrowRight'}
onClick={toggleAdvancedOptions}
>
- { isVisible
- ? (
-
- )
- : (
-
- )
- }
-
+ {isVisible ? (
+
+ ) : (
+
+ )}
-
- { isVisible ?
+
+ {isVisible ? (
}
- helpText={
+ }
+ helpText={
+ }
+ />
+ }
>
- : null
- }
+ ) : null}
);
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js
index 77a541d1ff7af..b1304a2462691 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js
@@ -44,7 +44,7 @@ export const TimeFieldComponent = ({
intl,
}) => (
- { isVisible ?
+ {isVisible ? (
@@ -57,21 +57,16 @@ export const TimeFieldComponent = ({
- { isLoading ? (
-
- )
- : (
-
-
-
- )
- }
+ {isLoading ? (
+
+ ) : (
+
+
+
+ )}
}
@@ -92,7 +87,7 @@ export const TimeFieldComponent = ({
}
>
- { isLoading ? (
+ {isLoading ? (
@@ -119,7 +114,7 @@ export const TimeFieldComponent = ({
/>
)}
- :
+ ) : (
- }
+ )}
);
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.js
index 37591d484d201..c45d80edfaff1 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.js
@@ -45,15 +45,12 @@ export class StepTimeFieldComponent extends Component {
goToPreviousStep: PropTypes.func.isRequired,
createIndexPattern: PropTypes.func.isRequired,
indexPatternCreationType: PropTypes.object.isRequired,
- }
+ };
constructor(props) {
super(props);
- const {
- getIndexPatternType,
- getIndexPatternName,
- } = props.indexPatternCreationType;
+ const { getIndexPatternType, getIndexPatternName } = props.indexPatternCreationType;
this.state = {
error: '',
@@ -94,9 +91,9 @@ export class StepTimeFieldComponent extends Component {
const timeFields = extractTimeFields(fields);
this.setState({ timeFields, isFetchingTimeFields: false });
- }
+ };
- onTimeFieldChanged = (e) => {
+ onTimeFieldChanged = e => {
const value = e.target.value;
// Find the time field based on the selected value
@@ -109,17 +106,17 @@ export class StepTimeFieldComponent extends Component {
selectedTimeField: timeField ? timeField.fieldName : undefined,
timeFieldSet: validSelection,
});
- }
+ };
- onChangeIndexPatternId = (e) => {
+ onChangeIndexPatternId = e => {
this.setState({ indexPatternId: e.target.value });
- }
+ };
toggleAdvancedOptions = () => {
this.setState(state => ({
- isAdvancedOptionsVisible: !state.isAdvancedOptionsVisible
+ isAdvancedOptionsVisible: !state.isAdvancedOptionsVisible,
}));
- }
+ };
createIndexPattern = async () => {
const { createIndexPattern } = this.props;
@@ -134,18 +131,18 @@ export class StepTimeFieldComponent extends Component {
isCreating: false,
});
}
- }
+ };
formatErrorMessage(message) {
// `createIndexPattern` throws "Conflict" when index pattern ID already exists.
- return message === 'Conflict'
- ? (
-
- )
- : message;
+ return message === 'Conflict' ? (
+
+ ) : (
+ message
+ );
}
render() {
@@ -165,7 +162,7 @@ export class StepTimeFieldComponent extends Component {
-
+
@@ -180,53 +177,43 @@ export class StepTimeFieldComponent extends Component {
);
}
- const {
- indexPattern,
- goToPreviousStep,
- } = this.props;
+ const { indexPattern, goToPreviousStep } = this.props;
- const timeFieldOptions = timeFields ?
- [
+ const timeFieldOptions = timeFields
+ ? [
{ text: '', value: '' },
...timeFields.map(timeField => ({
text: timeField.display,
value: timeField.fieldName,
disabled: timeFields.isDisabled,
- }))
+ })),
]
: [];
const showTimeField = !timeFields || timeFields.length > 1;
const submittable = !showTimeField || timeFieldSet;
- const error = this.state.error
- ? (
- <>
-
- )}
- color="danger"
- iconType="cross"
- >
-
- {this.formatErrorMessage(this.state.error)}
-
-
-
- >
- )
- : null;
+ const error = this.state.error ? (
+ <>
+
+ }
+ color="danger"
+ iconType="cross"
+ >
+ {this.formatErrorMessage(this.state.error)}
+
+
+ >
+ ) : null;
return (
-
-
+
+
-
+
-
+
{error}
: ;
+ return value ? : ;
}
renderFieldName(name, field) {
@@ -45,15 +41,15 @@ export class TableComponent extends PureComponent {
const infoLabel = intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.additionalInfoAriaLabel',
- defaultMessage: 'Additional field information'
+ defaultMessage: 'Additional field information',
});
const timeLabel = intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.primaryTimeAriaLabel',
- defaultMessage: 'Primary time field'
+ defaultMessage: 'Primary time field',
});
const timeContent = intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.primaryTimeTooltip',
- defaultMessage: 'This field represents the time that events occurred.'
+ defaultMessage: 'This field represents the time that events occurred.',
});
return (
@@ -66,19 +62,16 @@ export class TableComponent extends PureComponent {
type="questionInCircle"
color="primary"
aria-label={infoLabel}
- content={field.info.map((info, i) => {info}
)}
+ content={field.info.map((info, i) => (
+ {info}
+ ))}
/>
) : null}
{indexPattern.timeFieldName === name ? (
-
+
) : null}
@@ -89,11 +82,12 @@ export class TableComponent extends PureComponent {
const { intl } = this.props;
const label = intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.multiTypeAria',
- defaultMessage: 'Multiple type field'
+ defaultMessage: 'Multiple type field',
});
const content = intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.multiTypeTooltip',
- defaultMessage: 'The type of this field changes across indices. It is unavailable for many analysis functions.'
+ defaultMessage:
+ 'The type of this field changes across indices. It is unavailable for many analysis functions.',
});
return (
@@ -102,14 +96,11 @@ export class TableComponent extends PureComponent {
{isConflict ? (
-
+
- ) : ''}
+ ) : (
+ ''
+ )}
);
}
@@ -119,13 +110,16 @@ export class TableComponent extends PureComponent {
const pagination = {
initialPageSize: 10,
- pageSizeOptions: [5, 10, 25, 50]
+ pageSizeOptions: [5, 10, 25, 50],
};
const columns = [
{
field: 'displayName',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.nameHeader', defaultMessage: 'Name' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.nameHeader',
+ defaultMessage: 'Name',
+ }),
dataType: 'string',
sortable: true,
render: (value, field) => {
@@ -136,77 +130,112 @@ export class TableComponent extends PureComponent {
},
{
field: 'type',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.typeHeader', defaultMessage: 'Type' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.typeHeader',
+ defaultMessage: 'Type',
+ }),
dataType: 'string',
sortable: true,
- render: (value) => {
+ render: value => {
return this.renderFieldType(value, value === 'conflict');
},
'data-test-subj': 'indexedFieldType',
},
{
field: 'format',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.formatHeader', defaultMessage: 'Format' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.formatHeader',
+ defaultMessage: 'Format',
+ }),
dataType: 'string',
sortable: true,
},
{
field: 'searchable',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.searchableHeader', defaultMessage: 'Searchable' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.searchableHeader',
+ defaultMessage: 'Searchable',
+ }),
description: intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.searchableDescription',
- defaultMessage: 'These fields can be used in the filter bar' }),
+ defaultMessage: 'These fields can be used in the filter bar',
+ }),
dataType: 'boolean',
sortable: true,
- render: (value) => this.renderBooleanTemplate(value, intl.formatMessage({
- id: 'kbn.management.editIndexPattern.fields.table.isSearchableAria', defaultMessage: 'Is searchable' })),
+ render: value =>
+ this.renderBooleanTemplate(
+ value,
+ intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.isSearchableAria',
+ defaultMessage: 'Is searchable',
+ })
+ ),
},
{
field: 'aggregatable',
name: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.fields.table.aggregatableLabel', defaultMessage: 'Aggregatable' }),
+ id: 'kbn.management.editIndexPattern.fields.table.aggregatableLabel',
+ defaultMessage: 'Aggregatable',
+ }),
description: intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.aggregatableDescription',
- defaultMessage: 'These fields can be used in visualization aggregations' }),
+ defaultMessage: 'These fields can be used in visualization aggregations',
+ }),
dataType: 'boolean',
sortable: true,
- render: (value) => this.renderBooleanTemplate(value, intl.formatMessage({
- id: 'kbn.management.editIndexPattern.fields.table.isAggregatableAria', defaultMessage: 'Is aggregatable' })),
+ render: value =>
+ this.renderBooleanTemplate(
+ value,
+ intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.isAggregatableAria',
+ defaultMessage: 'Is aggregatable',
+ })
+ ),
},
{
field: 'excluded',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.excludedLabel', defaultMessage: 'Excluded' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.excludedLabel',
+ defaultMessage: 'Excluded',
+ }),
description: intl.formatMessage({
id: 'kbn.management.editIndexPattern.fields.table.excludedDescription',
- defaultMessage: 'Fields that are excluded from _source when it is fetched' }),
+ defaultMessage: 'Fields that are excluded from _source when it is fetched',
+ }),
dataType: 'boolean',
sortable: true,
- render: (value) => this.renderBooleanTemplate(value, intl.formatMessage({
- id: 'kbn.management.editIndexPattern.fields.table.isExcludedAria', defaultMessage: 'Is excluded' })),
+ render: value =>
+ this.renderBooleanTemplate(
+ value,
+ intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.isExcludedAria',
+ defaultMessage: 'Is excluded',
+ })
+ ),
},
{
name: '',
actions: [
{
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.editLabel', defaultMessage: 'Edit' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.fields.table.editLabel',
+ defaultMessage: 'Edit',
+ }),
description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.fields.table.editDescription', defaultMessage: 'Edit' }),
+ id: 'kbn.management.editIndexPattern.fields.table.editDescription',
+ defaultMessage: 'Edit',
+ }),
icon: 'pencil',
onClick: editField,
type: 'icon',
},
],
width: '40px',
- }
+ },
];
return (
-
+
);
}
}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.js
index d786d64a67a5f..be4319b36575c 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.js
@@ -20,9 +20,7 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
-import {
- EuiInMemoryTable,
-} from '@elastic/eui';
+import { EuiInMemoryTable } from '@elastic/eui';
import { injectI18n } from '@kbn/i18n/react';
@@ -32,77 +30,109 @@ export class TableComponent extends PureComponent {
items: PropTypes.array.isRequired,
editField: PropTypes.func.isRequired,
deleteField: PropTypes.func.isRequired,
- }
+ };
- renderFormatCell = (value) => {
+ renderFormatCell = value => {
const { indexPattern } = this.props;
- const title = indexPattern.fieldFormatMap[value] && indexPattern.fieldFormatMap[value].type
- ? indexPattern.fieldFormatMap[value].type.title
- : '';
+ const title =
+ indexPattern.fieldFormatMap[value] && indexPattern.fieldFormatMap[value].type
+ ? indexPattern.fieldFormatMap[value].type.title
+ : '';
- return (
- {title}
- );
- }
+ return {title};
+ };
render() {
- const {
- items,
- editField,
- deleteField,
- intl,
- } = this.props;
+ const { items, editField, deleteField, intl } = this.props;
- const columns = [{
- field: 'displayName',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.scripted.table.nameHeader', defaultMessage: 'Name' }),
- description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.scripted.table.nameDescription', defaultMessage: 'Name of the field' }),
- dataType: 'string',
- sortable: true,
- width: '38%',
- }, {
- field: 'lang',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.scripted.table.langHeader', defaultMessage: 'Lang' }),
- description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.scripted.table.langDescription',
- defaultMessage: 'Language used for the field' }),
- dataType: 'string',
- sortable: true,
- 'data-test-subj': 'scriptedFieldLang',
- }, {
- field: 'script',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.scripted.table.scriptHeader', defaultMessage: 'Script' }),
- description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.scripted.table.scriptDescription', defaultMessage: 'Script for the field' }),
- dataType: 'string',
- sortable: true,
- }, {
- field: 'name',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.scripted.table.formatHeader', defaultMessage: 'Format' }),
- description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.scripted.table.formatDescription', defaultMessage: 'Format used for the field' }),
- render: this.renderFormatCell,
- sortable: false,
- }, {
- name: '',
- actions: [{
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.scripted.table.editHeader', defaultMessage: 'Edit' }),
+ const columns = [
+ {
+ field: 'displayName',
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.nameHeader',
+ defaultMessage: 'Name',
+ }),
+ description: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.nameDescription',
+ defaultMessage: 'Name of the field',
+ }),
+ dataType: 'string',
+ sortable: true,
+ width: '38%',
+ },
+ {
+ field: 'lang',
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.langHeader',
+ defaultMessage: 'Lang',
+ }),
+ description: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.langDescription',
+ defaultMessage: 'Language used for the field',
+ }),
+ dataType: 'string',
+ sortable: true,
+ 'data-test-subj': 'scriptedFieldLang',
+ },
+ {
+ field: 'script',
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.scriptHeader',
+ defaultMessage: 'Script',
+ }),
description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.scripted.table.editDescription', defaultMessage: 'Edit this field' }),
- icon: 'pencil',
- onClick: editField,
- }, {
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.scripted.table.deleteHeader', defaultMessage: 'Delete' }),
+ id: 'kbn.management.editIndexPattern.scripted.table.scriptDescription',
+ defaultMessage: 'Script for the field',
+ }),
+ dataType: 'string',
+ sortable: true,
+ },
+ {
+ field: 'name',
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.formatHeader',
+ defaultMessage: 'Format',
+ }),
description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.scripted.table.deleteDescription', defaultMessage: 'Delete this field' }),
- icon: 'trash',
- color: 'danger',
- onClick: deleteField,
- }],
- width: '40px',
- }];
+ id: 'kbn.management.editIndexPattern.scripted.table.formatDescription',
+ defaultMessage: 'Format used for the field',
+ }),
+ render: this.renderFormatCell,
+ sortable: false,
+ },
+ {
+ name: '',
+ actions: [
+ {
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.editHeader',
+ defaultMessage: 'Edit',
+ }),
+ description: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.editDescription',
+ defaultMessage: 'Edit this field',
+ }),
+ icon: 'pencil',
+ onClick: editField,
+ },
+ {
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.deleteHeader',
+ defaultMessage: 'Delete',
+ }),
+ description: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.scripted.table.deleteDescription',
+ defaultMessage: 'Delete this field',
+ }),
+ icon: 'trash',
+ color: 'danger',
+ onClick: deleteField,
+ },
+ ],
+ width: '40px',
+ },
+ ];
const pagination = {
initialPageSize: 10,
@@ -110,12 +140,7 @@ export class TableComponent extends PureComponent {
};
return (
-
+
);
}
}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.js
index 47084161a484a..311ebb413250f 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.js
@@ -20,19 +20,14 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
-import {
- EuiFlexGroup,
- EuiFlexItem,
- EuiFieldText,
- EuiButton,
-} from '@elastic/eui';
+import { EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButton } from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
export class AddFilterComponent extends Component {
static propTypes = {
onAddFilter: PropTypes.func.isRequired,
- }
+ };
constructor(props) {
super(props);
@@ -44,14 +39,15 @@ export class AddFilterComponent extends Component {
onAddFilter = () => {
this.props.onAddFilter(this.state.filter);
this.setState({ filter: '' });
- }
+ };
render() {
const { filter } = this.state;
const { intl } = this.props;
const placeholder = intl.formatMessage({
id: 'kbn.management.editIndexPattern.sourcePlaceholder',
- defaultMessage: 'source filter, accepts wildcards (e.g., `user*` to filter fields starting with \'user\')'
+ defaultMessage:
+ 'source filter, accepts wildcards (e.g., `user*` to filter fields starting with \'user\')',
});
return (
@@ -65,11 +61,11 @@ export class AddFilterComponent extends Component {
/>
-
-
+
+
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.js
index 768e9d330e0ac..c08c787248a79 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.js
@@ -51,8 +51,7 @@ export class TableComponent extends Component {
startEditingFilter = (id, value) =>
this.setState({ editingFilterId: id, editingFilterValue: value });
stopEditingFilter = () => this.setState({ editingFilterId: null });
- onEditingFilterChange = e =>
- this.setState({ editingFilterValue: e.target.value });
+ onEditingFilterChange = e => this.setState({ editingFilterValue: e.target.value });
onEditFieldKeyDown = ({ keyCode }) => {
if (keyCodes.ENTER === keyCode) {
@@ -68,20 +67,19 @@ export class TableComponent extends Component {
};
getColumns() {
- const {
- deleteFilter,
- fieldWildcardMatcher,
- indexPattern,
- saveFilter,
- intl,
- } = this.props;
+ const { deleteFilter, fieldWildcardMatcher, indexPattern, saveFilter, intl } = this.props;
return [
{
field: 'value',
- name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.source.table.filterHeader', defaultMessage: 'Filter' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.editIndexPattern.source.table.filterHeader',
+ defaultMessage: 'Filter',
+ }),
description: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.source.table.filterDescription', defaultMessage: 'Filter name' }),
+ id: 'kbn.management.editIndexPattern.source.table.filterDescription',
+ defaultMessage: 'Filter name',
+ }),
dataType: 'string',
sortable: true,
render: (value, filter) => {
@@ -102,17 +100,18 @@ export class TableComponent extends Component {
{
field: 'value',
name: intl.formatMessage({
- id: 'kbn.management.editIndexPattern.source.table.matchesHeader', defaultMessage: 'Matches' }),
+ id: 'kbn.management.editIndexPattern.source.table.matchesHeader',
+ defaultMessage: 'Matches',
+ }),
description: intl.formatMessage({
id: 'kbn.management.editIndexPattern.source.table.matchesDescription',
- defaultMessage: 'Language used for the field' }),
+ defaultMessage: 'Language used for the field',
+ }),
dataType: 'string',
sortable: true,
render: (value, filter) => {
const realtimeValue =
- this.state.editingFilterId === filter.clientId
- ? this.state.editingFilterValue
- : value;
+ this.state.editingFilterId === filter.clientId ? this.state.editingFilterValue : value;
const matcher = fieldWildcardMatcher([realtimeValue]);
const matches = indexPattern
.getNonScriptedFields()
@@ -152,7 +151,9 @@ export class TableComponent extends Component {
}}
iconType="checkInCircleFilled"
aria-label={intl.formatMessage({
- id: 'kbn.management.editIndexPattern.source.table.saveAria', defaultMessage: 'Save' })}
+ id: 'kbn.management.editIndexPattern.source.table.saveAria',
+ defaultMessage: 'Save',
+ })}
/>
);
@@ -175,16 +178,18 @@ export class TableComponent extends Component {
onClick={() => deleteFilter(filter)}
iconType="trash"
aria-label={intl.formatMessage({
- id: 'kbn.management.editIndexPattern.source.table.deleteAria', defaultMessage: 'Delete' })}
+ id: 'kbn.management.editIndexPattern.source.table.deleteAria',
+ defaultMessage: 'Delete',
+ })}
/>
- this.startEditingFilter(filter.clientId, filter.value)
- }
+ onClick={() => this.startEditingFilter(filter.clientId, filter.value)}
iconType="pencil"
aria-label={intl.formatMessage({
- id: 'kbn.management.editIndexPattern.source.table.editAria', defaultMessage: 'Edit' })}
+ id: 'kbn.management.editIndexPattern.source.table.editAria',
+ defaultMessage: 'Edit',
+ })}
/>
);
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/flyout.js b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/flyout.js
index 625a32485de0f..8a25e40ba58b9 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/flyout.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/flyout/flyout.js
@@ -97,10 +97,7 @@ class FlyoutUI extends Component {
}
fetchIndexPatterns = async () => {
- const indexPatterns = await this.props.indexPatterns.getFields([
- 'id',
- 'title',
- ]);
+ const indexPatterns = await this.props.indexPatterns.getFields(['id', 'title']);
this.setState({ indexPatterns });
};
@@ -153,7 +150,7 @@ class FlyoutUI extends Component {
this.resolveImportErrors();
}
});
- }
+ };
/**
* Get Conflict Resolutions
@@ -163,10 +160,10 @@ class FlyoutUI extends Component {
* @param {array} objects List of objects to request the user if they wish to overwrite it
* @return {Promise} An object with the key being "type:id" and value the resolution chosen by the user
*/
- getConflictResolutions = async (objects) => {
+ getConflictResolutions = async objects => {
const resolutions = {};
for (const { type, id, title } of objects) {
- const overwrite = await new Promise((resolve) => {
+ const overwrite = await new Promise(resolve => {
this.setState({
conflictingRecord: {
id,
@@ -180,7 +177,7 @@ class FlyoutUI extends Component {
this.setState({ conflictingRecord: undefined });
}
return resolutions;
- }
+ };
/**
* Resolve Import Errors
@@ -211,7 +208,7 @@ class FlyoutUI extends Component {
}),
});
}
- }
+ };
legacyImport = async () => {
const { services, indexPatterns, intl, confirmModalPromise } = this.props;
@@ -247,17 +244,17 @@ class FlyoutUI extends Component {
return;
}
- contents = contents.filter(content =>
- POSSIBLE_TYPES.includes(content._type)
- ).map(doc => ({
- ...doc,
- // The server assumes that documents with no migrationVersion are up to date.
- // That assumption enables Kibana and other API consumers to not have to build
- // up migrationVersion prior to creating new objects. But it means that imports
- // need to set migrationVersion to something other than undefined, so that imported
- // docs are not seen as automatically up-to-date.
- _migrationVersion: doc._migrationVersion || {},
- }));
+ contents = contents
+ .filter(content => POSSIBLE_TYPES.includes(content._type))
+ .map(doc => ({
+ ...doc,
+ // The server assumes that documents with no migrationVersion are up to date.
+ // That assumption enables Kibana and other API consumers to not have to build
+ // up migrationVersion prior to creating new objects. But it means that imports
+ // need to set migrationVersion to something other than undefined, so that imported
+ // docs are not seen as automatically up-to-date.
+ _migrationVersion: doc._migrationVersion || {},
+ }));
const {
conflictedIndexPatterns,
@@ -277,7 +274,8 @@ class FlyoutUI extends Component {
conflictedIndexPatterns
.map(({ doc, obj }) => {
return { doc, obj: obj._serialize() };
- }).forEach(({ doc, obj }) =>
+ })
+ .forEach(({ doc, obj }) =>
obj.references.forEach(ref => {
byId[ref.id] = byId[ref.id] != null ? byId[ref.id].concat({ doc, obj }) : [{ doc, obj }];
})
@@ -334,7 +332,7 @@ class FlyoutUI extends Component {
isOverwriteAllChecked,
conflictedSavedObjectsLinkedToSavedSearches,
conflictedSearchDocs,
- failedImports
+ failedImports,
} = this.state;
const { services, indexPatterns, intl } = this.props;
@@ -354,7 +352,8 @@ class FlyoutUI extends Component {
// Do not Promise.all these calls as the order matters
this.setState({
loadingMessage: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.resolvingConflictsLoadingMessage',
+ id:
+ 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.resolvingConflictsLoadingMessage',
defaultMessage: 'Resolving conflicts…',
}),
});
@@ -367,7 +366,8 @@ class FlyoutUI extends Component {
}
this.setState({
loadingMessage: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.savingConflictsLoadingMessage',
+ id:
+ 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.savingConflictsLoadingMessage',
defaultMessage: 'Saving conflicts…',
}),
});
@@ -377,7 +377,8 @@ class FlyoutUI extends Component {
);
this.setState({
loadingMessage: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.savedSearchAreLinkedProperlyLoadingMessage',
+ id:
+ 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.savedSearchAreLinkedProperlyLoadingMessage',
defaultMessage: 'Ensure saved searches are linked properly…',
}),
});
@@ -389,7 +390,8 @@ class FlyoutUI extends Component {
);
this.setState({
loadingMessage: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.retryingFailedObjectsLoadingMessage',
+ id:
+ 'kbn.management.objects.objectsTable.flyout.confirmLegacyImport.retryingFailedObjectsLoadingMessage',
defaultMessage: 'Retrying failed objects…',
}),
});
@@ -471,17 +473,21 @@ class FlyoutUI extends Component {
{
field: 'list',
name: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.flyout.renderConflicts.columnSampleOfAffectedObjectsName',
+ id:
+ 'kbn.management.objects.objectsTable.flyout.renderConflicts.columnSampleOfAffectedObjectsName',
defaultMessage: 'Sample of affected objects',
}),
description: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.flyout.renderConflicts.columnSampleOfAffectedObjectsDescription',
+ id:
+ 'kbn.management.objects.objectsTable.flyout.renderConflicts.columnSampleOfAffectedObjectsDescription',
defaultMessage: 'Sample of affected objects',
}),
render: list => {
return (
- {take(list, 3).map((obj, key) => - {obj.title}
)}
+ {take(list, 3).map((obj, key) => (
+ - {obj.title}
+ ))}
);
},
@@ -489,7 +495,8 @@ class FlyoutUI extends Component {
{
field: 'existingIndexPatternId',
name: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.flyout.renderConflicts.columnNewIndexPatternName',
+ id:
+ 'kbn.management.objects.objectsTable.flyout.renderConflicts.columnNewIndexPatternName',
defaultMessage: 'New index pattern',
}),
render: id => {
@@ -520,11 +527,7 @@ class FlyoutUI extends Component {
};
return (
-
+
);
}
@@ -538,9 +541,12 @@ class FlyoutUI extends Component {
return (
- )}
+ title={
+
+ }
color="danger"
>
{error}
@@ -576,12 +582,18 @@ class FlyoutUI extends Component {
}
// Kept backwards compatible logic
- if (failedImports.length && (!this.hasUnmatchedReferences || (isLegacyFile === false && status === 'success'))) {
+ if (
+ failedImports.length &&
+ (!this.hasUnmatchedReferences || (isLegacyFile === false && status === 'success'))
+ ) {
return (
- )}
+ title={
+
+ }
color="warning"
iconType="help"
>
@@ -589,40 +601,46 @@ class FlyoutUI extends Component {
- {failedImports.map(({ error, obj }) => {
- if (error.type === 'missing_references') {
- return error.references.map((reference) => {
+ {failedImports
+ .map(({ error, obj }) => {
+ if (error.type === 'missing_references') {
+ return error.references.map(reference => {
+ return intl.formatMessage(
+ {
+ id:
+ 'kbn.management.objects.objectsTable.flyout.importFailedMissingReference',
+ defaultMessage: '{type} [id={id}] could not locate {refType} [id={refId}]',
+ },
+ {
+ id: obj.id,
+ type: obj.type,
+ refId: reference.id,
+ refType: reference.type,
+ }
+ );
+ });
+ } else if (error.type === 'unsupported_type') {
return intl.formatMessage(
{
- id: 'kbn.management.objects.objectsTable.flyout.importFailedMissingReference',
- defaultMessage: '{type} [id={id}] could not locate {refType} [id={refId}]',
+ id: 'kbn.management.objects.objectsTable.flyout.importFailedUnsupportedType',
+ defaultMessage: '{type} [id={id}] unsupported type',
},
{
id: obj.id,
type: obj.type,
- refId: reference.id,
- refType: reference.type,
}
);
- });
- } else if (error.type === 'unsupported_type') {
- return intl.formatMessage(
- {
- id: 'kbn.management.objects.objectsTable.flyout.importFailedUnsupportedType',
- defaultMessage: '{type} [id={id}] unsupported type',
- },
- {
- id: obj.id,
- type: obj.type,
- },
- );
- }
- return getField(error, 'body.message', error.message || '');
- }).join(' ')}
+ }
+ return getField(error, 'body.message', error.message || '');
+ })
+ .join(' ')}
);
@@ -633,12 +651,12 @@ class FlyoutUI extends Component {
return (
- )}
+ }
color="primary"
/>
);
@@ -647,12 +665,12 @@ class FlyoutUI extends Component {
return (
- )}
+ }
color="success"
iconType="check"
>
@@ -674,32 +692,32 @@ class FlyoutUI extends Component {
return (
- )}
+ }
>
- )}
+ }
onChange={this.setImportFile}
/>
- )}
+ }
data-test-subj="importSavedObjectsOverwriteToggle"
checked={isOverwriteAllChecked}
onChange={this.changeOverwriteAll}
@@ -717,12 +735,7 @@ class FlyoutUI extends Component {
if (status === 'success') {
confirmButton = (
-
+
- )}
+ }
color="warning"
iconType="help"
>
@@ -811,12 +821,12 @@ class FlyoutUI extends Component {
if (this.hasUnmatchedReferences) {
indexPatternConflictsWarning = (
- )}
+ }
color="warning"
iconType="help"
>
@@ -824,7 +834,7 @@ class FlyoutUI extends Component {
- )
+ ),
}}
/>
- );
+
+ );
}
if (!legacyFileWarning && !indexPatternConflictsWarning) {
@@ -847,18 +858,18 @@ class FlyoutUI extends Component {
return (
- {legacyFileWarning &&
+ {legacyFileWarning && (
{legacyFileWarning}
- }
- {indexPatternConflictsWarning &&
+ )}
+ {indexPatternConflictsWarning && (
{indexPatternConflictsWarning}
- }
+ )}
);
}
@@ -882,22 +893,18 @@ class FlyoutUI extends Component {
title={intl.formatMessage(
{
id: 'kbn.management.objects.objectsTable.flyout.confirmOverwriteTitle',
- defaultMessage: 'Overwrite {type}?'
+ defaultMessage: 'Overwrite {type}?',
},
{ type: this.state.conflictingRecord.type }
)}
- cancelButtonText={intl.formatMessage(
- {
- id: 'kbn.management.objects.objectsTable.flyout.confirmOverwriteCancelButtonText',
- defaultMessage: 'Cancel',
- },
- )}
- confirmButtonText={intl.formatMessage(
- {
- id: 'kbn.management.objects.objectsTable.flyout.confirmOverwriteOverwriteButtonText',
- defaultMessage: 'Overwrite',
- },
- )}
+ cancelButtonText={intl.formatMessage({
+ id: 'kbn.management.objects.objectsTable.flyout.confirmOverwriteCancelButtonText',
+ defaultMessage: 'Cancel',
+ })}
+ confirmButtonText={intl.formatMessage({
+ id: 'kbn.management.objects.objectsTable.flyout.confirmOverwriteOverwriteButtonText',
+ defaultMessage: 'Overwrite',
+ })}
buttonColor="danger"
onCancel={this.overwriteSkipped.bind(this)}
onConfirm={this.overwriteConfirmed.bind(this)}
@@ -908,12 +915,15 @@ class FlyoutUI extends Component {
id="kbn.management.objects.objectsTable.flyout.confirmOverwriteBody"
defaultMessage="Are you sure you want to overwrite {title}?"
values={{
- title: this.state.conflictingRecord.title || getDefaultTitle(this.state.conflictingRecord)
+ title:
+ this.state.conflictingRecord.title ||
+ getDefaultTitle(this.state.conflictingRecord),
}}
/>
- );
+
+ );
}
return (
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/relationships.js b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/relationships.js
index 3e7afe4a4d690..c5ed65606489b 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/relationships.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/relationships/relationships.js
@@ -89,9 +89,12 @@ class RelationshipsUI extends Component {
return (
- )}
+ title={
+
+ }
color="danger"
>
{error}
@@ -120,18 +123,14 @@ class RelationshipsUI extends Component {
}),
width: '50px',
align: 'center',
- description:
- intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.relationships.columnTypeDescription',
- defaultMessage: 'Type of the saved object',
- }),
+ description: intl.formatMessage({
+ id: 'kbn.management.objects.objectsTable.relationships.columnTypeDescription',
+ defaultMessage: 'Type of the saved object',
+ }),
sortable: false,
render: (type, object) => {
return (
-
+
{title || getDefaultTitle(object)}
- );
+ return {title || getDefaultTitle(object)};
}
return (
{title || getDefaultTitle(object)}
@@ -207,14 +203,15 @@ class RelationshipsUI extends Component {
actions: [
{
name: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.relationships.columnActions.inspectActionName',
+ id:
+ 'kbn.management.objects.objectsTable.relationships.columnActions.inspectActionName',
defaultMessage: 'Inspect',
}),
- description:
- intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.relationships.columnActions.inspectActionDescription',
- defaultMessage: 'Inspect this saved object',
- }),
+ description: intl.formatMessage({
+ id:
+ 'kbn.management.objects.objectsTable.relationships.columnActions.inspectActionDescription',
+ defaultMessage: 'Inspect this saved object',
+ }),
type: 'icon',
icon: 'inspect',
onClick: object => goInspectObject(object),
@@ -241,7 +238,8 @@ class RelationshipsUI extends Component {
type: 'field_value_selection',
field: 'relationship',
name: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.relationships.search.filters.relationship.name',
+ id:
+ 'kbn.management.objects.objectsTable.relationships.search.filters.relationship.name',
defaultMessage: 'Direct relationship',
}),
multiSelect: 'or',
@@ -250,7 +248,8 @@ class RelationshipsUI extends Component {
value: 'parent',
name: 'parent',
view: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.relationships.search.filters.relationship.parentAsValue.view',
+ id:
+ 'kbn.management.objects.objectsTable.relationships.search.filters.relationship.parentAsValue.view',
defaultMessage: 'Parent',
}),
},
@@ -258,7 +257,8 @@ class RelationshipsUI extends Component {
value: 'child',
name: 'child',
view: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.relationships.search.filters.relationship.childAsValue.view',
+ id:
+ 'kbn.management.objects.objectsTable.relationships.search.filters.relationship.childAsValue.view',
defaultMessage: 'Child',
}),
},
@@ -281,14 +281,18 @@ class RelationshipsUI extends Component {
- {intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.relationships.relationshipsTitle',
- defaultMessage: 'Here are the saved objects related to {title}. ' +
- 'Deleting this {type} affects its parent objects, but not its children.',
- }, {
- type: savedObject.type,
- title: savedObject.meta.title || getDefaultTitle(savedObject)
- })}
+ {intl.formatMessage(
+ {
+ id: 'kbn.management.objects.objectsTable.relationships.relationshipsTitle',
+ defaultMessage:
+ 'Here are the saved objects related to {title}. ' +
+ 'Deleting this {type} affects its parent objects, but not its children.',
+ },
+ {
+ type: savedObject.type,
+ title: savedObject.meta.title || getDefaultTitle(savedObject),
+ }
+ )}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/table.js b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/table.js
index 672cb23baf5a2..b1887c32a9a1d 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/table.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/components/table/table.js
@@ -34,7 +34,7 @@ import {
EuiPopover,
EuiSwitch,
EuiFormRow,
- EuiText
+ EuiText,
} from '@elastic/eui';
import { getDefaultTitle, getSavedObjectLabel } from '../../../../lib';
import { i18n } from '@kbn/i18n';
@@ -59,7 +59,7 @@ class TableUI extends PureComponent {
items: PropTypes.array.isRequired,
itemId: PropTypes.oneOfType([
PropTypes.string, // the name of the item id property
- PropTypes.func // (item) => string
+ PropTypes.func, // (item) => string
]),
totalItemCount: PropTypes.number.isRequired,
onQueryChange: PropTypes.func.isRequired,
@@ -75,7 +75,7 @@ class TableUI extends PureComponent {
isExportPopoverOpen: false,
isIncludeReferencesDeepChecked: true,
activeAction: null,
- }
+ };
constructor(props) {
super(props);
@@ -96,30 +96,30 @@ class TableUI extends PureComponent {
parseErrorMessage: null,
});
this.props.onQueryChange({ query });
- }
+ };
closeExportPopover = () => {
this.setState({ isExportPopoverOpen: false });
- }
+ };
toggleExportPopoverVisibility = () => {
this.setState(state => ({
- isExportPopoverOpen: !state.isExportPopoverOpen
+ isExportPopoverOpen: !state.isExportPopoverOpen,
}));
- }
+ };
toggleIsIncludeReferencesDeepChecked = () => {
this.setState(state => ({
isIncludeReferencesDeepChecked: !state.isIncludeReferencesDeepChecked,
}));
- }
+ };
onExportClick = () => {
const { onExport } = this.props;
const { isIncludeReferencesDeepChecked } = this.state;
onExport(isIncludeReferencesDeepChecked);
this.setState({ isExportPopoverOpen: false });
- }
+ };
render() {
const {
@@ -150,7 +150,10 @@ class TableUI extends PureComponent {
{
type: 'field_value_selection',
field: 'type',
- name: intl.formatMessage({ id: 'kbn.management.objects.objectsTable.table.typeFilterName', defaultMessage: 'Type' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.objects.objectsTable.table.typeFilterName',
+ defaultMessage: 'Type',
+ }),
multiSelect: 'or',
options: filterOptions,
},
@@ -167,20 +170,20 @@ class TableUI extends PureComponent {
const columns = [
{
field: 'type',
- name: intl.formatMessage({ id: 'kbn.management.objects.objectsTable.table.columnTypeName', defaultMessage: 'Type' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.objects.objectsTable.table.columnTypeName',
+ defaultMessage: 'Type',
+ }),
width: '50px',
align: 'center',
- description:
- intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.table.columnTypeDescription', defaultMessage: 'Type of the saved object'
- }),
+ description: intl.formatMessage({
+ id: 'kbn.management.objects.objectsTable.table.columnTypeDescription',
+ defaultMessage: 'Type of the saved object',
+ }),
sortable: false,
render: (type, object) => {
return (
-
+
{title || getDefaultTitle(object)}
- );
+ return {title || getDefaultTitle(object)};
}
return (
{title || getDefaultTitle(object)}
@@ -213,34 +217,37 @@ class TableUI extends PureComponent {
},
},
{
- name: intl.formatMessage({ id: 'kbn.management.objects.objectsTable.table.columnActionsName', defaultMessage: 'Actions' }),
+ name: intl.formatMessage({
+ id: 'kbn.management.objects.objectsTable.table.columnActionsName',
+ defaultMessage: 'Actions',
+ }),
actions: [
{
name: intl.formatMessage({
id: 'kbn.management.objects.objectsTable.table.columnActions.inspectActionName',
- defaultMessage: 'Inspect'
+ defaultMessage: 'Inspect',
+ }),
+ description: intl.formatMessage({
+ id:
+ 'kbn.management.objects.objectsTable.table.columnActions.inspectActionDescription',
+ defaultMessage: 'Inspect this saved object',
}),
- description:
- intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.table.columnActions.inspectActionDescription',
- defaultMessage: 'Inspect this saved object'
- }),
type: 'icon',
icon: 'inspect',
onClick: object => goInspectObject(object),
available: object => !!object.meta.editUrl,
},
{
- name:
- intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.table.columnActions.viewRelationshipsActionName',
- defaultMessage: 'Relationships'
- }),
- description:
- intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.table.columnActions.viewRelationshipsActionDescription',
- defaultMessage: 'View the relationships this saved object has to other saved objects'
- }),
+ name: intl.formatMessage({
+ id:
+ 'kbn.management.objects.objectsTable.table.columnActions.viewRelationshipsActionName',
+ defaultMessage: 'Relationships',
+ }),
+ description: intl.formatMessage({
+ id:
+ 'kbn.management.objects.objectsTable.table.columnActions.viewRelationshipsActionDescription',
+ defaultMessage: 'View the relationships this saved object has to other saved objects',
+ }),
type: 'icon',
icon: 'kqlSelector',
onClick: object => onShowRelationships(object),
@@ -248,9 +255,9 @@ class TableUI extends PureComponent {
...this.extraActions.map(action => {
return {
...action.euiAction,
- onClick: (object) => {
+ onClick: object => {
this.setState({
- activeAction: action
+ activeAction: action,
});
action.registerOnFinishCallback(() => {
@@ -260,9 +267,9 @@ class TableUI extends PureComponent {
});
action.euiAction.onClick(object);
- }
+ },
};
- })
+ }),
],
},
];
@@ -274,9 +281,7 @@ class TableUI extends PureComponent {
defaultMessage: 'Unable to parse query',
});
queryParseError = (
-
- {`${parseErrorMsg}. ${this.state.parseErrorMessage}`}
-
+ {`${parseErrorMsg}. ${this.state.parseErrorMessage}`}
);
}
@@ -309,17 +314,13 @@ class TableUI extends PureComponent {
iconType="trash"
color="danger"
onClick={onDelete}
- isDisabled={
- selectedSavedObjects.length === 0 ||
- !this.props.canDelete
- }
+ isDisabled={selectedSavedObjects.length === 0 || !this.props.canDelete}
title={
this.props.canDelete
? undefined
- : i18n.translate(
- 'kbn.management.objects.objectsTable.table.deleteButtonTitle',
- { defaultMessage: 'Unable to delete saved objects' }
- )
+ : i18n.translate('kbn.management.objects.objectsTable.table.deleteButtonTitle', {
+ defaultMessage: 'Unable to delete saved objects',
+ })
}
data-test-subj="savedObjectsManagementDelete"
>
@@ -335,32 +336,27 @@ class TableUI extends PureComponent {
closePopover={this.closeExportPopover}
>
- )}
+ }
>
- )}
+ }
checked={this.state.isIncludeReferencesDeepChecked}
onChange={this.toggleIsIncludeReferencesDeepChecked}
/>
-
+
{
- this.setState({
- isSearching: true,
- }, this.debouncedFetch);
- }
+ this.setState(
+ {
+ isSearching: true,
+ },
+ this.debouncedFetch
+ );
+ };
debouncedFetch = debounce(async () => {
const { intl } = this.props;
@@ -181,9 +184,7 @@ class ObjectsTableUI extends Component {
perPage,
page: page + 1,
fields: ['id'],
- type: this.savedObjectTypes.filter(
- type => !visibleTypes || visibleTypes.includes(type)
- ),
+ type: this.savedObjectTypes.filter(type => !visibleTypes || visibleTypes.includes(type)),
};
if (findOptions.type.length > 1) {
findOptions.sortField = 'type';
@@ -201,7 +202,7 @@ class ObjectsTableUI extends Component {
toastNotifications.addDanger({
title: intl.formatMessage({
id: 'kbn.management.objects.objectsTable.unableFindSavedObjectsNotificationMessage',
- defaultMessage: 'Unable find saved objects'
+ defaultMessage: 'Unable find saved objects',
}),
text: `${error}`,
});
@@ -253,14 +254,17 @@ class ObjectsTableUI extends Component {
onTableChange = async table => {
const { index: page, size: perPage } = table.page || {};
- this.setState({
- page,
- perPage,
- selectedSavedObjects: [],
- }, this.fetchSavedObjects);
+ this.setState(
+ {
+ page,
+ perPage,
+ selectedSavedObjects: [],
+ },
+ this.fetchSavedObjects
+ );
};
- onShowRelationships = (object) => {
+ onShowRelationships = object => {
this.setState({
isShowingRelationships: true,
relationshipObject: object,
@@ -274,7 +278,7 @@ class ObjectsTableUI extends Component {
});
};
- onExport = async (includeReferencesDeep) => {
+ onExport = async includeReferencesDeep => {
const { intl } = this.props;
const { selectedSavedObjects } = this.state;
const objectsToExport = selectedSavedObjects.map(obj => ({ id: obj.id, type: obj.type }));
@@ -304,15 +308,12 @@ class ObjectsTableUI extends Component {
onExportAll = async () => {
const { intl } = this.props;
const { exportAllSelectedOptions, isIncludeReferencesDeepChecked } = this.state;
- const exportTypes = Object.entries(exportAllSelectedOptions).reduce(
- (accum, [id, selected]) => {
- if (selected) {
- accum.push(id);
- }
- return accum;
- },
- []
- );
+ const exportTypes = Object.entries(exportAllSelectedOptions).reduce((accum, [id, selected]) => {
+ if (selected) {
+ accum.push(id);
+ }
+ return accum;
+ }, []);
let blob;
try {
@@ -365,9 +366,7 @@ class ObjectsTableUI extends Component {
this.setState({ isDeleting: true });
- const indexPatterns = selectedSavedObjects.filter(
- object => object.type === 'index-pattern'
- );
+ const indexPatterns = selectedSavedObjects.filter(object => object.type === 'index-pattern');
if (indexPatterns.length) {
await this.props.indexPatterns.clearCache();
}
@@ -440,11 +439,7 @@ class ObjectsTableUI extends Component {
}
renderDeleteConfirmModal() {
- const {
- isShowingDeleteConfirmModal,
- isDeleting,
- selectedSavedObjects,
- } = this.state;
+ const { isShowingDeleteConfirmModal, isDeleting, selectedSavedObjects } = this.state;
const { intl } = this.props;
if (!isShowingDeleteConfirmModal) {
@@ -455,9 +450,7 @@ class ObjectsTableUI extends Component {
if (isDeleting) {
// Block the user from interacting with the table while its contents are being deleted.
- modal = (
-
- );
+ modal = ;
} else {
const onCancel = () => {
this.setState({ isShowingDeleteConfirmModal: false });
@@ -478,22 +471,24 @@ class ObjectsTableUI extends Component {
onCancel={onCancel}
onConfirm={onConfirm}
buttonColor="danger"
- cancelButtonText={(
+ cancelButtonText={
- )}
+ }
confirmButtonText={
- isDeleting
- ? ()
- : (
+ ) : (
+ )
+ />
+ )
}
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
>
@@ -509,14 +504,13 @@ class ObjectsTableUI extends Component {
{
field: 'type',
name: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.deleteSavedObjectsConfirmModal.typeColumnName', defaultMessage: 'Type'
+ id:
+ 'kbn.management.objects.objectsTable.deleteSavedObjectsConfirmModal.typeColumnName',
+ defaultMessage: 'Type',
}),
width: '50px',
render: (type, object) => (
-
+
),
@@ -524,13 +518,16 @@ class ObjectsTableUI extends Component {
{
field: 'id',
name: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.deleteSavedObjectsConfirmModal.idColumnName', defaultMessage: 'Id'
+ id:
+ 'kbn.management.objects.objectsTable.deleteSavedObjectsConfirmModal.idColumnName',
+ defaultMessage: 'Id',
}),
},
{
field: 'meta.title',
name: intl.formatMessage({
- id: 'kbn.management.objects.objectsTable.deleteSavedObjectsConfirmModal.titleColumnName',
+ id:
+ 'kbn.management.objects.objectsTable.deleteSavedObjectsConfirmModal.titleColumnName',
defaultMessage: 'Title',
}),
},
@@ -542,22 +539,18 @@ class ObjectsTableUI extends Component {
);
}
- return (
-
- {modal}
-
- );
+ return {modal};
}
changeIncludeReferencesDeep = () => {
this.setState(state => ({
isIncludeReferencesDeepChecked: !state.isIncludeReferencesDeepChecked,
}));
- }
+ };
closeExportAllModal = () => {
this.setState({ isShowingExportAllOptionsModal: false });
- }
+ };
renderExportAllOptionsModal() {
const {
@@ -574,26 +567,26 @@ class ObjectsTableUI extends Component {
return (
-
+
}
+ label={
+
+ }
labelType="legend"
>
- )}
+ }
checked={isIncludeReferencesDeepChecked}
onChange={this.changeIncludeReferencesDeep}
/>
@@ -677,17 +670,13 @@ class ObjectsTableUI extends Component {
}));
return (
-
+
{this.renderFlyout()}
{this.renderRelationships()}
{this.renderDeleteConfirmModal()}
{this.renderExportAllOptionsModal()}
- this.setState({ isShowingExportAllOptionsModal: true })
- }
+ onExportAll={() => this.setState({ isShowingExportAllOptionsModal: true })}
onImport={this.showImportFlyout}
onRefresh={this.refreshData}
filteredCount={filteredItemCount}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js
index c0b1188950126..fe0814b01d3ea 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js
@@ -52,13 +52,12 @@ import { isDefaultValue } from '../../lib';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
class FieldUI extends PureComponent {
-
static propTypes = {
setting: PropTypes.object.isRequired,
save: PropTypes.func.isRequired,
clear: PropTypes.func.isRequired,
enableSaving: PropTypes.bool.isRequired,
- }
+ };
constructor(props) {
super(props);
@@ -84,12 +83,12 @@ class FieldUI extends PureComponent {
this.setState({
savedValue: editableValue,
- unsavedValue: (value === null || value === undefined) ? editableValue : unsavedValue,
+ unsavedValue: value === null || value === undefined ? editableValue : unsavedValue,
});
}
getEditableValue(type, value, defVal) {
- const val = (value === null || value === undefined) ? defVal : value;
+ const val = value === null || value === undefined ? defVal : value;
switch (type) {
case 'array':
return val.join(', ');
@@ -120,7 +119,7 @@ class FieldUI extends PureComponent {
setLoading(loading) {
this.setState({
- loading
+ loading,
});
}
@@ -131,7 +130,7 @@ class FieldUI extends PureComponent {
});
}
- onCodeEditorChange = (value) => {
+ onCodeEditorChange = value => {
const { type } = this.props.setting;
const { isJsonArray } = this.state;
@@ -150,7 +149,8 @@ class FieldUI extends PureComponent {
);
+ />
+ );
}
break;
default:
@@ -162,9 +162,9 @@ class FieldUI extends PureComponent {
isInvalid,
unsavedValue: newUnsavedValue,
});
- }
+ };
- onFieldChange = (e) => {
+ onFieldChange = e => {
const value = e.target.value;
const { type, validation } = this.props.setting;
const { unsavedValue } = this.state;
@@ -197,7 +197,7 @@ class FieldUI extends PureComponent {
isInvalid,
error
});
- }
+ };
onFieldKeyDown = ({ keyCode }) => {
if (keyCode === keyCodes.ENTER) {
@@ -206,15 +206,15 @@ class FieldUI extends PureComponent {
if (keyCode === keyCodes.ESCAPE) {
this.cancelEdit();
}
- }
+ };
onFieldEscape = ({ keyCode }) => {
if (keyCode === keyCodes.ESCAPE) {
this.cancelEdit();
}
- }
+ };
- onImageChange = async (files) => {
+ onImageChange = async files => {
if (!files.length) {
this.clearError();
this.setState({
@@ -231,12 +231,16 @@ class FieldUI extends PureComponent {
this.setState({
isInvalid,
error: isInvalid
- ? this.props.intl.formattedMessage({
- id: 'kbn.management.settings.field.imageTooLargeErrorMessage',
- defaultMessage: 'Image is too large, maximum size is {maxSizeDescription}'
- }, {
- maxSizeDescription: maxSize.description
- }) : null,
+ ? this.props.intl.formattedMessage(
+ {
+ id: 'kbn.management.settings.field.imageTooLargeErrorMessage',
+ defaultMessage: 'Image is too large, maximum size is {maxSizeDescription}',
+ },
+ {
+ maxSizeDescription: maxSize.description,
+ }
+ )
+ : null,
changeImage: true,
unsavedValue: base64Image,
});
@@ -244,12 +248,12 @@ class FieldUI extends PureComponent {
toastNotifications.addDanger(
this.props.intl.formatMessage({
id: 'kbn.management.settings.field.imageChangeErrorMessage',
- defaultMessage: 'Image could not be saved'
+ defaultMessage: 'Image could not be saved',
})
);
this.cancelChangeImage();
}
- }
+ };
getImageAsBase64(file) {
if (!file instanceof File) {
@@ -263,7 +267,7 @@ class FieldUI extends PureComponent {
reader.onload = () => {
resolve(reader.result);
};
- reader.onerror = (err) => {
+ reader.onerror = err => {
reject(err);
};
});
@@ -273,7 +277,7 @@ class FieldUI extends PureComponent {
this.setState({
changeImage: true,
});
- }
+ };
cancelChangeImage = () => {
const { savedValue } = this.state;
@@ -287,7 +291,7 @@ class FieldUI extends PureComponent {
changeImage: false,
unsavedValue: savedValue,
});
- }
+ };
cancelEdit = () => {
const { savedValue } = this.state;
@@ -295,17 +299,21 @@ class FieldUI extends PureComponent {
this.setState({
unsavedValue: savedValue,
});
- }
+ };
showPageReloadToast = () => {
if (this.props.setting.requiresPageReload) {
toastNotifications.add({
- title: this.props.intl.formatMessage({
- id: 'kbn.management.settings.field.requiresPageReloadToastDescription',
- defaultMessage: 'Please reload the page for the "{settingName}" setting to take effect.',
- }, {
- settingName: this.props.setting.displayName || this.props.setting.name,
- }),
+ title: this.props.intl.formatMessage(
+ {
+ id: 'kbn.management.settings.field.requiresPageReloadToastDescription',
+ defaultMessage:
+ 'Please reload the page for the "{settingName}" setting to take effect.',
+ },
+ {
+ settingName: this.props.setting.displayName || this.props.setting.name,
+ }
+ ),
text: (
<>
@@ -313,7 +321,7 @@ class FieldUI extends PureComponent {
window.location.reload()}>
{this.props.intl.formatMessage({
id: 'kbn.management.settings.field.requiresPageReloadToastButtonLabel',
- defaultMessage: 'Reload page'
+ defaultMessage: 'Reload page',
})}
@@ -323,7 +331,7 @@ class FieldUI extends PureComponent {
color: 'success',
});
}
- }
+ };
saveEdit = async () => {
const { name, defVal, type } = this.props.setting;
@@ -363,15 +371,17 @@ class FieldUI extends PureComponent {
}
} catch (e) {
toastNotifications.addDanger(
- this.props.intl.formatMessage({
- id: 'kbn.management.settings.field.saveFieldErrorMessage',
- defaultMessage: 'Unable to save {name}'
- },
- { name })
+ this.props.intl.formatMessage(
+ {
+ id: 'kbn.management.settings.field.saveFieldErrorMessage',
+ defaultMessage: 'Unable to save {name}',
+ },
+ { name }
+ )
);
}
this.setLoading(false);
- }
+ };
resetField = async () => {
const { name } = this.props.setting;
@@ -383,15 +393,17 @@ class FieldUI extends PureComponent {
this.clearError();
} catch (e) {
toastNotifications.addDanger(
- this.props.intl.formatMessage({
- id: 'kbn.management.settings.field.resetFieldErrorMessage',
- defaultMessage: 'Unable to reset {name}'
- },
- { name })
+ this.props.intl.formatMessage(
+ {
+ id: 'kbn.management.settings.field.resetFieldErrorMessage',
+ defaultMessage: 'Unable to reset {name}',
+ },
+ { name }
+ )
);
}
this.setLoading(false);
- }
+ };
renderField(setting) {
const { enableSaving } = this.props;
@@ -402,17 +414,16 @@ class FieldUI extends PureComponent {
case 'boolean':
return (
- ) : (
-
- )}
+ label={
+ !!unsavedValue ? (
+
+ ) : (
+
+ )
+ }
checked={!!unsavedValue}
onChange={this.onFieldChange}
disabled={loading || isOverridden || !enableSaving}
@@ -441,7 +452,7 @@ class FieldUI extends PureComponent {
tabSize: 2,
}}
editorProps={{
- $blockScrolling: Infinity
+ $blockScrolling: Infinity,
}}
showGutter={false}
/>
@@ -449,21 +460,16 @@ class FieldUI extends PureComponent {
);
case 'image':
if (!isDefaultValue(setting) && !changeImage) {
- return (
-
- );
+ return ;
} else {
return (
{ this.changeImageForm = input; }}
+ ref={input => {
+ this.changeImageForm = input;
+ }}
onKeyDown={this.onFieldEscape}
data-test-subj={`advancedSetting-editField-${name}`}
/>
@@ -474,10 +480,10 @@ class FieldUI extends PureComponent {
{
+ options={options.map(option => {
return {
text: optionLabels.hasOwnProperty(option) ? optionLabels[option] : option,
- value: option
+ value: option,
};
})}
onChange={this.onFieldChange}
@@ -550,7 +556,7 @@ class FieldUI extends PureComponent {
return (
{setting.displayName || setting.name}
- {setting.isCustom ?
+ {setting.isCustom ? (
)}
+ content={
+
+ }
/>
- : ''}
+ ) : (
+ ''
+ )}
);
}
@@ -616,7 +626,7 @@ class FieldUI extends PureComponent {
>
{this.getDisplayedDefaultValue(type, defVal)}
- )
+ ),
}}
/>
@@ -626,7 +636,9 @@ class FieldUI extends PureComponent {
id="kbn.management.settings.field.defaultValueText"
defaultMessage="Default: {value}"
values={{
- value: ({this.getDisplayedDefaultValue(type, defVal, optionLabels)}),
+ value: (
+ {this.getDisplayedDefaultValue(type, defVal, optionLabels)}
+ ),
}}
/>
@@ -644,13 +656,15 @@ class FieldUI extends PureComponent {
return (
@@ -673,13 +687,15 @@ class FieldUI extends PureComponent {
return (
@@ -708,13 +724,15 @@ class FieldUI extends PureComponent {
changeImage ? this.cancelChangeImage() : this.cancelEdit()}
+ aria-label={intl.formatMessage(
+ {
+ id: 'kbn.management.settings.field.cancelEditingButtonAriaLabel',
+ defaultMessage: 'Cancel editing {ariaName}',
+ },
+ {
+ ariaName,
+ }
+ )}
+ onClick={() => (changeImage ? this.cancelChangeImage() : this.cancelEdit())}
disabled={isDisabled}
data-test-subj={`advancedSetting-cancelEditField-${name}`}
>
@@ -774,9 +794,7 @@ class FieldUI extends PureComponent {
-
- {this.renderActions(setting)}
-
+ {this.renderActions(setting)}
);
}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/form.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/form.js
index 21818a7932b0e..88091bb48bea5 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/form.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/form/form.js
@@ -35,7 +35,6 @@ import { Field } from '../field';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
class FormUI extends PureComponent {
-
static propTypes = {
settings: PropTypes.object.isRequired,
categories: PropTypes.array.isRequired,
@@ -45,7 +44,7 @@ class FormUI extends PureComponent {
clear: PropTypes.func.isRequired,
showNoResultsMessage: PropTypes.bool.isRequired,
enableSaving: PropTypes.bool.isRequired,
- }
+ };
renderClearQueryLink(totalSettings, currentSettings) {
const { clearQuery } = this.props;
@@ -58,7 +57,7 @@ class FormUI extends PureComponent {
id="kbn.management.settings.form.searchResultText"
defaultMessage="Search terms are hiding {settingsCount} settings {clearSearch}"
values={{
- settingsCount: (totalSettings - currentSettings),
+ settingsCount: totalSettings - currentSettings,
clearSearch: (
@@ -147,13 +146,11 @@ class FormUI extends PureComponent {
return (
- {
- currentCategories.length ? currentCategories.map((category) => {
- return (
- this.renderCategory(category, settings[category], categoryCounts[category]) // fix this
- );
- }) : this.maybeRenderNoSettings(clearQuery)
- }
+ {currentCategories.length
+ ? currentCategories.map(category => {
+ return this.renderCategory(category, settings[category], categoryCounts[category]); // fix this
+ })
+ : this.maybeRenderNoSettings(clearQuery)}
);
}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/search.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/search.js
index 2006839877d5b..a85e2299e7502 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/search.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/search/search.js
@@ -21,15 +21,11 @@ import React, { Fragment, PureComponent } from 'react';
import PropTypes from 'prop-types';
import { injectI18n } from '@kbn/i18n/react';
-import {
- EuiSearchBar,
- EuiFormErrorText,
-} from '@elastic/eui';
+import { EuiSearchBar, EuiFormErrorText } from '@elastic/eui';
import { getCategoryName } from '../../lib';
class SearchUI extends PureComponent {
-
static propTypes = {
categories: PropTypes.array.isRequired,
query: PropTypes.object.isRequired,
@@ -50,7 +46,7 @@ class SearchUI extends PureComponent {
state = {
isSearchTextValid: true,
parseErrorMessage: null,
- }
+ };
onChange = ({ query, error }) => {
if (error) {
@@ -66,7 +62,7 @@ class SearchUI extends PureComponent {
parseErrorMessage: null,
});
this.props.onQueryChange({ query });
- }
+ };
render() {
const { query, intl } = this.props;
@@ -78,7 +74,6 @@ class SearchUI extends PureComponent {
id: 'kbn.management.settings.searchBarAriaLabel',
defaultMessage: 'Search advanced settings',
}), // hack until EuiSearchBar is fixed
-
};
const filters = [
@@ -91,7 +86,7 @@ class SearchUI extends PureComponent {
}),
multiSelect: 'or',
options: this.categories,
- }
+ },
];
let queryParseError;
@@ -101,20 +96,13 @@ class SearchUI extends PureComponent {
defaultMessage: 'Unable to parse query',
});
queryParseError = (
-
- {`${parseErrorMsg}. ${this.state.parseErrorMessage}`}
-
+ {`${parseErrorMsg}. ${this.state.parseErrorMessage}`}
);
}
return (
-
+
{queryParseError}
);
From cf39fe7c4951e06bd93e2e2e5eeca31647354d94 Mon Sep 17 00:00:00 2001
From: sainthkh
Date: Wed, 18 Sep 2019 11:57:28 +0900
Subject: [PATCH 02/10] Removed injectI18n. Fixes. Fixes.
---
.../components/header/__jest__/header.test.js | 20 +-
.../components/header/header.js | 11 +-
.../step_index_pattern.test.js.snap | 2 +-
.../__jest__/step_index_pattern.test.js | 35 ++--
.../components/header/__jest__/header.test.js | 12 +-
.../components/header/header.js | 18 +-
.../step_index_pattern/step_index_pattern.js | 17 +-
.../__jest__/step_time_field.test.js | 66 +++---
.../__jest__/advanced_options.test.js | 12 +-
.../advanced_options/advanced_options.js | 18 +-
.../time_field/__jest__/time_field.test.js | 20 +-
.../components/time_field/time_field.js | 18 +-
.../step_time_field/step_time_field.js | 6 +-
.../components/table/__jest__/table.test.js | 18 +-
.../components/table/table.js | 109 +++++-----
.../__jest__/scripted_field_table.test.js | 14 +-
.../components/table/__jest__/table.test.js | 29 ++-
.../components/table/table.js | 74 +++----
.../source_filters_table.test.js.snap | 14 +-
.../add_filter/__jest__/add_filter.test.js | 16 +-
.../components/add_filter/add_filter.js | 11 +-
.../components/header/header.js | 11 +-
.../components/table/__jest__/table.test.js | 82 +++-----
.../components/table/table.js | 63 +++---
.../__snapshots__/objects_table.test.js.snap | 6 +-
.../__jest__/objects_table.test.js | 140 +++++--------
.../components/flyout/__jest__/flyout.test.js | 81 ++++----
.../objects_table/components/flyout/flyout.js | 194 ++++++++----------
.../__jest__/relationships.test.js | 51 ++---
.../components/relationships/relationships.js | 112 +++++-----
.../components/table/__jest__/table.test.js | 80 ++++----
.../objects_table/components/table/table.js | 81 ++++----
.../components/objects_table/objects_table.js | 59 +++---
.../advanced_settings.test.js.snap | 6 +-
.../settings/components/field/field.js | 121 +++++------
.../settings/components/field/field.test.js | 12 +-
.../sections/settings/components/form/form.js | 6 +-
.../settings/components/form/form.test.js | 30 +--
.../page_footer/page_footer.test.js | 4 +-
.../page_subtitle/page_subtitle.test.js | 4 +-
.../components/page_title/page_title.test.js | 4 +-
.../settings/components/search/search.js | 22 +-
.../settings/components/search/search.test.js | 31 +--
43 files changed, 765 insertions(+), 975 deletions(-)
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/header.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/header.test.js
index a6766eb865605..c7cb3d4631b94 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/header.test.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__jest__/header.test.js
@@ -19,34 +19,28 @@
import React from 'react';
import { Header } from '../header';
-import { shallowWithIntl } from 'test_utils/enzyme_helpers';
+import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
describe('Header', () => {
it('should render normally', () => {
- const component = shallowWithIntl(
- {}}
- />
+ const component = shallowWithI18nProvider(
+ {}} />
);
expect(component).toMatchSnapshot();
});
it('should render without including system indices', () => {
- const component = shallowWithIntl(
- {}}
- />
+ const component = shallowWithI18nProvider(
+