Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a451347
Public in WiP state, removed all 'ui/' imports
jloleysens Mar 12, 2020
68577fe
First iteration of public shimmed and working
jloleysens Mar 13, 2020
0b1d330
A whole lotta WIP server side
jloleysens Mar 13, 2020
891ffa2
Server-side to using the NP router + client side changes
jloleysens Mar 13, 2020
7d8d0cc
Removed unused error wrapping code
jloleysens Mar 13, 2020
7030891
Update client Jest tests
jloleysens Mar 16, 2020
75f79c7
Add breadcrumbs service mock
jloleysens Mar 16, 2020
430b491
Fix server side Jest tests
jloleysens Mar 16, 2020
be87bab
Add helper functions file for server side Jest tests
jloleysens Mar 16, 2020
c602fba
Fix API integration tests
jloleysens Mar 16, 2020
37e4b8c
Fixed boolean logic mistake in due to refactor in index mgmt ext.
jloleysens Mar 16, 2020
4bf83cf
Remove unused import
jloleysens Mar 16, 2020
a77999c
Merge branch 'master' into np-shim/cross-cluster-replication
elasticmachine Mar 16, 2020
390dc6b
Clean up some cruft and refactor URL variable names
jloleysens Mar 16, 2020
49631db
Fix stringification of body and fix boolean server logic
jloleysens Mar 16, 2020
50430e7
Merge branch 'master' into np-shim/cross-cluster-replication
elasticmachine Mar 17, 2020
a38eeb4
Fix mocha
jloleysens Mar 17, 2020
ca2cd89
Refactor to Jest test
jloleysens Mar 17, 2020
3cbb917
Fix types issues in jest test
jloleysens Mar 17, 2020
e2f7a22
Merge branch 'master' of github.com:elastic/kibana into np-shim/cross…
jloleysens Mar 19, 2020
b4bd35f
Migrate to new config-schema API
jloleysens Mar 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { AutoFollowPatternForm } from '../../public/app/components/auto_follow_pattern_form';
import { AutoFollowPatternForm } from '../../public/np_ready/app/components/auto_follow_pattern_form';
import { setupEnvironment, pageHelpers, nextTick } from './helpers';
import { AUTO_FOLLOW_PATTERN_EDIT } from './helpers/constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { setupEnvironment, pageHelpers, nextTick } from './helpers';
import { RemoteClustersFormField } from '../../public/app/components';
import { RemoteClustersFormField } from '../../public/np_ready/app/components';

import { indexPatterns } from '../../../../../../src/plugins/data/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { setupEnvironment, pageHelpers, nextTick } from './helpers';
import { FollowerIndexForm } from '../../public/app/components/follower_index_form/follower_index_form';
import { FollowerIndexForm } from '../../public/np_ready/app/components/follower_index_form/follower_index_form';
import { FOLLOWER_INDEX_EDIT } from './helpers/constants';

jest.mock('ui/new_platform');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { registerTestBed } from '../../../../../../test_utils';
import { AutoFollowPatternAdd } from '../../../public/app/sections/auto_follow_pattern_add';
import { ccrStore } from '../../../public/app/store';
import routing from '../../../public/app/services/routing';
import { AutoFollowPatternAdd } from '../../../public/np_ready/app/sections/auto_follow_pattern_add';
import { ccrStore } from '../../../public/np_ready/app/store';
import routing from '../../../public/np_ready/app/services/routing';

