diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__jest__/__snapshots__/scripted_field_table.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap
similarity index 89%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__jest__/__snapshots__/scripted_field_table.test.js.snap
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap
index a53f4d7f609cb..569b75c848c52 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__jest__/__snapshots__/scripted_field_table.test.js.snap
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ScriptedFieldsTable should filter based on the lang filter 1`] = `
-
+
@@ -39,11 +39,11 @@ exports[`ScriptedFieldsTable should filter based on the lang filter 1`] = `
]
}
/>
-
+
`;
exports[`ScriptedFieldsTable should filter based on the query bar 1`] = `
-
+
@@ -72,11 +72,11 @@ exports[`ScriptedFieldsTable should filter based on the query bar 1`] = `
]
}
/>
-
+
`;
exports[`ScriptedFieldsTable should hide the table if there are no scripted fields 1`] = `
-
+
@@ -97,11 +97,11 @@ exports[`ScriptedFieldsTable should hide the table if there are no scripted fiel
}
items={Array []}
/>
-
+
`;
exports[`ScriptedFieldsTable should render normally 1`] = `
-
+ {fieldToDelete && (
+
+ )}
+ >
);
}
}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/types.ts b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/types.ts
new file mode 100644
index 0000000000000..c1227393c561f
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/types.ts
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+/** @internal **/
+export interface ScriptedFieldItem {
+ name: string;
+ lang: string;
+ script: string;
+}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__jest__/__snapshots__/source_filters_table.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap
similarity index 82%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__jest__/__snapshots__/source_filters_table.test.js.snap
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap
index 52fccb8607a83..a7b73624c4665 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__jest__/__snapshots__/source_filters_table.test.js.snap
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SourceFiltersTable should add a filter 1`] = `
-
+
-
+
`;
exports[`SourceFiltersTable should filter based on the query bar 1`] = `
-
+
-
+
`;
exports[`SourceFiltersTable should remove a filter 1`] = `
-
+
-
+
`;
exports[`SourceFiltersTable should render normally 1`] = `
-
+
-
+
`;
exports[`SourceFiltersTable should should a loading indicator when saving 1`] = `
-
+
-
+
`;
exports[`SourceFiltersTable should show a delete modal 1`] = `
-
+
+
`;
exports[`SourceFiltersTable should update a filter 1`] = `
-
+
-
+
`;
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__jest__/__snapshots__/add_filter.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__jest__/__snapshots__/add_filter.test.js.snap
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap
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
deleted file mode 100644
index 2124b76b3a915..0000000000000
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-
-import { EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButton } from '@elastic/eui';
-
-import { i18n } from '@kbn/i18n';
-import { FormattedMessage } from '@kbn/i18n/react';
-
-export class AddFilter extends Component {
- static propTypes = {
- onAddFilter: PropTypes.func.isRequired,
- };
-
- constructor(props) {
- super(props);
- this.state = {
- filter: '',
- };
- }
-
- onAddFilter = () => {
- this.props.onAddFilter(this.state.filter);
- this.setState({ filter: '' });
- };
-
- render() {
- const { filter } = this.state;
- const placeholder = i18n.translate('kbn.management.editIndexPattern.sourcePlaceholder', {
- defaultMessage:
- "source filter, accepts wildcards (e.g., `user*` to filter fields starting with 'user')",
- });
-
- return (
-
-
- this.setState({ filter: e.target.value.trim() })}
- placeholder={placeholder}
- />
-
-
-
-
-
-
-
- );
- }
-}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__jest__/add_filter.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx
similarity index 66%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__jest__/add_filter.test.js
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx
index 915d9490db045..1ebaa3eaf89f8 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__jest__/add_filter.test.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx
@@ -18,33 +18,30 @@
*/
import React from 'react';
-import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
+import { shallow } from 'enzyme';
-import { AddFilter } from '../add_filter';
+import { AddFilter } from './add_filter';
describe('AddFilter', () => {
- it('should render normally', async () => {
- const component = shallowWithI18nProvider( {}} />);
+ test('should render normally', () => {
+ const component = shallow( {}} />);
expect(component).toMatchSnapshot();
});
- it('should allow adding a filter', async () => {
+ test('should allow adding a filter', async () => {
const onAddFilter = jest.fn();
- const component = shallowWithI18nProvider();
+ const component = shallow();
- // Set a value in the input field
- component.setState({ filter: 'tim*' });
-
- // Click the button
+ component.find('EuiFieldText').simulate('change', { target: { value: 'tim*' } });
component.find('EuiButton').simulate('click');
component.update();
expect(onAddFilter).toBeCalledWith('tim*');
});
- it('should ignore strings with just spaces', async () => {
- const component = shallowWithI18nProvider( {}} />);
+ test('should ignore strings with just spaces', () => {
+ const component = shallow( {}} />);
// Set a value in the input field
component.find('EuiFieldText').simulate('keypress', ' ');
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx
new file mode 100644
index 0000000000000..d0f397637de33
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx
@@ -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, { useState, useCallback } from 'react';
+
+import { i18n } from '@kbn/i18n';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButton } from '@elastic/eui';
+
+interface AddFilterProps {
+ onAddFilter: (filter: string) => void;
+}
+
+const sourcePlaceholder = i18n.translate('kbn.management.editIndexPattern.sourcePlaceholder', {
+ defaultMessage:
+ "source filter, accepts wildcards (e.g., `user*` to filter fields starting with 'user')",
+});
+
+export const AddFilter = ({ onAddFilter }: AddFilterProps) => {
+ const [filter, setFilter] = useState('');
+
+ const onAddButtonClick = useCallback(() => {
+ onAddFilter(filter);
+ setFilter('');
+ }, [filter, onAddFilter]);
+
+ return (
+
+
+ setFilter(e.target.value.trim())}
+ placeholder={sourcePlaceholder}
+ />
+
+
+
+
+
+
+
+ );
+};
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/index.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/index.ts
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/index.js
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/index.ts
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap
new file mode 100644
index 0000000000000..62376b498d887
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap
@@ -0,0 +1,37 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Header should render normally 1`] = `
+
+
+ }
+ confirmButtonText={
+
+ }
+ defaultFocusedButton="confirm"
+ onCancel={[Function]}
+ onConfirm={[Function]}
+ title={
+
+ }
+ />
+
+`;
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.test.tsx b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.test.tsx
new file mode 100644
index 0000000000000..ac7237095e4b3
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.test.tsx
@@ -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 { DeleteFilterConfirmationModal } from './confirmation_modal';
+
+describe('Header', () => {
+ test('should render normally', () => {
+ const component = shallow(
+ {}}
+ onDeleteFilter={() => {}}
+ />
+ );
+
+ expect(component).toMatchSnapshot();
+ });
+});
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.tsx b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.tsx
new file mode 100644
index 0000000000000..dabfb6d8f275a
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.tsx
@@ -0,0 +1,76 @@
+/*
+ * 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 PropTypes from 'prop-types';
+
+import { FormattedMessage } from '@kbn/i18n/react';
+import { EuiOverlayMask, EuiConfirmModal, EUI_MODAL_CONFIRM_BUTTON } from '@elastic/eui';
+
+interface DeleteFilterConfirmationModalProps {
+ filterToDeleteValue: string;
+ onCancelConfirmationModal: (
+ event?: React.KeyboardEvent | React.MouseEvent
+ ) => void;
+ onDeleteFilter: (event: React.MouseEvent) => void;
+}
+
+export const DeleteFilterConfirmationModal = ({
+ filterToDeleteValue,
+ onCancelConfirmationModal,
+ onDeleteFilter,
+}: DeleteFilterConfirmationModalProps) => {
+ return (
+
+
+ }
+ onCancel={onCancelConfirmationModal}
+ onConfirm={onDeleteFilter}
+ cancelButtonText={
+
+ }
+ buttonColor="danger"
+ confirmButtonText={
+
+ }
+ defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
+ />
+
+ );
+};
+
+DeleteFilterConfirmationModal.propTypes = {
+ filterToDeleteValue: PropTypes.string.isRequired,
+ onCancelConfirmationModal: PropTypes.func.isRequired,
+ onDeleteFilter: PropTypes.func.isRequired,
+};
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts
new file mode 100644
index 0000000000000..e48e38b7c3dcb
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts
@@ -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 { DeleteFilterConfirmationModal } from './confirmation_modal';
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__jest__/__snapshots__/header.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap
similarity index 98%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__jest__/__snapshots__/header.test.js.snap
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap
index a5be141a18c89..cde0de79caacd 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__jest__/__snapshots__/header.test.js.snap
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Header should render normally 1`] = `
-
+
`;
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__jest__/header.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.test.tsx
similarity index 95%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__jest__/header.test.js
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.test.tsx
index 058bf99fe26fa..869bdeb55cf02 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__jest__/header.test.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.test.tsx
@@ -23,7 +23,7 @@ import { shallow } from 'enzyme';
import { Header } from '../header';
describe('Header', () => {
- it('should render normally', async () => {
+ test('should render normally', () => {
const component = shallow();
expect(component).toMatchSnapshot();
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.tsx
similarity index 99%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.js
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.tsx
index 8822ca6236250..7b37f75043dd5 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.tsx
@@ -20,11 +20,10 @@
import React from 'react';
import { EuiTitle, EuiText, EuiSpacer } from '@elastic/eui';
-
import { FormattedMessage } from '@kbn/i18n/react';
export const Header = () => (
-
+ <>
(
-
+ >
);
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/index.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/index.ts
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/index.js
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/index.ts
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/index.ts b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/index.ts
new file mode 100644
index 0000000000000..87ac13ad15f50
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/index.ts
@@ -0,0 +1,23 @@
+/*
+ * 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 { AddFilter } from './add_filter';
+export { DeleteFilterConfirmationModal } from './confirmation_modal';
+export { Header } from './header';
+export { Table } from './table';
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/__snapshots__/table.test.js.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap
similarity index 77%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/__snapshots__/table.test.js.snap
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap
index a0853b8628cc9..c70d0871bb854 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/__snapshots__/table.test.js.snap
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap
@@ -3,14 +3,15 @@
exports[`Table editing should show a save button 1`] = `
@@ -18,27 +19,20 @@ exports[`Table editing should show a save button 1`] = `
`;
exports[`Table editing should show an input field 1`] = `
-
-
-
-
-
+
+ tim*
+
`;
exports[`Table editing should update the matches dynamically as input value is changed 1`] = `
-
- time, value
-
+
+
+
`;
@@ -79,6 +73,7 @@ exports[`Table should render normally 1`] = `
items={
Array [
Object {
+ "clientId": "",
"value": "tim*",
},
]
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/index.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/index.ts
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/index.js
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/index.ts
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/table.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.test.tsx
similarity index 69%
rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/table.test.js
rename to src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.test.tsx
index 7fba1fcfe4876..4705ecd2d1685 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__jest__/table.test.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.test.tsx
@@ -17,25 +17,40 @@
* under the License.
*/
-import React from 'react';
-import { shallow } from 'enzyme';
-import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
-
-import { Table } from '../table';
-import { keyCodes } from '@elastic/eui';
-
-const indexPattern = {};
-const items = [{ value: 'tim*' }];
+import React, { ReactElement } from 'react';
+import { shallow, ShallowWrapper } from 'enzyme';
+
+import { Table, TableProps, TableState } from './table';
+import { EuiTableFieldDataColumnType, keyCodes } from '@elastic/eui';
+import { IIndexPattern } from '../../../../../../../../../../../plugins/data/public';
+import { SourceFiltersTableFilter } from '../../types';
+
+const indexPattern = {} as IIndexPattern;
+const items: SourceFiltersTableFilter[] = [{ value: 'tim*', clientId: '' }];
+
+const getIndexPatternMock = (mockedFields: any = {}) => ({ ...mockedFields } as IIndexPattern);
+
+const getTableColumnRender = (
+ component: ShallowWrapper,
+ index: number = 0
+) => {
+ const columns = component.prop>>(
+ 'columns'
+ );
+ return {
+ render: columns[index].render as (...args: any) => ReactElement,
+ };
+};
describe('Table', () => {
- it('should render normally', async () => {
- const component = shallowWithI18nProvider(
+ test('should render normally', () => {
+ const component = shallow(
{
);
});
- it('should show an input field', () => {
+ test('should show an input field', () => {
// Start the editing process
+
const editingComponent = shallow(
// Wrap in a div because: https://github.com/airbnb/enzyme/issues/1213
-
);
editingComponent
.find('EuiButtonIcon')
@@ -92,19 +110,19 @@ describe('Table', () => {
// Ensure the state change propagates
component.update();
- // Ensure the table cell switches to an input
- const filterNameTableCell = shallow(
- component.prop('columns')[0].render('tim*', { clientId })
- );
+ const cell = getTableColumnRender(component).render('tim*', { clientId });
+ const filterNameTableCell = shallow(cell);
+
expect(filterNameTableCell).toMatchSnapshot();
});
- it('should show a save button', () => {
+ test('should show a save button', () => {
// Start the editing process
const editingComponent = shallow(
// Fixes: Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `symbol`.
-
);
+
editingComponent
.find('EuiButtonIcon')
.at(1)
@@ -116,22 +134,20 @@ describe('Table', () => {
// Verify save button
const saveTableCell = shallow(
// Fixes Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `symbol`.
-
{}}
- saveFilter={() => {}}
+ saveFilter={() => undefined}
isSaving={false}
/>
);
@@ -210,16 +230,15 @@ describe('Table', () => {
);
deleteCellComponent
.find('EuiButtonIcon')
- .at(0)
+ .at(1)
.simulate('click');
expect(deleteFilter).toBeCalled();
});
- it('should save when in edit mode and the enter key is pressed', () => {
+ test('should save when in edit mode and the enter key is pressed', () => {
const saveFilter = jest.fn();
- const clientId = 1;
- const component = shallowWithI18nProvider(
+ const component = shallow(
{
// Start the editing process
const editingComponent = shallow(
// Fixes Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `symbol`.
-
);
editingComponent
.find('EuiButtonIcon')
- .at(1)
+ .at(0)
.simulate('click');
- // Ensure the state change propagates
+
component.update();
// Get the rendered input cell
const filterNameTableCell = shallow(
// Fixes Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `symbol`.
-
);
// Press the enter key
@@ -253,14 +272,13 @@ describe('Table', () => {
expect(saveFilter).toBeCalled();
// It should reset
- expect(component.state('editingFilterId')).toBe(null);
+ expect(component.state('editingFilterId')).toBe('');
});
- it('should cancel when in edit mode and the esc key is pressed', () => {
+ test('should cancel when in edit mode and the esc key is pressed', () => {
const saveFilter = jest.fn();
- const clientId = 1;
- const component = shallowWithI18nProvider(
+ const component = shallow(
{
// Start the editing process
const editingComponent = shallow(
// Fixes Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `symbol`.
-
);
+
editingComponent
.find('EuiButtonIcon')
- .at(1)
+ .at(0)
.simulate('click');
+
// Ensure the state change propagates
component.update();
// Get the rendered input cell
const filterNameTableCell = shallow(
// Fixes Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `symbol`.
-
+ {filterToDelete && (
+
+ )}
+ >
);
}
}
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/types.ts b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/types.ts
new file mode 100644
index 0000000000000..ee3689f017471
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/types.ts
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+/** @internal **/
+export interface SourceFiltersTableFilter {
+ value: string;
+ clientId: string | number;
+}
diff --git a/src/legacy/ui/public/scripting_languages/index.js b/src/legacy/ui/public/scripting_languages/index.ts
similarity index 83%
rename from src/legacy/ui/public/scripting_languages/index.js
rename to src/legacy/ui/public/scripting_languages/index.ts
index 2f43a44d66068..283a3273a2a5d 100644
--- a/src/legacy/ui/public/scripting_languages/index.js
+++ b/src/legacy/ui/public/scripting_languages/index.ts
@@ -17,23 +17,25 @@
* under the License.
*/
+import { IHttpService } from 'angular';
+import { i18n } from '@kbn/i18n';
+
import chrome from '../chrome';
import { toastNotifications } from '../notify';
-import { i18n } from '@kbn/i18n';
-export function getSupportedScriptingLanguages() {
+export function getSupportedScriptingLanguages(): string[] {
return ['painless'];
}
-export function getDeprecatedScriptingLanguages() {
+export function getDeprecatedScriptingLanguages(): string[] {
return [];
}
-export function GetEnabledScriptingLanguagesProvider($http) {
+export function GetEnabledScriptingLanguagesProvider($http: IHttpService) {
return () => {
return $http
.get(chrome.addBasePath('/api/kibana/scripts/languages'))
- .then(res => res.data)
+ .then((res: any) => res.data)
.catch(() => {
toastNotifications.addDanger(
i18n.translate('common.ui.scriptingLanguages.errorFetchingToastDescription', {
diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_loader/workpad_loader.js b/x-pack/legacy/plugins/canvas/public/components/workpad_loader/workpad_loader.js
index 9b30b3e1ec7ca..30d4ded8571c5 100644
--- a/x-pack/legacy/plugins/canvas/public/components/workpad_loader/workpad_loader.js
+++ b/x-pack/legacy/plugins/canvas/public/components/workpad_loader/workpad_loader.js
@@ -266,11 +266,17 @@ export class WorkpadLoader extends React.PureComponent {
data-test-subj="canvasWorkpadLoaderTable"
/>
-
-
-
-
-
+ {rows.length > 0 && (
+
+
+
+
+
+ )}
);
diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_templates/workpad_templates.js b/x-pack/legacy/plugins/canvas/public/components/workpad_templates/workpad_templates.js
index c80db544bf370..a9a157f5675f8 100644
--- a/x-pack/legacy/plugins/canvas/public/components/workpad_templates/workpad_templates.js
+++ b/x-pack/legacy/plugins/canvas/public/components/workpad_templates/workpad_templates.js
@@ -113,11 +113,13 @@ export class WorkpadTemplates extends React.PureComponent {
className="canvasWorkpad__dropzoneTable canvasWorkpad__dropzoneTable--tags"
/>
-
-
-
-
-
+ {rows.length > 0 && (
+
+
+
+
+
+ )}
);
};
diff --git a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/index.js b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/index.js
index b3ad3d1df68ce..256f52112ba97 100644
--- a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/index.js
+++ b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/index.js
@@ -12,7 +12,7 @@ import { fitToLayerExtent, updateSourceProp } from '../../actions/map_actions';
function mapStateToProps(state = {}) {
const selectedLayer = getSelectedLayer(state);
return {
- key: selectedLayer ? selectedLayer.getId() : '',
+ key: selectedLayer ? `${selectedLayer.getId()}${selectedLayer.isJoinable()}` : '',
selectedLayer,
};
}
diff --git a/x-pack/legacy/plugins/siem/cypress/README.md b/x-pack/legacy/plugins/siem/cypress/README.md
index a031fea172be5..89bafce9c9dc8 100644
--- a/x-pack/legacy/plugins/siem/cypress/README.md
+++ b/x-pack/legacy/plugins/siem/cypress/README.md
@@ -129,31 +129,21 @@ yarn cypress:run-as-ci
```
Note that with this type of execution you don't need to have running a kibana and elasticsearch instance. This is because
- the command, as it would happen in the CI, will launch the instances. The elasticsearch instance will be fed with the data
- placed in: `x-pack/test/siem_cypress/es_archives`
+ the command, as it would happen in the CI, will launch the instances. The elasticsearch instance will be fed data
+ found in: `x-pack/test/siem_cypress/es_archives`
As in this case we want to mimic a CI execution we want to execute the tests with the same set of data, this is why
in this case does not make sense to override Cypress environment variables.
### Test data
-As said before when running the tests as Jenkins the tests are fed with the data placed in: `x-pack/test/siem_cypress/es_archives`.
+As mentioned above, when running the tests as Jenkins the tests are populated with data ("archives") found in: `x-pack/test/siem_cypress/es_archives`.
-Currently there are two different ways of feeding data:
-1. By default
-2. Specifying a specific set of data for a specific test
+By default, each test is populated with some base data: an empty kibana index and a set of auditbeat data (the `empty_kibana` and `auditbeat` archives, respectively). This is usually enough to cover most of the scenarios that we are testing.
-#### By default
+#### Running tests with additional archives
-When a execution of the test is going to be done an empty kibana and a set of audibteat data are loaded (empty_kibana and auditbeat). With this data usually is enough to cover most of the scenarios that we are testing.
-
-#### Running tests with custom data
-
-Sometimes the default data is not enough and we need a specific set of data in order to being able to test the desired behaviour.
-
-In that case in the hooks of the test use the function `esArchiverLoad` to load the set of data neeed and `esArchiverUnload` to remove the changes done in the data.
-
-Example:
+When the base data is insufficient, one can specify additional archives. Use `esArchiverLoad` to load the necessary archive, and `esArchiverUnload` to remove the archive from elasticsearch:
```typescript
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
@@ -174,11 +164,11 @@ describe('This are going to be a set of tests', () => {
```
-Note that loading and unloading data takes a signifcant amount of time so try to minimize the use of it when possible.
+Note that loading and unloading data take a significant amount of time, so try to minimize their use.
-### Current sets of data
+### Current archives
-The current sets of data can be found in: `x-pack/test/siem_cypress/es_archives` folder.
+The current archives can be found in `x-pack/test/siem_cypress/es_archives/`.
- auditbeat
- Auditbeat data generated in Sep, 2019 with the following hosts present:
@@ -197,9 +187,9 @@ The current sets of data can be found in: `x-pack/test/siem_cypress/es_archives`
- signals
- Set of data with 108 opened signals linked to "Signals test" custom rule.
-### How to generate new test data
+### How to generate a new archive
-We are using es_archiver in order to generate the data that our Cypress tests needs.
+We are using es_archiver in order to manage the data that our Cypress tests needs.
1. Setup if possible a clean instance of kibana and elasticsearch (if not, possible please try to clean the data that you are going to generate).
2. With the kibana and elasticsearch instance up and running, create the data that you need for your test.
diff --git a/x-pack/legacy/plugins/siem/public/components/alerts_viewer/alerts_table.tsx b/x-pack/legacy/plugins/siem/public/components/alerts_viewer/alerts_table.tsx
index 05d8f97bb8849..dd608babef48f 100644
--- a/x-pack/legacy/plugins/siem/public/components/alerts_viewer/alerts_table.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/alerts_viewer/alerts_table.tsx
@@ -17,7 +17,7 @@ export interface OwnProps {
start: number;
}
-const ALERTS_TABLE_ID = 'timeline-alerts-table';
+const ALERTS_TABLE_ID = 'alerts-table';
const defaultAlertsFilters: Filter[] = [
{
meta: {
diff --git a/x-pack/plugins/endpoint/common/generate_data.ts b/x-pack/plugins/endpoint/common/generate_data.ts
index 7c24bd9d77148..3f783d90e577d 100644
--- a/x-pack/plugins/endpoint/common/generate_data.ts
+++ b/x-pack/plugins/endpoint/common/generate_data.ts
@@ -7,7 +7,6 @@
import uuid from 'uuid';
import seedrandom from 'seedrandom';
import { AlertEvent, EndpointEvent, HostMetadata, OSFields, HostFields } from './types';
-// FIXME: move types/model to top-level
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { PolicyData } from '../public/applications/endpoint/types';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
diff --git a/x-pack/plugins/endpoint/common/types.ts b/x-pack/plugins/endpoint/common/types.ts
index a614526d92a3f..403ca9832e191 100644
--- a/x-pack/plugins/endpoint/common/types.ts
+++ b/x-pack/plugins/endpoint/common/types.ts
@@ -375,11 +375,6 @@ export interface EndpointEvent {
export type ResolverEvent = EndpointEvent | LegacyEndpointEvent;
-/**
- * The PageId type is used for the payload when firing userNavigatedToPage actions
- */
-export type PageId = 'alertsPage' | 'managementPage' | 'policyListPage';
-
/**
* Takes a @kbn/config-schema 'schema' type and returns a type that represents valid inputs.
* Similar to `TypeOf`, but allows strings as input for `schema.number()` (which is inline
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/README.md b/x-pack/plugins/endpoint/public/applications/endpoint/README.md
new file mode 100644
index 0000000000000..25bfd615d1d2c
--- /dev/null
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/README.md
@@ -0,0 +1,28 @@
+# Endpoint application
+This application provides the user interface for the Elastic Endpoint
+
+# Architecture
+The application consists of a _view_ written in React and a _model_ written in Redux.
+
+# Modules
+We structure the modules to match the architecture. `view` contains the _view_ (all React) code. `store` contains the _model_.
+
+This section covers the conventions of each top level module.
+
+# `mocks`
+This contains helper code for unit tests.
+
+## `models`
+This contains domain models. By convention, each submodule here contains methods for a single type. Domain model classes would also live here.
+
+## `store`
+This contains the _model_ of the application. All Redux and Redux middleware code (including API interactions) happen here. This module also contains the types and interfaces defining Redux actions. Each action type or interface should be commented and if it has fields, each field should be commented. Comments should be of `tsdoc` style.
+
+## `view`
+This contains the code which renders elements to the DOM. All React code goes here.
+
+## `index.tsx`
+This exports `renderApp` which instantiates the React view with the _model_.
+
+## `types.ts`
+This contains the types and interfaces. All `export`ed types or interfaces (except ones defining Redux actions, which live in `store`) should be here. Each type or interface should have a `tsdoc` style comment. Interfaces should have `tsdoc` comments on each field and types which have fields should do the same.
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/truncate_text.ts b/x-pack/plugins/endpoint/public/applications/endpoint/components/truncate_text.ts
deleted file mode 100644
index 83f4bc1e79317..0000000000000
--- a/x-pack/plugins/endpoint/public/applications/endpoint/components/truncate_text.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import styled from 'styled-components';
-
-export const TruncateText = styled.div`
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-`;
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx
index 82ac95160519c..a1999c056bf59 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx
@@ -6,19 +6,10 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
-import { CoreStart, AppMountParameters, ScopedHistory } from 'kibana/public';
-import { FormattedMessage } from '@kbn/i18n/react';
-import { Route, Switch } from 'react-router-dom';
-import { Store } from 'redux';
+import { CoreStart, AppMountParameters } from 'kibana/public';
import { EndpointPluginStartDependencies } from '../../plugin';
import { appStoreFactory } from './store';
-import { AlertIndex } from './view/alerts';
-import { HostList } from './view/hosts';
-import { PolicyList } from './view/policy';
-import { PolicyDetails } from './view/policy';
-import { HeaderNavigation } from './components/header_nav';
-import { AppRootProvider } from './view/app_root_provider';
-import { Setup } from './view/setup';
+import { AppRoot } from './view/app_root';
/**
* This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle.
@@ -37,41 +28,3 @@ export function renderApp(
ReactDOM.unmountComponentAtNode(element);
};
}
-
-interface RouterProps {
- history: ScopedHistory;
- store: Store;
- coreStart: CoreStart;
- depsStart: EndpointPluginStartDependencies;
-}
-
-const AppRoot: React.FunctionComponent = React.memo(
- ({ history, store, coreStart, depsStart }) => {
- return (
-
-
-
-
- (
-
-
-
- )}
- />
-
-
-
-
- (
-
- )}
- />
-
-
- );
- }
-);
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/index.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/index.ts
index f63910a1c305e..5545218d9abd6 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/index.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/index.ts
@@ -6,4 +6,3 @@
export { alertListReducer } from './reducer';
export { AlertAction } from './action';
-export * from '../../types';
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts
index 18248e272aada..a00ce255cbac4 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts
@@ -4,15 +4,19 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { MiddlewareFactory, PolicyData, PolicyDetailsState } from '../../types';
+import {
+ MiddlewareFactory,
+ PolicyData,
+ PolicyDetailsState,
+ UpdateDatasourceResponse,
+} from '../../types';
import { policyIdFromParams, isOnPolicyDetailsPage, policyDetails } from './selectors';
+import { generatePolicy } from '../../models/policy';
import {
sendGetDatasource,
sendGetFleetAgentStatusForConfig,
sendPutDatasource,
- UpdateDatasourceResponse,
-} from '../../services/ingest';
-import { generatePolicy } from '../../models/policy';
+} from '../policy_list/services/ingest';
export const policyDetailsMiddlewareFactory: MiddlewareFactory = coreStart => {
const http = coreStart.http;
@@ -35,7 +39,6 @@ export const policyDetailsMiddlewareFactory: MiddlewareFactory = coreStart => {
const http = coreStart.http;
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/services/ingest.test.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/services/ingest.test.ts
similarity index 95%
rename from x-pack/plugins/endpoint/public/applications/endpoint/services/ingest.test.ts
rename to x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/services/ingest.test.ts
index a2c1dfbe09a48..c2865d36c95f2 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/services/ingest.test.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/services/ingest.test.ts
@@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { httpServiceMock } from '../../../../../../../src/core/public/mocks';
import { sendGetDatasource, sendGetEndpointSpecificDatasources } from './ingest';
+import { httpServiceMock } from '../../../../../../../../../src/core/public/mocks';
describe('ingest service', () => {
let http: ReturnType;
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/services/ingest.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/services/ingest.ts
similarity index 77%
rename from x-pack/plugins/endpoint/public/applications/endpoint/services/ingest.ts
rename to x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/services/ingest.ts
index 583ebc55d896b..16c885f26f0a4 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/services/ingest.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/services/ingest.ts
@@ -6,37 +6,21 @@
import { HttpFetchOptions, HttpStart } from 'kibana/public';
import {
- CreateDatasourceResponse,
- GetAgentStatusResponse,
GetDatasourcesRequest,
-} from '../../../../../ingest_manager/common/types/rest_spec';
-import { NewPolicyData, PolicyData } from '../types';
+ GetAgentStatusResponse,
+} from '../../../../../../../ingest_manager/common';
+import {
+ NewPolicyData,
+ GetDatasourcesResponse,
+ GetDatasourceResponse,
+ UpdateDatasourceResponse,
+} from '../../../types';
const INGEST_API_ROOT = `/api/ingest_manager`;
const INGEST_API_DATASOURCES = `${INGEST_API_ROOT}/datasources`;
const INGEST_API_FLEET = `${INGEST_API_ROOT}/fleet`;
const INGEST_API_FLEET_AGENT_STATUS = `${INGEST_API_FLEET}/agent-status`;
-// FIXME: Import from ingest after - https://github.com/elastic/kibana/issues/60677
-export interface GetDatasourcesResponse {
- items: PolicyData[];
- total: number;
- page: number;
- perPage: number;
- success: boolean;
-}
-
-// FIXME: Import from Ingest after - https://github.com/elastic/kibana/issues/60677
-export interface GetDatasourceResponse {
- item: PolicyData;
- success: boolean;
-}
-
-// FIXME: Import from Ingest after - https://github.com/elastic/kibana/issues/60677
-export type UpdateDatasourceResponse = CreateDatasourceResponse & {
- item: PolicyData;
-};
-
/**
* Retrieves a list of endpoint specific datasources (those created with a `package.name` of
* `endpoint`) from Ingest
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/routing/action.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/routing/action.ts
index c7e9970e58c30..f22272bc68233 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/store/routing/action.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/routing/action.ts
@@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { PageId, Immutable } from '../../../../../common/types';
-import { EndpointAppLocation } from '../alerts';
+import { Immutable } from '../../../../../common/types';
+import { EndpointAppLocation, PageId } from '../../types';
interface UserNavigatedToPage {
readonly type: 'userNavigatedToPage';
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/types.ts b/x-pack/plugins/endpoint/public/applications/endpoint/types.ts
index dda50847169e7..f9ad8f6708f6b 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/types.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/types.ts
@@ -18,7 +18,10 @@ import { EndpointPluginStartDependencies } from '../../plugin';
import { AppAction } from './store/action';
import { CoreStart } from '../../../../../../src/core/public';
import { Datasource, NewDatasource } from '../../../../ingest_manager/common/types/models';
-import { GetAgentStatusResponse } from '../../../../ingest_manager/common/types/rest_spec';
+import {
+ GetAgentStatusResponse,
+ CreateDatasourceResponse,
+} from '../../../../ingest_manager/common/types/rest_spec';
export { AppAction };
export type MiddlewareFactory = (
@@ -317,3 +320,25 @@ export interface AlertingIndexUIQueryParams {
date_range?: string;
filters?: string;
}
+
+export interface GetDatasourcesResponse {
+ items: PolicyData[];
+ total: number;
+ page: number;
+ perPage: number;
+ success: boolean;
+}
+
+export interface GetDatasourceResponse {
+ item: PolicyData;
+ success: boolean;
+}
+
+export type UpdateDatasourceResponse = CreateDatasourceResponse & {
+ item: PolicyData;
+};
+
+/**
+ * The PageId type is used for the payload when firing userNavigatedToPage actions
+ */
+export type PageId = 'alertsPage' | 'managementPage' | 'policyListPage';
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/app_root.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/app_root.tsx
new file mode 100644
index 0000000000000..f9634c63deefb
--- /dev/null
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/app_root.tsx
@@ -0,0 +1,59 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+import * as React from 'react';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { Route, Switch } from 'react-router-dom';
+import { Store } from 'redux';
+import { AlertIndex } from './alerts';
+import { HostList } from './hosts';
+import { PolicyList } from './policy';
+import { PolicyDetails } from './policy';
+import { HeaderNavigation } from './components/header_navigation';
+import { AppRootProvider } from './app_root_provider';
+import { Setup } from './setup';
+import { EndpointPluginStartDependencies } from '../../../plugin';
+import { ScopedHistory, CoreStart } from '../../../../../../../src/core/public';
+
+interface RouterProps {
+ history: ScopedHistory;
+ store: Store;
+ coreStart: CoreStart;
+ depsStart: EndpointPluginStartDependencies;
+}
+
+/**
+ * The root of the Endpoint application react view.
+ */
+export const AppRoot: React.FunctionComponent = React.memo(
+ ({ history, store, coreStart, depsStart }) => {
+ return (
+
+
+
+
+ (
+
+
+
+ )}
+ />
+
+
+
+
+ (
+
+ )}
+ />
+
+
+ );
+ }
+);
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/__snapshots__/link_to_app.test.tsx.snap b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/__snapshots__/link_to_app.test.tsx.snap
similarity index 100%
rename from x-pack/plugins/endpoint/public/applications/endpoint/components/__snapshots__/link_to_app.test.tsx.snap
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/components/__snapshots__/link_to_app.test.tsx.snap
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/__snapshots__/page_view.test.tsx.snap b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/__snapshots__/page_view.test.tsx.snap
similarity index 100%
rename from x-pack/plugins/endpoint/public/applications/endpoint/components/__snapshots__/page_view.test.tsx.snap
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/components/__snapshots__/page_view.test.tsx.snap
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/header_navigation.tsx
similarity index 90%
rename from x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/components/header_navigation.tsx
index 3fb06d6b4a56e..6c294d9c86548 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/header_navigation.tsx
@@ -8,15 +8,16 @@ import React, { MouseEvent, useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiTabs, EuiTab } from '@elastic/eui';
import { useHistory, useLocation } from 'react-router-dom';
-import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
+import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public';
+import { Immutable } from '../../../../../common/types';
-export interface NavTabs {
+interface NavTabs {
name: string;
id: string;
href: string;
}
-export const navTabs: NavTabs[] = [
+const navTabs: Immutable = [
{
id: 'home',
name: i18n.translate('xpack.endpoint.headerNav.home', {
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/link_to_app.test.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/link_to_app.test.tsx
similarity index 86%
rename from x-pack/plugins/endpoint/public/applications/endpoint/components/link_to_app.test.tsx
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/components/link_to_app.test.tsx
index 902c215434aac..d0a8f9690dafb 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/components/link_to_app.test.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/link_to_app.test.tsx
@@ -7,9 +7,14 @@
import React from 'react';
import { mount } from 'enzyme';
import { LinkToApp } from './link_to_app';
-import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';
-import { coreMock } from '../../../../../../../src/core/public/mocks';
import { CoreStart } from 'kibana/public';
+import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
+import { coreMock } from '../../../../../../../../src/core/public/mocks';
+
+type LinkToAppOnClickMock = jest.Mock<
+ Return,
+ [React.MouseEvent]
+>;
describe('LinkToApp component', () => {
let fakeCoreStart: jest.Mocked;
@@ -38,7 +43,8 @@ describe('LinkToApp component', () => {
).toMatchSnapshot();
});
it('should support onClick prop', () => {
- const spyOnClickHandler = jest.fn();
+ // Take `_event` (even though it is not used) so that `jest.fn` will have a type that expects to be called with an event
+ const spyOnClickHandler: LinkToAppOnClickMock = jest.fn(_event => {});
const renderResult = render(
link
@@ -91,7 +97,8 @@ describe('LinkToApp component', () => {
});
});
it('should still preventDefault if onClick callback throws', () => {
- const spyOnClickHandler = jest.fn(ev => {
+ // Take `_event` (even though it is not used) so that `jest.fn` will have a type that expects to be called with an event
+ const spyOnClickHandler: LinkToAppOnClickMock = jest.fn(_event => {
throw new Error('test');
});
const renderResult = render(
@@ -104,7 +111,7 @@ describe('LinkToApp component', () => {
expect(clickEventArg.isDefaultPrevented()).toBe(true);
});
it('should not navigate if onClick callback prevents defalut', () => {
- const spyOnClickHandler = jest.fn(ev => {
+ const spyOnClickHandler: LinkToAppOnClickMock = jest.fn(ev => {
ev.preventDefault();
});
const renderResult = render(
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/link_to_app.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/link_to_app.tsx
similarity index 96%
rename from x-pack/plugins/endpoint/public/applications/endpoint/components/link_to_app.tsx
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/components/link_to_app.tsx
index 858dac864b58a..6a3cf5e78f4bf 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/components/link_to_app.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/link_to_app.tsx
@@ -9,7 +9,7 @@ import { EuiLink } from '@elastic/eui';
import { EuiLinkProps } from '@elastic/eui';
import { useNavigateToAppEventHandler } from '../hooks/use_navigate_to_app_event_handler';
-export type LinkToAppProps = EuiLinkProps & {
+type LinkToAppProps = EuiLinkProps & {
/** the app id - normally the value of the `id` in that plugin's `kibana.json` */
appId: string;
/** Any app specific path (route) */
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/page_view.test.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/page_view.test.tsx
similarity index 96%
rename from x-pack/plugins/endpoint/public/applications/endpoint/components/page_view.test.tsx
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/components/page_view.test.tsx
index 0d4d26737d355..4007477a088fa 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/components/page_view.test.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/page_view.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { mount } from 'enzyme';
import { PageView } from './page_view';
-import { EuiThemeProvider } from '../../../../../../legacy/common/eui_styled_components';
+import { EuiThemeProvider } from '../../../../../../../legacy/common/eui_styled_components';
describe('PageView component', () => {
const render = (ui: Parameters[0]) =>
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/page_view.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/components/page_view.tsx
similarity index 100%
rename from x-pack/plugins/endpoint/public/applications/endpoint/components/page_view.tsx
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/components/page_view.tsx
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/hooks/use_navigate_to_app_event_handler.ts b/x-pack/plugins/endpoint/public/applications/endpoint/view/hooks/use_navigate_to_app_event_handler.ts
similarity index 96%
rename from x-pack/plugins/endpoint/public/applications/endpoint/hooks/use_navigate_to_app_event_handler.ts
rename to x-pack/plugins/endpoint/public/applications/endpoint/view/hooks/use_navigate_to_app_event_handler.ts
index 5fbfa5e0e58a8..ec9a8691c481e 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/hooks/use_navigate_to_app_event_handler.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/hooks/use_navigate_to_app_event_handler.ts
@@ -6,7 +6,7 @@
import { MouseEventHandler, useCallback } from 'react';
import { ApplicationStart } from 'kibana/public';
-import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
+import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public';
type NavigateToAppHandlerProps = Parameters;
type EventHandlerCallback = MouseEventHandler;
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/details.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/details.tsx
index 90829f7ad4cbe..f51349b24933a 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/details.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/details.tsx
@@ -28,7 +28,7 @@ import { useHostListSelector } from './hooks';
import { urlFromQueryParams } from './url_from_query_params';
import { FormattedDateAndTime } from '../formatted_date_time';
import { uiQueryParams, detailsData, detailsError } from './../../store/hosts/selectors';
-import { LinkToApp } from '../../components/link_to_app';
+import { LinkToApp } from '../components/link_to_app';
const HostIds = styled(EuiListGroupItem)`
margin-top: 0;
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/index.test.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/index.test.tsx
index c3ff41268e3db..d2d0ad40b025f 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/index.test.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/hosts/index.test.tsx
@@ -151,7 +151,6 @@ describe('when on the hosts page', () => {
});
it('should navigate to logs without full page refresh', async () => {
- // FIXME: this is not working :(
expect(coreStart.application.navigateToApp.mock.calls).toHaveLength(1);
});
});
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx
index 1e723e32615eb..267077da6598c 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx
@@ -29,7 +29,7 @@ import {
isLoading,
apiError,
} from '../../store/policy_details/selectors';
-import { PageView, PageViewHeaderTitle } from '../../components/page_view';
+import { PageView, PageViewHeaderTitle } from '../components/page_view';
import { AppAction } from '../../types';
import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public';
import { AgentsSummary } from './agents_summary';
@@ -82,7 +82,7 @@ export const PolicyDetails = React.memo(() => {
}
}, [notifications.toasts, policyItem, policyName, policyUpdateStatus]);
- const handleBackToListOnClick = useCallback(
+ const handleBackToListOnClick: React.MouseEventHandler = useCallback(
ev => {
ev.preventDefault();
history.push(`/policy`);
@@ -161,7 +161,6 @@ export const PolicyDetails = React.memo(() => {
fill={true}
iconType="save"
data-test-subj="policyDetailsSaveButton"
- // FIXME: need to disable if User has no write permissions to ingest - see: https://github.com/elastic/endpoint-app-team/issues/296
onClick={handleSaveOnClick}
isLoading={isPolicyLoading}
>
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx
index 5ee1539ce9788..06ba74aa46732 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx
@@ -23,8 +23,8 @@ import { usePolicyListSelector } from './policy_hooks';
import { PolicyListAction } from '../../store/policy_list';
import { PolicyData } from '../../types';
import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public';
-import { PageView } from '../../components/page_view';
-import { LinkToApp } from '../../components/link_to_app';
+import { PageView } from '../components/page_view';
+import { LinkToApp } from '../components/link_to_app';
interface TableChangeCallbackArguments {
page: { index: number; size: number };
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/use_page_id.ts b/x-pack/plugins/endpoint/public/applications/endpoint/view/use_page_id.ts
index 49c39064c8d9a..85ed8a39fb386 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/view/use_page_id.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/use_page_id.ts
@@ -6,8 +6,8 @@
import { useEffect } from 'react';
import { useDispatch } from 'react-redux';
-import { PageId } from '../../../../common/types';
import { RoutingAction } from '../store/routing';
+import { PageId } from '../types';
/**
* Dispatches a 'userNavigatedToPage' action with the given 'pageId' as the action payload.
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/shell/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/shell/index.tsx
index e6990927b926e..cb65e31fb74b5 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/shell/index.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/shell/index.tsx
@@ -43,7 +43,7 @@ export const ShellEnrollmentInstructions: React.FunctionComponent = ({
// apiKey.api_key
// } sh -c "$(curl ${kibanaUrl}/api/ingest_manager/fleet/install/${currentPlatform})"`;
- const quickInstallInstructions = `./agent enroll ${kibanaUrl} ${apiKey.api_key}`;
+ const quickInstallInstructions = `./elastic-agent enroll ${kibanaUrl} ${apiKey.api_key}`;
return (
<>
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/header.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/header.tsx
index e1f29fdbeb323..1aab6d901a992 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/header.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/header.tsx
@@ -7,14 +7,15 @@ import React, { memo } from 'react';
import styled from 'styled-components';
import { EuiFlexGroup, EuiFlexItem, EuiTabs, EuiTab, EuiSpacer } from '@elastic/eui';
import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab';
+import { EuiFlexItemProps } from '@elastic/eui/src/components/flex/flex_item';
const Container = styled.div`
border-bottom: ${props => props.theme.eui.euiBorderThin};
background-color: ${props => props.theme.eui.euiPageBackgroundColor};
`;
-const Wrapper = styled.div`
- max-width: 1200px;
+const Wrapper = styled.div<{ maxWidth?: number }>`
+ max-width: ${props => props.maxWidth || 1200}px;
margin-left: auto;
margin-right: auto;
padding-top: ${props => props.theme.eui.paddingSizes.xl};
@@ -30,22 +31,36 @@ const Tabs = styled(EuiTabs)`
`;
export interface HeaderProps {
+ restrictHeaderWidth?: number;
leftColumn?: JSX.Element;
rightColumn?: JSX.Element;
+ rightColumnGrow?: EuiFlexItemProps['grow'];
tabs?: EuiTabProps[];
}
-const HeaderColumns: React.FC> = memo(({ leftColumn, rightColumn }) => (
-
- {leftColumn ? {leftColumn} : null}
- {rightColumn ? {rightColumn} : null}
-
-));
+const HeaderColumns: React.FC> = memo(
+ ({ leftColumn, rightColumn, rightColumnGrow }) => (
+
+ {leftColumn ? {leftColumn} : null}
+ {rightColumn ? {rightColumn} : null}
+
+ )
+);
-export const Header: React.FC = ({ leftColumn, rightColumn, tabs }) => (
+export const Header: React.FC = ({
+ leftColumn,
+ rightColumn,
+ rightColumnGrow,
+ tabs,
+ restrictHeaderWidth,
+}) => (
-
-
+
+
{tabs ? (
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/confirm_modal.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/confirm_modal.tsx
new file mode 100644
index 0000000000000..aa7eab8f5be8d
--- /dev/null
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/confirm_modal.tsx
@@ -0,0 +1,72 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import React from 'react';
+import { EuiCallOut, EuiOverlayMask, EuiConfirmModal, EuiSpacer } from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { i18n } from '@kbn/i18n';
+import { AgentConfig } from '../../../../types';
+
+export const ConfirmCreateDatasourceModal: React.FunctionComponent<{
+ onConfirm: () => void;
+ onCancel: () => void;
+ agentCount: number;
+ agentConfig: AgentConfig;
+}> = ({ onConfirm, onCancel, agentCount, agentConfig }) => {
+ return (
+
+
+ }
+ onCancel={onCancel}
+ onConfirm={onConfirm}
+ cancelButtonText={
+
+ }
+ confirmButtonText={
+
+ }
+ buttonColor="primary"
+ >
+
+ {agentConfig.name},
+ }}
+ />
+
+
+
+
+
+ );
+};
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/index.ts b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/index.ts
index 3bfca75668911..aa564690a6092 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/index.ts
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/index.ts
@@ -5,4 +5,5 @@
*/
export { CreateDatasourcePageLayout } from './layout';
export { DatasourceInputPanel } from './datasource_input_panel';
+export { ConfirmCreateDatasourceModal } from './confirm_modal';
export { DatasourceInputVarField } from './datasource_input_var_field';
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/layout.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/layout.tsx
index dd242f366e8c0..73a7ba8ec119d 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/layout.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_datasource_page/components/layout.tsx
@@ -19,108 +19,107 @@ import { WithHeaderLayout } from '../../../../layouts';
import { AgentConfig, PackageInfo } from '../../../../types';
import { PackageIcon } from '../../../../components/package_icon';
import { CreateDatasourceFrom, CreateDatasourceStep } from '../types';
-import { CreateDatasourceStepsNavigation } from './navigation';
export const CreateDatasourcePageLayout: React.FunctionComponent<{
from: CreateDatasourceFrom;
basePath: string;
cancelUrl: string;
maxStep: CreateDatasourceStep | '';
- currentStep: CreateDatasourceStep;
agentConfig?: AgentConfig;
packageInfo?: PackageInfo;
- restrictWidth?: number;
-}> = ({
- from,
- basePath,
- cancelUrl,
- maxStep,
- currentStep,
- agentConfig,
- packageInfo,
- restrictWidth,
- children,
-}) => {
- return (
-
-
-
+}> = ({ from, basePath, cancelUrl, maxStep, agentConfig, packageInfo, children }) => {
+ const leftColumn = (
+
+
+
+
+
+
+
+
+