Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import '../../public/np_ready/app/services/breadcrumbs.mock';
import { setupEnvironment, pageHelpers, nextTick, getRandomString } from './helpers';
import { indexPatterns } from '../../../../../../src/plugins/data/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { AutoFollowPatternForm } from '../../public/app/components/auto_follow_pattern_form';
import '../../public/np_ready/app/services/breadcrumbs.mock';
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 @@ -4,21 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

import '../../public/np_ready/app/services/breadcrumbs.mock';
import { setupEnvironment, pageHelpers, nextTick, getRandomString } from './helpers';

import { getAutoFollowPatternClientMock } from '../../fixtures/auto_follow_pattern';

jest.mock('ui/new_platform');

jest.mock('ui/chrome', () => ({
addBasePath: () => 'api/cross_cluster_replication',
breadcrumbs: { set: () => {} },
getUiSettingsClient: () => ({
get: x => x,
getUpdate$: () => ({ subscribe: jest.fn() }),
}),
}));

const { setup } = pageHelpers.autoFollowPatternList;

describe('<AutoFollowPatternList />', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import '../../public/np_ready/app/services/breadcrumbs.mock';
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 @@ -4,8 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import '../../public/np_ready/app/services/breadcrumbs.mock';
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 @@ -10,15 +10,6 @@ import { getFollowerIndexMock } from '../../fixtures/follower_index';

jest.mock('ui/new_platform');

jest.mock('ui/chrome', () => ({
addBasePath: () => 'api/cross_cluster_replication',
breadcrumbs: { set: () => {} },
getUiSettingsClient: () => ({
get: x => x,
getUpdate$: () => ({ subscribe: jest.fn() }),
}),
}));

const { setup } = pageHelpers.followerIndexList;

describe('<FollowerIndicesList />', () => {
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 @@ -19,7 +19,7 @@ const registerHttpRequestMockHelpers = server => {

server.respondWith(
'GET',
'api/cross_cluster_replication/follower_indices',
'/api/cross_cluster_replication/follower_indices',
mockResponse(defaultResponse, response)
);
};
Expand All @@ -29,7 +29,7 @@ const registerHttpRequestMockHelpers = server => {

server.respondWith(
'GET',
'api/cross_cluster_replication/auto_follow_patterns',
'/api/cross_cluster_replication/auto_follow_patterns',
mockResponse(defaultResponse, response)
);
};
Expand All @@ -39,7 +39,7 @@ const registerHttpRequestMockHelpers = server => {

server.respondWith(
'DELETE',
/api\/cross_cluster_replication\/auto_follow_patterns/,
/\/api\/cross_cluster_replication\/auto_follow_patterns/,
mockResponse(defaultResponse, response)
);
};
Expand All @@ -61,7 +61,7 @@ const registerHttpRequestMockHelpers = server => {

server.respondWith(
'GET',
'api/cross_cluster_replication/stats/auto_follow',
'/api/cross_cluster_replication/stats/auto_follow',
mockResponse(defaultResponse, response)
);
};
Expand All @@ -87,7 +87,7 @@ const registerHttpRequestMockHelpers = server => {

server.respondWith(
'GET',
/api\/cross_cluster_replication\/auto_follow_patterns\/.+/,
/\/api\/cross_cluster_replication\/auto_follow_patterns\/.+/,
mockResponse(defaultResponse, response)
);
};
Expand All @@ -105,7 +105,7 @@ const registerHttpRequestMockHelpers = server => {

server.respondWith(
'GET',
/api\/cross_cluster_replication\/follower_indices\/.+/,
/\/api\/cross_cluster_replication\/follower_indices\/.+/,
mockResponse(defaultResponse, response)
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
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 = () => {
// Mock Angular $q
const $q = { defer: () => ({ resolve() {} }) };
// axios has a $http like interface so using it to simulate $http
setHttpClient(axios.create({ adapter: axiosXhrAdapter }), $q);
// axios has a similar interface to HttpSetup, but we
// flatten out the response.
const client = axios.create({ adapter: axiosXhrAdapter });
client.interceptors.response.use(({ data }) => data);
setHttpClient(client);

const { server, httpRequestsMockHelpers } = initHttpRequests();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import '../../public/np_ready/app/services/breadcrumbs.mock';
import { setupEnvironment, pageHelpers, nextTick } from './helpers';

jest.mock('ui/new_platform');
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 @@ -5,4 +5,3 @@
*/

import './register_routes';
import './extend_index_management';
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 @@ -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,8 +29,8 @@ import {
EuiTitle,
} from '@elastic/eui';

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

import routing from '../services/routing';
import { extractQueryParams } from '../services/query_params';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
EuiTitle,
} from '@elastic/eui';

import { autoFollowPatternUrl } from '../services/documentation_links';
import { getAutoFollowPatternUrl } from '../services/documentation_links';

export const AutoFollowPatternPageTitle = ({ title }) => (
<Fragment>
Expand All @@ -35,7 +35,7 @@ export const AutoFollowPatternPageTitle = ({ title }) => (
<EuiButtonEmpty
size="s"
flush="right"
href={autoFollowPatternUrl}
href={getAutoFollowPatternUrl()}
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
Loading