const testBedConfig = {
store: ccrStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { registerTestBed } from '../../../../../../test_utils';
import { AutoFollowPatternEdit } from '../../../public/app/sections/auto_follow_pattern_edit';
import { ccrStore } from '../../../public/app/store';
import routing from '../../../public/app/services/routing';
import { AutoFollowPatternEdit } from '../../../public/np_ready/app/sections/auto_follow_pattern_edit';
import { ccrStore } from '../../../public/np_ready/app/store';
import routing from '../../../public/np_ready/app/services/routing';

import { AUTO_FOLLOW_PATTERN_EDIT_NAME } from './constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { registerTestBed, findTestSubject } from '../../../../../../test_utils';
import { AutoFollowPatternList } from '../../../public/app/sections/home/auto_follow_pattern_list';
import { ccrStore } from '../../../public/app/store';
import routing from '../../../public/app/services/routing';
import { AutoFollowPatternList } from '../../../public/np_ready/app/sections/home/auto_follow_pattern_list';
import { ccrStore } from '../../../public/np_ready/app/store';
import routing from '../../../public/np_ready/app/services/routing';

const testBedConfig = {
store: ccrStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { registerTestBed } from '../../../../../../test_utils';
import { FollowerIndexAdd } from '../../../public/app/sections/follower_index_add';
import { ccrStore } from '../../../public/app/store';
import routing from '../../../public/app/services/routing';
import { FollowerIndexAdd } from '../../../public/np_ready/app/sections/follower_index_add';
import { ccrStore } from '../../../public/np_ready/app/store';
import routing from '../../../public/np_ready/app/services/routing';

const testBedConfig = {
store: ccrStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { registerTestBed } from '../../../../../../test_utils';
import { FollowerIndexEdit } from '../../../public/app/sections/follower_index_edit';
import { ccrStore } from '../../../public/app/store';
import routing from '../../../public/app/services/routing';
import { FollowerIndexEdit } from '../../../public/np_ready/app/sections/follower_index_edit';
import { ccrStore } from '../../../public/np_ready/app/store';
import routing from '../../../public/np_ready/app/services/routing';

import { FOLLOWER_INDEX_EDIT_NAME } from './constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { registerTestBed, findTestSubject } from '../../../../../../test_utils';
import { FollowerIndicesList } from '../../../public/app/sections/home/follower_indices_list';
import { ccrStore } from '../../../public/app/store';
import routing from '../../../public/app/services/routing';
import { FollowerIndicesList } from '../../../public/np_ready/app/sections/home/follower_indices_list';
import { ccrStore } from '../../../public/np_ready/app/store';
import routing from '../../../public/np_ready/app/services/routing';

const testBedConfig = {
store: ccrStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { registerTestBed } from '../../../../../../test_utils';
import { CrossClusterReplicationHome } from '../../../public/app/sections/home/home';
import { ccrStore } from '../../../public/app/store';
import routing from '../../../public/app/services/routing';
import { CrossClusterReplicationHome } from '../../../public/np_ready/app/sections/home/home';
import { ccrStore } from '../../../public/np_ready/app/store';
import routing from '../../../public/np_ready/app/services/routing';
import { BASE_PATH } from '../../../common/constants';

const testBedConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import axios from 'axios';
import axiosXhrAdapter from 'axios/lib/adapters/xhr';

import { setHttpClient } from '../../../public/app/services/api';
import { setHttpClient } from '../../../public/np_ready/app/services/api';
import { init as initHttpRequests } from './http_requests';

export const setupEnvironment = () => {
Expand Down
20 changes: 8 additions & 12 deletions x-pack/legacy/plugins/cross_cluster_replication/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

import { resolve } from 'path';
import { PLUGIN } from './common/constants';
import { registerLicenseChecker } from './server/lib/register_license_checker';
import { registerRoutes } from './server/routes/register_routes';
import { ccrDataEnricher } from './cross_cluster_replication_data';
import { plugin } from './server/np_ready';

export function crossClusterReplication(kibana) {
return new kibana.Plugin({
Expand Down Expand Up @@ -47,15 +45,13 @@ export function crossClusterReplication(kibana) {
);
},
init: function initCcrPlugin(server) {
registerLicenseChecker(server);
registerRoutes(server);
if (
server.config().get('xpack.ccr.ui.enabled') &&
server.newPlatform.setup.plugins.indexManagement &&
server.newPlatform.setup.plugins.indexManagement.indexDataEnricher
) {
server.newPlatform.setup.plugins.indexManagement.indexDataEnricher.add(ccrDataEnricher);
}
plugin({}).setup(server.newPlatform.setup.core, {
indexManagement: server.newPlatform.setup.plugins.indexManagement,
__LEGACY: {
server,
ccrUIEnabled: server.config().get('xpack.ccr.ui.enabled'),
},
});
},
});
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
// ccrChart__legend--small
// ccrChart__legend-isLoading

@import 'app/app';
@import 'np_ready/app/app';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { Route, Switch, Redirect, withRouter } from 'react-router-dom';
import { fatalError } from 'ui/notify';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

Expand All @@ -21,7 +20,8 @@ import {
EuiTitle,
} from '@elastic/eui';

import { BASE_PATH } from '../../common/constants';
import { BASE_PATH } from '../../../common/constants';
import { getFatalErrors } from './services/notifications';
import { SectionError } from './components';
import routing from './services/routing';
import { loadPermissions } from './services/api';
Expand Down Expand Up @@ -81,7 +81,7 @@ class AppComponent extends Component {
});
} catch (error) {
// Expect an error in the shape provided by Angular's $http service.
if (error && error.data) {
if (error && error.body) {
return this.setState({
isFetchingPermissions: false,
fetchPermissionError: error,
Expand All @@ -90,7 +90,7 @@ class AppComponent extends Component {

// This error isn't an HTTP error, so let the fatal error screen tell the user something
// unexpected happened.
fatalError(
getFatalErrors().add(
error,
i18n.translate('xpack.crossClusterReplication.app.checkPermissionsFatalErrorTitle', {
defaultMessage: 'Cross-Cluster Replication app',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from './auto_follow_pattern_action_menu';

// @ts-ignore
import { pauseAutoFollowPattern, resumeAutoFollowPattern } from '../../store/actions';
import { pauseAutoFollowPattern, resumeAutoFollowPattern } from '../../store/actions/index';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by 👍 I mean no of course 😄


const mapDispatchToProps = (dispatch: (action: any) => void) => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';

import { deleteAutoFollowPattern } from '../store/actions';
import { arrify } from '../../../common/services/utils';
import { arrify } from '../../../../common/services/utils';

class AutoFollowPatternDeleteProviderUi extends PureComponent {
state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import {
EuiTitle,
} from '@elastic/eui';

import { INDEX_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/indices';
import { indexPatterns } from '../../../../../../../../src/plugins/data/public';

import routing from '../services/routing';
import { extractQueryParams } from '../services/query_params';
import { getRemoteClusterName } from '../services/get_remote_cluster_name';
import { API_STATUS } from '../constants';
import { API_STATUS, INDEX_ILLEGAL_CHARACTERS_VISIBLE } from '../constants';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should be able to import INDEX_ILLEGAL_CHARACTERS_VISIBLE once #60186 is merged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I saw this guy coming up! I'll resolve once it is merged.

import { SectionError } from './section_error';
import { AutoFollowPatternIndicesPreview } from './auto_follow_pattern_indices_preview';
import { RemoteClustersFormField } from './remote_clusters_form_field';
Expand All @@ -44,7 +44,6 @@ import {
} from '../services/auto_follow_pattern_validators';

import { AutoFollowPatternRequestFlyout } from './auto_follow_pattern_request_flyout';
import { indexPatterns } from '../../../../../../../src/plugins/data/public';

const indexPatternIllegalCharacters = indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.join(' ');
const indexNameIllegalCharacters = INDEX_ILLEGAL_CHARACTERS_VISIBLE.join(' ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const AutoFollowPatternPageTitle = ({ title }) => (
<EuiButtonEmpty
size="s"
flush="right"
href={autoFollowPatternUrl}
href={autoFollowPatternUrl()}
target="_blank"
iconType="help"
data-test-subj="docsButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
EuiTitle,
} from '@elastic/eui';

import { serializeAutoFollowPattern } from '../../../common/services/auto_follow_pattern_serialization';
import { serializeAutoFollowPattern } from '../../../../common/services/auto_follow_pattern_serialization';

export class AutoFollowPatternRequestFlyout extends PureComponent {
static propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const byteUnitsHelpText = (
defaultMessage="Example values: 10b, 1024kb, 1mb, 5gb, 2tb, 1pb. {link}"
values={{
link: (
<a href={byteUnitsUrl} target="_blank">
<a href={byteUnitsUrl()} target="_blank">
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexForm.advancedSettings.byteUnitsHelpTextLinkMessage"
defaultMessage="Learn more"
Expand All @@ -33,7 +33,7 @@ const timeUnitsHelpText = (
defaultMessage="Example values: 2d, 24h, 20m, 30s, 500ms, 10000micros, 80000nanos. {link}"
values={{
link: (
<a href={timeUnitsUrl} target="_blank">
<a href={timeUnitsUrl()} target="_blank">
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexForm.advancedSettings.timeUnitsHelpTextLinkMessage"
defaultMessage="Learn more"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import PropTypes from 'prop-types';
import { debounce } from 'lodash';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { INDEX_ILLEGAL_CHARACTERS_VISIBLE } from 'ui/indices';
import { fatalError } from 'ui/notify';

import {
EuiButton,
Expand All @@ -32,8 +30,9 @@ import {

import { indexNameValidator, leaderIndexValidator } from '../../services/input_validation';
import routing from '../../services/routing';
import { getFatalErrors } from '../../services/notifications';
import { loadIndices } from '../../services/api';
import { API_STATUS } from '../../constants';
import { API_STATUS, INDEX_ILLEGAL_CHARACTERS_VISIBLE } from '../../constants';
import { SectionError } from '../section_error';
import { FormEntryRow } from '../form_entry_row';
import {
Expand Down Expand Up @@ -138,7 +137,7 @@ export class FollowerIndexForm extends PureComponent {
};

this.cachedAdvancedSettings = {};
this.validateIndexName = debounce(this.validateIndexName, 500);
this.validateIndexName = debounce(this.validateIndexName, 500, { trailing: true });
}

toggleRequest = () => {
Expand Down Expand Up @@ -223,18 +222,24 @@ export class FollowerIndexForm extends PureComponent {
isValidatingIndexName: false,
});
} catch (error) {
// Expect an error in the shape provided by Angular's $http service.
if (error && error.data) {
// All validation does is check for a name collision, so we can just let the user attempt
// to save the follower index and get an error back from the API.
return this.setState({
isValidatingIndexName: false,
});
if (error) {
if (error.name === 'AbortError') {
// Ignore aborted requests
return;
}
// This could be an HTTP error
if (error.body) {
// All validation does is check for a name collision, so we can just let the user attempt
// to save the follower index and get an error back from the API.
return this.setState({
isValidatingIndexName: false,
});
}
}

// This error isn't an HTTP error, so let the fatal error screen tell the user something
// unexpected happened.
fatalError(
getFatalErrors().add(
error,
i18n.translate(
'xpack.crossClusterReplication.followerIndexForm.indexNameValidationFatalErrorTitle',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { updateFields, updateFormErrors } from './follower_index_form';

jest.mock('ui/new_platform');
jest.mock('ui/indices', () => ({
jest.mock('../../constants', () => ({
INDEX_ILLEGAL_CHARACTERS_VISIBLE: [],
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
EuiTitle,
} from '@elastic/eui';

import { serializeFollowerIndex } from '../../../../common/services/follower_index_serialization';
import { serializeFollowerIndex } from '../../../../../common/services/follower_index_serialization';

export class FollowerIndexRequestFlyout extends PureComponent {
static propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const FollowerIndexPageTitle = ({ title }) => (
<EuiButtonEmpty
size="s"
flush="right"
href={followerIndexUrl}
href={followerIndexUrl()}
target="_blank"
iconType="help"
data-test-subj="docsButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';

import { pauseFollowerIndex } from '../store/actions';
import { arrify } from '../../../common/services/utils';
import { arrify } from '../../../../common/services/utils';
import { areAllSettingsDefault } from '../services/follower_index_default_settings';

class FollowerIndexPauseProviderUi extends PureComponent {
Expand Down
Loading