Skip to content

Commit

Permalink
Update saved object management UI text (#76826)
Browse files Browse the repository at this point in the history
  • Loading branch information
jportner authored Sep 9, 2020
1 parent 1ea58d9 commit 60294cb
Show file tree
Hide file tree
Showing 24 changed files with 162 additions and 137 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ describe('Flyout', () => {

expect(component.state('status')).toBe('success');
expect(component.find('EuiFlyout ImportSummary')).toMatchSnapshot();
const cancelButton = await component.find(
'EuiButtonEmpty[data-test-subj="importSavedObjectsCancelBtn"]'
);
expect(cancelButton.prop('disabled')).toBe(true);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ export class Flyout extends Component<FlyoutProps, FlyoutState> {
label={
<FormattedMessage
id="savedObjectsManagement.objectsTable.flyout.selectFileToImportFormRowLabel"
defaultMessage="Please select a file to import"
defaultMessage="Select a file to import"
/>
}
>
Expand All @@ -756,7 +756,7 @@ export class Flyout extends Component<FlyoutProps, FlyoutState> {
}

renderFooter() {
const { status } = this.state;
const { isLegacyFile, status } = this.state;
const { done, close } = this.props;

let confirmButton;
Expand All @@ -773,7 +773,7 @@ export class Flyout extends Component<FlyoutProps, FlyoutState> {
} else if (this.hasUnmatchedReferences) {
confirmButton = (
<EuiButton
onClick={this.state.isLegacyFile ? this.confirmLegacyImport : this.resolveImportErrors}
onClick={isLegacyFile ? this.confirmLegacyImport : this.resolveImportErrors}
size="s"
fill
isLoading={status === 'loading'}
Expand All @@ -788,7 +788,7 @@ export class Flyout extends Component<FlyoutProps, FlyoutState> {
} else {
confirmButton = (
<EuiButton
onClick={this.state.isLegacyFile ? this.legacyImport : this.import}
onClick={isLegacyFile ? this.legacyImport : this.import}
size="s"
fill
isLoading={status === 'loading'}
Expand All @@ -805,7 +805,12 @@ export class Flyout extends Component<FlyoutProps, FlyoutState> {
return (
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiButtonEmpty onClick={close} size="s">
<EuiButtonEmpty
onClick={close}
size="s"
disabled={status === 'loading' || (isLegacyFile === false && status === 'success')}
data-test-subj="importSavedObjectsCancelBtn"
>
<FormattedMessage
id="savedObjectsManagement.objectsTable.flyout.import.cancelButtonLabel"
defaultMessage="Cancel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ export const Header = ({
<EuiTextColor color="subdued">
<FormattedMessage
id="savedObjectsManagement.objectsTable.howToDeleteSavedObjectsDescription"
defaultMessage="From here you can delete saved objects, such as saved searches.
You can also edit the raw data of saved objects.
Typically objects are only modified via their associated application,
which is probably what you should use instead of this screen."
defaultMessage="Manage and share your saved objects. To edit the underlying data of an object, go to its associated application."
/>
</EuiTextColor>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ const createNewCopiesDisabled = {
tooltip: i18n.translate(
'savedObjectsManagement.objectsTable.importModeControl.createNewCopies.disabledText',
{
defaultMessage:
'Check if each object was previously copied or imported into the destination space.',
defaultMessage: 'Check if objects were previously copied or imported.',
}
),
};
Expand All @@ -64,21 +63,23 @@ const createNewCopiesEnabled = {
),
tooltip: i18n.translate(
'savedObjectsManagement.objectsTable.importModeControl.createNewCopies.enabledText',
{ defaultMessage: 'All imported objects will be created with new random IDs.' }
{
defaultMessage: 'Use this option to create one or more copies of the object.',
}
),
};
const overwriteEnabled = {
id: 'overwriteEnabled',
label: i18n.translate(
'savedObjectsManagement.objectsTable.importModeControl.overwrite.enabledLabel',
{ defaultMessage: 'Automatically try to overwrite conflicts' }
{ defaultMessage: 'Automatically overwrite conflicts' }
),
};
const overwriteDisabled = {
id: 'overwriteDisabled',
label: i18n.translate(
'savedObjectsManagement.objectsTable.importModeControl.overwrite.disabledLabel',
{ defaultMessage: 'Request action when conflict occurs' }
{ defaultMessage: 'Request action on conflict' }
),
};
const importOptionsTitle = i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('ImportSummary', () => {
const wrapper = shallowWithI18nProvider(<ImportSummary {...props} />);

expect(findHeader(wrapper).childAt(0).props()).toEqual(
expect.objectContaining({ values: { importCount: 1 } })
expect.not.objectContaining({ values: expect.anything() }) // no importCount for singular
);
const countCreated = findCountCreated(wrapper);
expect(countCreated).toHaveLength(1);
Expand All @@ -90,7 +90,7 @@ describe('ImportSummary', () => {
const wrapper = shallowWithI18nProvider(<ImportSummary {...props} />);

expect(findHeader(wrapper).childAt(0).props()).toEqual(
expect.objectContaining({ values: { importCount: 1 } })
expect.not.objectContaining({ values: expect.anything() }) // no importCount for singular
);
expect(findCountCreated(wrapper)).toHaveLength(0);
const countOverwritten = findCountOverwritten(wrapper);
Expand All @@ -110,7 +110,7 @@ describe('ImportSummary', () => {
const wrapper = shallowWithI18nProvider(<ImportSummary {...props} />);

expect(findHeader(wrapper).childAt(0).props()).toEqual(
expect.objectContaining({ values: { importCount: 1 } })
expect.not.objectContaining({ values: expect.anything() }) // no importCount for singular
);
expect(findCountCreated(wrapper)).toHaveLength(0);
expect(findCountOverwritten(wrapper)).toHaveLength(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const getCountIndicators = (importItems: ImportItem[]) => {
);
};

const getStatusIndicator = ({ outcome, errorMessage }: ImportItem) => {
const getStatusIndicator = ({ outcome, errorMessage = 'Error' }: ImportItem) => {
switch (outcome) {
case 'created':
return (
Expand All @@ -168,8 +168,8 @@ const getStatusIndicator = ({ outcome, errorMessage }: ImportItem) => {
type={'alert'}
color={'danger'}
content={i18n.translate('savedObjectsManagement.importSummary.errorOutcomeLabel', {
defaultMessage: 'Error{message}',
values: { message: errorMessage ? `: ${errorMessage}` : '' },
defaultMessage: '{errorMessage}',
values: { errorMessage },
})}
/>
);
Expand All @@ -194,11 +194,18 @@ export const ImportSummary = ({ failedImports, successfulImports }: ImportSummar
}
>
<h3>
<FormattedMessage
id="savedObjectsManagement.importSummary.headerLabel"
defaultMessage="{importCount} object(s) imported"
values={{ importCount: importItems.length }}
/>
{importItems.length === 1 ? (
<FormattedMessage
id="savedObjectsManagement.importSummary.headerLabelSingular"
defaultMessage="1 object imported"
/>
) : (
<FormattedMessage
id="savedObjectsManagement.importSummary.headerLabelPlural"
defaultMessage="{importCount} objects imported"
values={{ importCount: importItems.length }}
/>
)}
</h3>
</EuiTitle>
<EuiSpacer size="m" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('OverwriteModal', () => {
const wrapper = shallowWithI18nProvider(<OverwriteModal {...props} />);

expect(wrapper.find('p').text()).toMatchInlineSnapshot(
`"\\"baz\\" conflicts with an existing object, are you sure you want to overwrite it?"`
`"\\"baz\\" conflicts with an existing object. Overwrite it?"`
);
expect(wrapper.find('EuiSuperSelect')).toHaveLength(0);
});
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('OverwriteModal', () => {
const wrapper = shallowWithI18nProvider(<OverwriteModal {...props} />);

expect(wrapper.find('p').text()).toMatchInlineSnapshot(
`"\\"baz\\" conflicts with multiple existing objects, do you want to overwrite one of them?"`
`"\\"baz\\" conflicts with multiple existing objects. Overwrite one?"`
);
expect(wrapper.find('EuiSuperSelect')).toHaveLength(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,13 @@ export const OverwriteModal = ({ conflict, onFinish }: OverwriteModalProps) => {
const bodyText =
error.type === 'conflict'
? i18n.translate('savedObjectsManagement.objectsTable.overwriteModal.body.conflict', {
defaultMessage:
'"{title}" conflicts with an existing object, are you sure you want to overwrite it?',
defaultMessage: '"{title}" conflicts with an existing object. Overwrite it?',
values: { title },
})
: i18n.translate(
'savedObjectsManagement.objectsTable.overwriteModal.body.ambiguousConflict',
{
defaultMessage:
'"{title}" conflicts with multiple existing objects, do you want to overwrite one of them?',
defaultMessage: '"{title}" conflicts with multiple existing objects. Overwrite one?',
values: { title },
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ const createNewCopiesDisabled = {
tooltip: i18n.translate(
'xpack.spaces.management.copyToSpace.copyModeControl.createNewCopies.disabledText',
{
defaultMessage:
'Check if each object was previously copied or imported into the destination space.',
defaultMessage: 'Check if objects were previously copied or imported into the space.',
}
),
};
Expand All @@ -50,33 +49,36 @@ const createNewCopiesEnabled = {
),
tooltip: i18n.translate(
'xpack.spaces.management.copyToSpace.copyModeControl.createNewCopies.enabledText',
{ defaultMessage: 'All copied objects will be created with new random IDs.' }
{
defaultMessage:
'Use this option to create one or more copies of the object in the same space.',
}
),
};
const overwriteEnabled = {
id: 'overwriteEnabled',
label: i18n.translate(
'xpack.spaces.management.copyToSpace.copyModeControl.overwrite.enabledLabel',
{ defaultMessage: 'Automatically try to overwrite conflicts' }
{ defaultMessage: 'Automatically overwrite conflicts' }
),
};
const overwriteDisabled = {
id: 'overwriteDisabled',
label: i18n.translate(
'xpack.spaces.management.copyToSpace.copyModeControl.overwrite.disabledLabel',
{ defaultMessage: 'Request action when conflict occurs' }
{ defaultMessage: 'Request action on conflict' }
),
};
const includeRelated = {
id: 'includeRelated',
text: i18n.translate('xpack.spaces.management.copyToSpace.copyModeControl.includeRelated.title', {
defaultMessage: 'Include related saved objects',
defaultMessage: 'Include related objects',
}),
tooltip: i18n.translate(
'xpack.spaces.management.copyToSpace.copyModeControl.includeRelated.text',
{
defaultMessage:
'This will copy any other objects this has references to -- for example, a dashboard may have references to multiple visualizations.',
'Copy this object and its related objects. For dashboards, related visualizations, index patterns, and saved searches are also copied.',
}
),
};
Expand All @@ -86,7 +88,7 @@ const copyOptionsTitle = i18n.translate(
);
const relationshipOptionsTitle = i18n.translate(
'xpack.spaces.management.copyToSpace.copyModeControl.relationshipOptionsTitle',
{ defaultMessage: 'Relationship options' }
{ defaultMessage: 'Relationship' }
);

const createLabel = ({ text, tooltip }: { text: string; tooltip: string }) => (
Expand Down
Loading

0 comments on commit 60294cb

Please sign in to comment.