Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
83e1e47
Translate Spaces component
tibmt Oct 23, 2018
7adf57c
fix one little error
tibmt Oct 24, 2018
de11dc3
Merge branch 'master' into feature/translations/spaces
tibmt Oct 24, 2018
e9f8f54
update Spaces component
tibmt Oct 24, 2018
c683d5f
update translation of Spaces components
tibmt Oct 25, 2018
142f6df
Merge branch 'master' into feature/translations/spaces
tibmt Oct 25, 2018
2f2ec23
Update snapshots
maryia-lapata Oct 26, 2018
a17f9e5
update Space translation - intl type
tibmt Oct 26, 2018
dd0d569
update Space translation - remove view/views id namespace
tibmt Oct 26, 2018
8df3e18
Merge branch 'master' into feature/translations/spaces
tibmt Oct 26, 2018
7a1c1f9
Merge branch 'master' into feature/translations/spaces
pavel06081991 Nov 1, 2018
8eaa742
rename ids
pavel06081991 Nov 1, 2018
114c357
use testing helper functions instead of shallow, render, mount from e…
pavel06081991 Nov 1, 2018
4718347
Merge branch 'master' into feature/translations/spaces
pavel06081991 Nov 6, 2018
f9da10c
fix unit tests
pavel06081991 Nov 6, 2018
ae492f7
fix ts path for enzyme test helpers
pavel06081991 Nov 8, 2018
6c3c66e
Merge branch 'master' into feature/translations/spaces
pavel06081991 Nov 8, 2018
e3aaa91
fix path to enzyme helpers test functions
pavel06081991 Nov 8, 2018
e1e15b7
Update snapshots
maryia-lapata Nov 8, 2018
51c81fe
fix path to enzyme test helpers
pavel06081991 Nov 8, 2018
2496e6e
Merge branch 'master' into feature/translations/spaces
pavel06081991 Nov 8, 2018
37d2058
Merge branch 'master' into feature/translations/spaces
pavel06081991 Nov 9, 2018
9bc5762
Merge branch 'master' into feature/translations/spaces
maryia-lapata Nov 13, 2018
da0c882
Remove unused dependency.
maryia-lapata Nov 13, 2018
150f99f
Merge branch 'master' into feature/translations/spaces
maryia-lapata Nov 14, 2018
bbce5c7
Merge branch 'master' into feature/translations/spaces
maryia-lapata Nov 14, 2018
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
3 changes: 2 additions & 1 deletion x-pack/dev-tools/jest/create_jest_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export function createJestConfig({
"^ui/(.*)": `${kibanaDirectory}/src/ui/public/$1`,
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
`${kibanaDirectory}/src/dev/jest/mocks/file_mock.js`,
"\\.(css|less|scss)$": `${kibanaDirectory}/src/dev/jest/mocks/style_mock.js`
"\\.(css|less|scss)$": `${kibanaDirectory}/src/dev/jest/mocks/style_mock.js`,
"^test_utils/enzyme_helpers": `${xPackKibanaDirectory}/test_utils/enzyme_helpers.tsx`
},
setupFiles: [
`${kibanaDirectory}/src/dev/jest/setup/babel_polyfill.js`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import { EuiFlyout, EuiLink } from '@elastic/eui';
import { mount, shallow } from 'enzyme';
import React from 'react';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { ImpactedSpacesFlyout } from './impacted_spaces_flyout';
import { PrivilegeSpaceTable } from './privilege_space_table';

Expand Down Expand Up @@ -52,16 +52,16 @@ const buildProps = (customProps = {}) => {

describe('<ImpactedSpacesFlyout>', () => {
it('renders without crashing', () => {
expect(shallow(<ImpactedSpacesFlyout {...buildProps()} />)).toMatchSnapshot();
expect(shallowWithIntl(<ImpactedSpacesFlyout {...buildProps()} />)).toMatchSnapshot();
});

it('does not immediately show the flyout', () => {
const wrapper = mount(<ImpactedSpacesFlyout {...buildProps()} />);
const wrapper = mountWithIntl(<ImpactedSpacesFlyout {...buildProps()} />);
expect(wrapper.find(EuiFlyout)).toHaveLength(0);
});

it('shows the flyout after clicking the link', () => {
const wrapper = mount(<ImpactedSpacesFlyout {...buildProps()} />);
const wrapper = mountWithIntl(<ImpactedSpacesFlyout {...buildProps()} />);
wrapper.find(EuiLink).simulate('click');
expect(wrapper.find(EuiFlyout)).toHaveLength(1);
});
Expand All @@ -82,7 +82,7 @@ describe('<ImpactedSpacesFlyout>', () => {
},
});

const wrapper = shallow(<ImpactedSpacesFlyout {...props} />);
const wrapper = shallowWithIntl(<ImpactedSpacesFlyout {...props} />);
wrapper.find(EuiLink).simulate('click');

const table = wrapper.find(PrivilegeSpaceTable);
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('<ImpactedSpacesFlyout>', () => {
},
});

const wrapper = shallow(<ImpactedSpacesFlyout {...props} />);
const wrapper = shallowWithIntl(<ImpactedSpacesFlyout {...props} />);
wrapper.find(EuiLink).simulate('click');

const table = wrapper.find(PrivilegeSpaceTable);
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('<ImpactedSpacesFlyout>', () => {
},
});

const wrapper = shallow(<ImpactedSpacesFlyout {...props} />);
const wrapper = shallowWithIntl(<ImpactedSpacesFlyout {...props} />);
wrapper.find(EuiLink).simulate('click');

const table = wrapper.find(PrivilegeSpaceTable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ exports[`ManageSpacesButton renders as expected 1`] = `
size="s"
type="button"
>
Manage spaces
<FormattedMessage
defaultMessage="Manage spaces"
id="xpack.spaces.manageSpacesButton.manageSpacesButtonLabel"
values={Object {}}
/>
</EuiButton>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { shallow } from 'enzyme';
import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { UserProfileProvider } from '../../../xpack_main/public/services/user_profile';
import { ManageSpacesButton } from './manage_spaces_button';

Expand All @@ -15,11 +15,11 @@ const buildUserProfile = (canManageSpaces: boolean) => {
describe('ManageSpacesButton', () => {
it('renders as expected', () => {
const component = <ManageSpacesButton userProfile={buildUserProfile(true)} />;
expect(shallow(component)).toMatchSnapshot();
expect(shallowWithIntl(component)).toMatchSnapshot();
});

it(`doesn't render if user profile forbids managing spaces`, () => {
const component = <ManageSpacesButton userProfile={buildUserProfile(false)} />;
expect(shallow(component)).toMatchSnapshot();
expect(shallowWithIntl(component)).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { EuiButton } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { Component, CSSProperties } from 'react';
import { UserProfile } from '../../../xpack_main/public/services/user_profile';
import { MANAGE_SPACES_URL } from '../lib/constants';
Expand Down Expand Up @@ -32,7 +33,10 @@ export class ManageSpacesButton extends Component<Props, {}> {
onClick={this.navigateToManageSpaces}
style={this.props.style}
>
Manage spaces
<FormattedMessage
id="xpack.spaces.manageSpacesButton.manageSpacesButtonLabel"
defaultMessage="Manage spaces"
/>
</EuiButton>
);
}
Expand Down
9 changes: 7 additions & 2 deletions x-pack/plugins/spaces/public/lib/spaces_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +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 { i18n } from '@kbn/i18n';
import { toastNotifications } from 'ui/notify';

import { IHttpResponse } from 'angular';
Expand Down Expand Up @@ -66,8 +67,12 @@ export class SpacesManager extends EventEmitter {

public _displayError() {
toastNotifications.addDanger({
title: 'Unable to change your Space',
text: 'please try again later',
title: i18n.translate('xpack.spaces.spacesManager.unableToChangeSpaceWarningTitle', {
defaultMessage: 'Unable to change your Space',
}),
text: i18n.translate('xpack.spaces.spacesManager.unableToChangeSpaceWarningDescription', {
defaultMessage: 'please try again later',
}),
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ exports[`ConfirmDeleteModal renders as expected 1`] = `
<EuiModalHeaderTitle
data-test-subj="confirmModalTitleText"
>
Delete space
'My Space'
<FormattedMessage
defaultMessage="Delete space {spaceName}"
id="xpack.spaces.management.confirmDeleteModal.confirmDeleteSpaceButtonLabel"
values={
Object {
"spaceName": "'My Space'",
}
}
/>
</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
Expand All @@ -22,12 +29,21 @@ exports[`ConfirmDeleteModal renders as expected 1`] = `
size="m"
>
<p>
Deleting a space permanently removes the space and

<strong>
all of its contents
</strong>
. You can't undo this action.
<FormattedMessage
defaultMessage="Deleting a space permanently removes the space and {allContents}. You can't undo this action."
id="xpack.spaces.management.confirmDeleteModal.deletingSpaceWarningMessage"
values={
Object {
"allContents": <strong>
<FormattedMessage
defaultMessage="all of its contents"
id="xpack.spaces.management.confirmDeleteModal.allContentsText"
values={Object {}}
/>
</strong>,
}
}
/>
</p>
<EuiFormRow
describedByIds={Array []}
Expand All @@ -54,15 +70,21 @@ exports[`ConfirmDeleteModal renders as expected 1`] = `
grow={true}
size="m"
>
You are about to delete your current space
<span>
(
<strong>
My Space
</strong>
)
</span>
. You will be redirected to choose a different space if you continue.
<FormattedMessage
defaultMessage="You are about to delete your current space {name}. You will be redirected to choose a different space if you continue."
id="xpack.spaces.management.confirmDeleteModal.redirectAfterDeletingCurrentSpaceWarningMessage"
values={
Object {
"name": <span>
(
<strong>
My Space
</strong>
)
</span>,
}
}
/>
</EuiText>
</EuiCallOut>
</EuiText>
Expand All @@ -76,7 +98,11 @@ exports[`ConfirmDeleteModal renders as expected 1`] = `
onClick={[MockFunction]}
type="button"
>
Cancel
<FormattedMessage
defaultMessage="Cancel"
id="xpack.spaces.management.confirmDeleteModal.cancelButtonLabel"
values={Object {}}
/>
</EuiButtonEmpty>
<EuiButton
color="danger"
Expand All @@ -87,7 +113,11 @@ exports[`ConfirmDeleteModal renders as expected 1`] = `
onClick={[Function]}
type="button"
>
Delete space and all contents
<FormattedMessage
defaultMessage=" Delete space and all contents"
id="xpack.spaces.management.confirmDeleteModal.deleteSpaceAndAllContentsButtonLabel"
values={Object {}}
/>
</EuiButton>
</EuiModalFooter>
</EuiModal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ exports[`UnauthorizedPrompt renders as expected 1`] = `
<p
data-test-subj="permissionDeniedMessage"
>
You do not have permission to manage spaces.
<FormattedMessage
defaultMessage="You do not have permission to manage spaces."
id="xpack.spaces.management.unauthorizedPrompt.permissionDeniedDescription"
values={Object {}}
/>
</p>
}
iconColor="danger"
iconType="spacesApp"
title={
<h2>
Permission denied
<FormattedMessage
defaultMessage="Permission denied"
id="xpack.spaces.management.unauthorizedPrompt.permissionDeniedTitle"
values={Object {}}
/>
</h2>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ exports[`AdvancedSettingsSubtitle renders as expected 1`] = `
size="m"
title={
<p>
The settings on this page apply to the
<strong>
My Space
</strong>
space, unless otherwise specified.
<FormattedMessage
defaultMessage="The settings on this page apply to the {spaceName} space, unless otherwise specified."
id="xpack.spaces.management.advancedSettingsSubtitle.applyingSettingsOnPageToSpaceDescription"
values={
Object {
"spaceName": <strong>
My Space
</strong>,
}
}
/>
</p>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { shallow } from 'enzyme';
import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { AdvancedSettingsSubtitle } from './advanced_settings_subtitle';

describe('AdvancedSettingsSubtitle', () => {
Expand All @@ -13,6 +13,6 @@ describe('AdvancedSettingsSubtitle', () => {
id: 'my-space',
name: 'My Space',
};
expect(shallow(<AdvancedSettingsSubtitle space={space} />)).toMatchSnapshot();
expect(shallowWithIntl(<AdvancedSettingsSubtitle space={space} />)).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { EuiCallOut, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { Fragment } from 'react';
import { Space } from '../../../../../common/model/space';

Expand All @@ -20,8 +21,13 @@ export const AdvancedSettingsSubtitle = (props: Props) => (
iconType="spacesApp"
title={
<p>
The settings on this page apply to the <strong>{props.space.name}</strong> space, unless
otherwise specified.
<FormattedMessage
id="xpack.spaces.management.advancedSettingsSubtitle.applyingSettingsOnPageToSpaceDescription"
defaultMessage="The settings on this page apply to the {spaceName} space, unless otherwise specified."
values={{
spaceName: <strong>{props.space.name}</strong>,
}}
/>
</p>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ exports[`AdvancedSettingsTitle renders as expected 1`] = `
<h1
data-test-subj="managementSettingsTitle"
>
Settings
<FormattedMessage
defaultMessage="Settings"
id="xpack.spaces.management.advancedSettingsTitle.settingsTitle"
values={Object {}}
/>
</h1>
</EuiText>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { shallow } from 'enzyme';
import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { AdvancedSettingsTitle } from './advanced_settings_title';

describe('AdvancedSettingsTitle', () => {
Expand All @@ -13,6 +13,6 @@ describe('AdvancedSettingsTitle', () => {
id: 'my-space',
name: 'My Space',
};
expect(shallow(<AdvancedSettingsTitle space={space} />)).toMatchSnapshot();
expect(shallowWithIntl(<AdvancedSettingsTitle space={space} />)).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React from 'react';
import { Space } from '../../../../../common/model/space';
import { SpaceAvatar } from '../../../../components';
Expand All @@ -20,7 +21,12 @@ export const AdvancedSettingsTitle = (props: Props) => (
</EuiFlexItem>
<EuiFlexItem style={{ marginLeft: '10px' }}>
<EuiText>
<h1 data-test-subj="managementSettingsTitle">Settings</h1>
<h1 data-test-subj="managementSettingsTitle">
<FormattedMessage
id="xpack.spaces.management.advancedSettingsTitle.settingsTitle"
defaultMessage="Settings"
/>
</h1>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Loading