diff --git a/x-pack/legacy/plugins/file_upload/public/components/index_settings.js b/x-pack/legacy/plugins/file_upload/public/components/index_settings.js index 11d388f992824..d637abaeb9303 100644 --- a/x-pack/legacy/plugins/file_upload/public/components/index_settings.js +++ b/x-pack/legacy/plugins/file_upload/public/components/index_settings.js @@ -6,13 +6,7 @@ import React, { Fragment, Component } from 'react'; import { i18n } from '@kbn/i18n'; -import { - EuiFormRow, - EuiFieldText, - EuiSpacer, - EuiSelect, - EuiCallOut -} from '@elastic/eui'; +import { EuiFormRow, EuiFieldText, EuiSelect, EuiCallOut } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { getExistingIndices, getExistingIndexPatterns } from '../util/indexing_service'; @@ -115,7 +109,6 @@ export class IndexSettings extends Component { return ( - setSelectedIndexType(target.value)} /> - - {indexDisabled - ? null - : ( - -
-
    -
  • {i18n.translate('xpack.fileUpload.indexSettings.guidelines.mustBeNewIndex', - { defaultMessage: 'Must be a new index' })} -
  • -
  • {i18n.translate('xpack.fileUpload.indexSettings.guidelines.lowercaseOnly', - { defaultMessage: 'Lowercase only' })} -
  • -
  • {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotInclude', - { defaultMessage: 'Cannot include \\\\, /, *, ?, ", <, >, |, \ - " " (space character), , (comma), #' - })} -
  • -
  • {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotStartWith', - { defaultMessage: 'Cannot start with -, _, +' })} -
  • -
  • {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotBe', - { defaultMessage: 'Cannot be . or ..' })} -
  • -
  • {i18n.translate('xpack.fileUpload.indexSettings.guidelines.length', - { defaultMessage: - 'Cannot be longer than 255 bytes (note it is bytes, \ - so multi-byte characters will count towards the 255 \ - limit faster)' - })} -
  • -
-
-
- )} - - - - + {indexDisabled ? null : ( + +
    +
  • + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.mustBeNewIndex', { + defaultMessage: 'Must be a new index', + })} +
  • +
  • + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.lowercaseOnly', { + defaultMessage: 'Lowercase only', + })} +
  • +
  • + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotInclude', { + defaultMessage: + 'Cannot include \\\\, /, *, ?, ", <, >, |, \ + " " (space character), , (comma), #', + })} +
  • +
  • + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotStartWith', { + defaultMessage: 'Cannot start with -, _, +', + })} +
  • +
  • + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.cannotBe', { + defaultMessage: 'Cannot be . or ..', + })} +
  • +
  • + {i18n.translate('xpack.fileUpload.indexSettings.guidelines.length', { + defaultMessage: + 'Cannot be longer than 255 bytes (note it is bytes, \ + so multi-byte characters will count towards the 255 \ + limit faster)', + })} +
  • +
+
+ )}
); } } - diff --git a/x-pack/legacy/plugins/file_upload/public/components/json_import_progress.js b/x-pack/legacy/plugins/file_upload/public/components/json_import_progress.js index 46a4c01a31e81..8aa2ef757d488 100644 --- a/x-pack/legacy/plugins/file_upload/public/components/json_import_progress.js +++ b/x-pack/legacy/plugins/file_upload/public/components/json_import_progress.js @@ -4,18 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ - import React, { Fragment, Component } from 'react'; import { i18n } from '@kbn/i18n'; -import { - EuiCodeBlock, - EuiSpacer, - EuiFormRow, - EuiText, - EuiProgress, - EuiFlexItem, - EuiCallOut, -} from '@elastic/eui'; +import { EuiCodeBlock, EuiSpacer, EuiText, EuiTitle, EuiProgress, EuiCallOut } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import chrome from 'ui/chrome'; @@ -70,101 +61,71 @@ export class JsonImportProgress extends Component { return ( - {!complete ? - : null} - - : null} + +

- } - > - - {importMessage} - - - - {complete - ? ( - - { - indexDataJson - ? ( - - } - > - - {indexDataJson} - - - ) - : null - } - { - indexPatternJson - ? ( - - } - > - - {indexPatternJson} - - - ) - : null - } - - - -
- { - i18n.translate('xpack.fileUpload.jsonImport.indexModsMsg', - { defaultMessage: 'Further index modifications can be made using\n' - }) - } - - { - i18n.translate('xpack.fileUpload.jsonImport.indexMgmtLink', - { defaultMessage: 'Index Management' }) - } - -
-
-
-
-
- ) - : null - } - +

