Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-62999
Browse files Browse the repository at this point in the history
  • Loading branch information
parkiino committed Apr 13, 2020
2 parents e1789ad + 97c5574 commit b785bea
Show file tree
Hide file tree
Showing 74 changed files with 1,147 additions and 747 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { shallow } from 'enzyme';
import { CallOuts } from '../call_outs';

describe('CallOuts', () => {
it('should render normally', async () => {
test('should render normally', () => {
const component = shallow(
<CallOuts
deprecatedLangsInUse={['php']}
Expand All @@ -34,7 +34,7 @@ describe('CallOuts', () => {
expect(component).toMatchSnapshot();
});

it('should render without any call outs', async () => {
test('should render without any call outs', () => {
const component = shallow(
<CallOuts deprecatedLangsInUse={[]} painlessDocLink="http://www.elastic.co/painlessDocs" />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@
import React from 'react';

import { EuiCallOut, EuiLink, EuiSpacer } from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n/react';

export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }) => {
interface CallOutsProps {
deprecatedLangsInUse: string[];
painlessDocLink: string;
}

export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }: CallOutsProps) => {
if (!deprecatedLangsInUse.length) {
return null;
}

return (
<div>
<>
<EuiCallOut
title={
<FormattedMessage
Expand Down Expand Up @@ -60,6 +64,6 @@ export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }) => {
</p>
</EuiCallOut>
<EuiSpacer size="m" />
</div>
</>
);
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React from 'react';
import { shallow } from 'enzyme';

import { DeleteScritpedFieldConfirmationModal } from './confirmation_modal';

describe('DeleteScritpedFieldConfirmationModal', () => {
test('should render normally', () => {
const component = shallow(
<DeleteScritpedFieldConfirmationModal
field={{ name: '', script: '', lang: '' }}
deleteField={() => {}}
hideDeleteConfirmationModal={() => {}}
/>
);

expect(component).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { i18n } from '@kbn/i18n';
import { EUI_MODAL_CONFIRM_BUTTON, EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';

import { ScriptedFieldItem } from '../../types';

interface DeleteScritpedFieldConfirmationModalProps {
field: ScriptedFieldItem;
hideDeleteConfirmationModal: (
event?: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLButtonElement>
) => void;
deleteField: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
}

export const DeleteScritpedFieldConfirmationModal = ({
field,
hideDeleteConfirmationModal,
deleteField,
}: DeleteScritpedFieldConfirmationModalProps) => {
const title = i18n.translate('kbn.management.editIndexPattern.scripted.deleteFieldLabel', {
defaultMessage: "Delete scripted field '{fieldName}'?",
values: { fieldName: field.name },
});
const cancelButtonText = i18n.translate(
'kbn.management.editIndexPattern.scripted.deleteField.cancelButton',
{ defaultMessage: 'Cancel' }
);
const confirmButtonText = i18n.translate(
'kbn.management.editIndexPattern.scripted.deleteField.deleteButton',
{ defaultMessage: 'Delete' }
);

return (
<EuiOverlayMask>
<EuiConfirmModal
title={title}
onCancel={hideDeleteConfirmationModal}
onConfirm={deleteField}
cancelButtonText={cancelButtonText}
confirmButtonText={confirmButtonText}
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
/>
</EuiOverlayMask>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export { DeleteScritpedFieldConfirmationModal } from './confirmation_modal';
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import React from 'react';
import { shallow } from 'enzyme';

import { Header } from '../header';
import { Header } from './header';

describe('Header', () => {
it('should render normally', async () => {
test('should render normally', () => {
const component = shallow(<Header addScriptedFieldUrl="" />);

expect(component).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
*/

import React from 'react';
import PropTypes from 'prop-types';

import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n/react';

export const Header = ({ addScriptedFieldUrl }) => (
interface HeaderProps {
addScriptedFieldUrl: string;
}

export const Header = ({ addScriptedFieldUrl }: HeaderProps) => (
<EuiFlexGroup alignItems="center">
<EuiFlexItem>
<EuiTitle size="s">
Expand Down Expand Up @@ -56,7 +58,3 @@ export const Header = ({ addScriptedFieldUrl }) => (
</EuiFlexItem>
</EuiFlexGroup>
);

Header.propTypes = {
addScriptedFieldUrl: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
export { Table } from './table';
export { Header } from './header';
export { CallOuts } from './call_outs';
export { DeleteScritpedFieldConfirmationModal } from './confirmation_modal';

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b785bea

Please sign in to comment.