Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
yuliacech committed Nov 9, 2020
1 parent 5a735df commit a0a4aaf
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';
import { act } from 'react-dom/test-utils';
import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils';
import { App } from '../../../public/application/app';
import { TestSubjects } from '../helpers';
import { createBreadcrumbsMock } from '../../../public/application/services/breadcrumbs.mock';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public/context';

const breadcrumbService = createBreadcrumbsMock();

const AppWithContext = (props: any) => {
return (
<KibanaContextProvider services={{ breadcrumbService }}>
<App {...props} />
</KibanaContextProvider>
);
};

const getTestBedConfig = (initialEntries: string[]): TestBedConfig => ({
memoryRouter: {
Expand All @@ -20,7 +33,7 @@ const getTestBedConfig = (initialEntries: string[]): TestBedConfig => ({
});

const initTestBed = (initialEntries: string[]) =>
registerTestBed(App, getTestBedConfig(initialEntries))();
registerTestBed(AppWithContext, getTestBedConfig(initialEntries))();

export interface AppTestBed extends TestBed<TestSubjects> {
actions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,12 @@ export const getDefaultHotPhasePolicy = (policyName: string): PolicyFromES => ({
name: policyName,
phases: {
hot: {
min_age: '123ms',
min_age: '0ms',
actions: {
rollover: {},
rollover: {
max_age: '30d',
max_size: '50gb',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('<EditPolicy />', () => {
describe('hot phase', () => {
describe('serialization', () => {
beforeEach(async () => {
httpRequestsMockHelpers.setLoadPolicies([getDefaultHotPhasePolicy('test')]);
httpRequestsMockHelpers.setLoadPolicies([getDefaultHotPhasePolicy('my_policy')]);
httpRequestsMockHelpers.setLoadSnapshotPolicies([]);

await act(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ export const App = ({

return (
<Switch>
<Redirect exact from="/" to={ROUTES.list} />
<Route
exact
path={ROUTES.list}
render={(props) => <PolicyTable {...props} navigateToApp={navigateToApp} />}
/>
<Route
path={ROUTES.edit}
render={(props) => <EditPolicy {...props} getUrlForApp={getUrlForApp} />}
/>
</Switch>
<Redirect exact from="/" to={ROUTES.list} />
<Route
exact
path={ROUTES.list}
render={(props) => <PolicyTable {...props} navigateToApp={navigateToApp} />}
/>
<Route
path={ROUTES.edit}
render={(props) => <EditPolicy {...props} getUrlForApp={getUrlForApp} />}
/>
</Switch>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export const renderApp = (
render(
<I18nContext>
<KibanaContextProvider services={{ cloud, breadcrumbService }}>
<App history={history} navigateToApp={navigateToApp} getUrlForApp={getUrlForApp} />
<AppWithRouter
history={history}
navigateToApp={navigateToApp}
getUrlForApp={getUrlForApp}
/>
</KibanaContextProvider>
</I18nContext>,
element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const EditPolicy: React.FunctionComponent<Props & RouteComponentProps<Rou
);
}

const existingPolicy = getPolicyByName(policies, policyName);
const existingPolicy = getPolicyByName(policies, attemptToURIDecode(policyName));

return (
<EditPolicyContextProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const DataStreamList: React.FunctionComponent<RouteComponentProps<MatchPa
*/}
{dataStreamName && (
<DataStreamDetailPanel
dataStreamName={attemptToURIDecode(dataStreamName)}
dataStreamName={attemptToURIDecode(dataStreamName)!}
onClose={(shouldReload?: boolean) => {
history.push(`/${Section.DataStreams}`);

Expand Down

0 comments on commit a0a4aaf

Please sign in to comment.