+
+ {importMessage &&

{importMessage}

}
+ + {complete ? ( + + {indexDataJson ? ( + + +

+ +

+
+ + {indexDataJson} + + +
+ ) : null} + {indexPatternJson ? ( + + +

+ +

+
+ + {indexPatternJson} + + +
+ ) : null} + +
+ {i18n.translate('xpack.fileUpload.jsonImport.indexModsMsg', { + defaultMessage: 'Further index modifications can be made using\n', + })} + + {i18n.translate('xpack.fileUpload.jsonImport.indexMgmtLink', { + defaultMessage: 'Index Management', + })} + + . +
+
+
+ ) : null}
); } diff --git a/x-pack/legacy/plugins/file_upload/public/components/json_index_file_picker.js b/x-pack/legacy/plugins/file_upload/public/components/json_index_file_picker.js index 71a4b3ee06db5..bb9c999ef980d 100644 --- a/x-pack/legacy/plugins/file_upload/public/components/json_index_file_picker.js +++ b/x-pack/legacy/plugins/file_upload/public/components/json_index_file_picker.js @@ -4,15 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ - import React, { Fragment, Component } from 'react'; -import { - EuiFilePicker, - EuiFormRow, - EuiSpacer, - EuiCallOut, - EuiProgress, -} from '@elastic/eui'; +import { EuiFilePicker, EuiFormRow, EuiProgress } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { parseFile } from '../util/file_parser'; @@ -142,68 +135,48 @@ export class JsonIndexFilePicker extends Component { } render() { - const { fileParsingProgress, fileUploadError, fileRef } = this.state; + const { fileParsingProgress, fileUploadError } = this.state; return ( - { fileParsingProgress - ? - : null - } - { - fileRef && !fileUploadError - ? null - : ( - -
-
    -
  • - { - i18n.translate( - 'xpack.fileUpload.jsonIndexFilePicker.formatsAccepted', - { defaultMessage: 'Formats accepted: .json, .geojson' } - ) - } -
  • -
  • - -
  • -
-
-
- ) - } - + {fileParsingProgress ? : null} + - )} + } isInvalid={fileUploadError !== ''} error={[fileUploadError]} - helpText={fileParsingProgress} + helpText={ + fileParsingProgress ? ( + fileParsingProgress + ) : ( + + {i18n.translate('xpack.fileUpload.jsonIndexFilePicker.formatsAccepted', { + defaultMessage: 'Formats accepted: .json, .geojson', + })}{' '} +
+ +
+ ) + } > - )} + } onChange={this._fileHandler} />
diff --git a/x-pack/legacy/plugins/maps/public/components/layer_addpanel/import_editor/view.js b/x-pack/legacy/plugins/maps/public/components/layer_addpanel/import_editor/view.js index f8ae193024c94..2cee57ec36686 100644 --- a/x-pack/legacy/plugins/maps/public/components/layer_addpanel/import_editor/view.js +++ b/x-pack/legacy/plugins/maps/public/components/layer_addpanel/import_editor/view.js @@ -6,11 +6,7 @@ import React, { Fragment } from 'react'; import { GeojsonFileSource } from '../../../shared/layers/sources/client_file_source'; -import { - EuiSpacer, - EuiPanel, - EuiButtonEmpty, -} from '@elastic/eui'; +import { EuiSpacer, EuiPanel, EuiButtonEmpty } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; export const ImportEditor = ({ @@ -20,29 +16,18 @@ export const ImportEditor = ({ const editor = GeojsonFileSource.renderEditor(editorProperties); return ( - { - isIndexingTriggered - ? null - : ( - - - - - - - ) - } - - {editor} - + {isIndexingTriggered ? null : ( + + + + + + + )} + {editor} ); }; diff --git a/x-pack/legacy/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js b/x-pack/legacy/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js index 4c0417ca96613..1c60a4f64b8fa 100644 --- a/x-pack/legacy/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js +++ b/x-pack/legacy/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js @@ -7,16 +7,7 @@ import React from 'react'; import classNames from 'classnames'; -import { - EuiIcon, - EuiOverlayMask, - EuiModal, - EuiModalBody, - EuiModalFooter, - EuiButton, - EuiButtonEmpty, - EuiButtonIcon, -} from '@elastic/eui'; +import { EuiIcon, EuiOverlayMask, EuiButtonIcon, EuiConfirmModal } from '@elastic/eui'; import { LayerTocActions } from '../../../../../shared/components/layer_toc_actions'; import { i18n } from '@kbn/i18n'; @@ -99,28 +90,18 @@ export class TOCEntry extends React.Component { return ( - - - There are unsaved changes to your layer. Are you sure you want to proceed? - - - - - Do not proceed - - - - Proceed and discard changes - - - +

There are unsaved changes to your layer.

+

Are you sure you want to proceed?

+
); } diff --git a/x-pack/legacy/plugins/maps/public/shared/components/help_menu.js b/x-pack/legacy/plugins/maps/public/shared/components/help_menu.js index 288261da77df3..34cb66eb7bd83 100644 --- a/x-pack/legacy/plugins/maps/public/shared/components/help_menu.js +++ b/x-pack/legacy/plugins/maps/public/shared/components/help_menu.js @@ -5,7 +5,7 @@ */ import React, { Fragment, PureComponent } from 'react'; -import { EuiButton, EuiHorizontalRule, EuiSpacer, EuiLink } from '@elastic/eui'; +import { EuiButton, EuiHorizontalRule, EuiSpacer, EuiLink, EuiText, EuiIcon } from '@elastic/eui'; import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -16,21 +16,23 @@ export class HelpMenu extends PureComponent { - - - - - - {i18n.translate('xpack.maps.helpMenu.feedbackLinkText', { - defaultMessage: 'Provide feedback for the Maps application' - })} - + + + + +   + + {i18n.translate('xpack.maps.helpMenu.feedbackLinkText', { + defaultMessage: 'Provide feedback for the Maps application', + })} + + ); } diff --git a/x-pack/legacy/plugins/maps/public/shared/components/map_listing.js b/x-pack/legacy/plugins/maps/public/shared/components/map_listing.js index 0a4accf030a80..a48b874560331 100644 --- a/x-pack/legacy/plugins/maps/public/shared/components/map_listing.js +++ b/x-pack/legacy/plugins/maps/public/shared/components/map_listing.js @@ -33,7 +33,6 @@ import chrome from 'ui/chrome'; export const EMPTY_FILTER = ''; export class MapListing extends React.Component { - state = { hasInitialFetchReturned: false, isFetchingItems: false, @@ -44,7 +43,7 @@ export class MapListing extends React.Component { selectedIds: [], page: 0, perPage: 20, - } + }; componentWillMount() { this._isMounted = true; @@ -60,7 +59,7 @@ export class MapListing extends React.Component { addHelpMenuToAppChrome(chrome); } - debouncedFetch = _.debounce(async (filter) => { + debouncedFetch = _.debounce(async filter => { const response = await this.props.find(filter); if (!this._isMounted) { @@ -81,10 +80,13 @@ export class MapListing extends React.Component { }, 300); fetchItems = () => { - this.setState({ - isFetchingItems: true, - }, this.debouncedFetch.bind(null, this.state.filter)); - } + this.setState( + { + isFetchingItems: true, + }, + this.debouncedFetch.bind(null, this.state.filter) + ); + }; deleteSelectedItems = async () => { try { @@ -92,17 +94,17 @@ export class MapListing extends React.Component { } catch (error) { toastNotifications.addDanger({ title: i18n.translate('xpack.maps.mapListing.unableToDeleteToastTitle', { - defaultMessage: `Unable to delete map(s)` + defaultMessage: `Unable to delete map(s)`, }), text: `${error}`, }); } this.fetchItems(); this.setState({ - selectedIds: [] + selectedIds: [], }); this.closeDeleteModal(); - } + }; closeDeleteModal = () => { this.setState({ showDeleteModal: false }); @@ -113,21 +115,17 @@ export class MapListing extends React.Component { }; onTableChange = ({ page, sort = {} }) => { - const { - index: pageIndex, - size: pageSize, - } = page; + const { index: pageIndex, size: pageSize } = page; - let { - field: sortField, - direction: sortDirection, - } = sort; + let { field: sortField, direction: sortDirection } = sort; // 3rd sorting state that is not captured by sort - native order (no sort) // when switching from desc to asc for the same field - use native order - if (this.state.sortField === sortField - && this.state.sortDirection === 'desc' - && sortDirection === 'asc') { + if ( + this.state.sortField === sortField && + this.state.sortDirection === 'desc' && + sortDirection === 'asc' + ) { sortField = null; sortDirection = null; } @@ -138,7 +136,7 @@ export class MapListing extends React.Component { sortField, sortDirection, }); - } + }; getPageOfItems = () => { // do not sort original list to preserve elasticsearch ranking order @@ -161,7 +159,7 @@ export class MapListing extends React.Component { // If end is greater than the length of the sequence, slice extracts through to the end of the sequence (arr.length). const lastIndex = startIndex + this.state.perPage; return itemsCopy.slice(startIndex, lastIndex); - } + }; hasNoItems() { if (!this.state.isFetchingItems && this.state.items.length === 0 && !this.state.filter) { @@ -176,15 +174,15 @@ export class MapListing extends React.Component { @@ -204,16 +202,13 @@ export class MapListing extends React.Component { return (

- @@ -229,7 +224,8 @@ export class MapListing extends React.Component { id="xpack.maps.mapListing.advancedSettingsLinkText" defaultMessage="Advanced Settings" /> - . + + .

@@ -245,12 +241,12 @@ export class MapListing extends React.Component { if (this.hasNoItems()) { return i18n.translate('xpack.maps.mapListing.noItemsDescription', { - defaultMessage: `Looks like you don't have any maps. Click the create button to create one.` + defaultMessage: `Looks like you don't have any maps. Click the create button to create one.`, }); } return i18n.translate('xpack.maps.mapListing.noMatchDescription', { - defaultMessage: 'No items matched your search.' + defaultMessage: 'No items matched your search.', }); } @@ -280,17 +276,20 @@ export class MapListing extends React.Component { { - this.setState({ - filter: e.target.value - }, this.fetchItems); + onChange={e => { + this.setState( + { + filter: e.target.value, + }, + this.fetchItems + ); }} data-test-subj="searchFilter" /> @@ -304,7 +303,7 @@ export class MapListing extends React.Component { { field: 'title', name: i18n.translate('xpack.maps.mapListing.titleFieldTitle', { - defaultMessage: 'Title' + defaultMessage: 'Title', }), sortable: true, render: (field, record) => ( @@ -314,16 +313,16 @@ export class MapListing extends React.Component { > {field} - ) + ), }, { field: 'description', name: i18n.translate('xpack.maps.mapListing.descriptionFieldTitle', { - defaultMessage: 'Description' + defaultMessage: 'Description', }), dataType: 'string', sortable: true, - } + }, ]; const pagination = { pageIndex: this.state.page, @@ -335,11 +334,13 @@ export class MapListing extends React.Component { let selection = false; if (!this.props.readOnly) { selection = { - onSelectionChange: (selection) => { + onSelectionChange: selection => { this.setState({ - selectedIds: selection.map(item => { return item.id; }) + selectedIds: selection.map(item => { + return item.id; + }), }); - } + }, }; } @@ -371,51 +372,39 @@ export class MapListing extends React.Component { let createButton; if (!this.props.readOnly) { createButton = ( - - - - - + + + ); } return ( -
+ {this.state.showDeleteModal && this.renderConfirmDeleteModal()} - - - - -

- -

-
-
- - - - -
- - {createButton} + + + +

+ {' '} +   + +

+
+
+ {createButton}
@@ -427,7 +416,7 @@ export class MapListing extends React.Component { {this.renderTable()} -
+
); } @@ -436,19 +425,13 @@ export class MapListing extends React.Component { return; } - return ( - - {this.renderListing()} - - ); + return {this.renderListing()}; } render() { return ( - - {this.renderPageContent()} - + {this.renderPageContent()} ); }