Skip to content

Commit

Permalink
Fixed i10n issues using <FormattedMessage>. Removed reference to blue…
Browse files Browse the repository at this point in the history
…Bird and used Promise.all(). Fixed all nits in PR comments.
  • Loading branch information
John Dorlus committed Jan 8, 2020
1 parent e9e9dbf commit f61a139
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const RepositoryDetails: React.FunctionComponent<Props> = ({
<TypeDetails repository={repository} />
<EuiHorizontalRule />
{renderVerification()}
<EuiSpacer size="l" />
<EuiHorizontalRule />
{renderCleanup()}
</Fragment>
);
Expand Down Expand Up @@ -324,16 +324,19 @@ export const RepositoryDetails: React.FunctionComponent<Props> = ({
/>
</h3>
</EuiTitle>
{cleanup ? (
<Fragment>
<EuiSpacer size="s" />
<EuiText>
<p>
You can clean up a repository to delete any unreferenced data from a snapshot. This
<EuiSpacer size="s" />
<EuiText size="s">
<p>
<FormattedMessage
id="xpack.snapshotRestore.repositoryDetails.cleanupRepositoryMessage"
defaultMessage="You can clean up a repository to delete any unreferenced data from a snapshot. This
may provide storage space savings. Note: If you regularly delete snapshots, this
functionality will likely not be as beneficial and should be used less frequently.
</p>
</EuiText>
functionality will likely not be as beneficial and should be used less frequently."
/>
</p>
</EuiText>
{cleanup ? (
<>
<EuiSpacer size="s" />
{cleanup?.cleaned ? (
<div>
Expand All @@ -350,13 +353,22 @@ export const RepositoryDetails: React.FunctionComponent<Props> = ({
</EuiCodeBlock>
</div>
) : (
<EuiCallOut
title="Sorry, there was an error cleaning the repository."
color="danger"
iconType="alert"
/>
<EuiCallOut color="danger" iconType="alert">
<p>
<FormattedMessage
id="xpack.snapshotRestore.repositoryDetails.cleanupRepositoryErrorTitle"
defaultMessage="Sorry, there was an error cleaning the repository."
/>
</p>
<p>
<FormattedMessage
id="xpack.snapshotRestore.repositoryDetails.cleanupRepositoryErrorMessage"
defaultMessage={JSON.stringify(cleanup.error)}
/>
</p>
</EuiCallOut>
)}
</Fragment>
</>
) : null}
<EuiSpacer size="m" />
<EuiButton
Expand All @@ -367,7 +379,7 @@ export const RepositoryDetails: React.FunctionComponent<Props> = ({
>
<FormattedMessage
id="xpack.snapshotRestore.repositoryDetails.cleanupButtonLabel"
defaultMessage="Cleanup repository"
defaultMessage="Clean up repository"
/>
</EuiButton>
</>
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -10966,7 +10966,6 @@
"xpack.snapshotRestore.repositoryDetails.typeS3.serverSideEncryptionLabel": "サーバー側エコシステム",
"xpack.snapshotRestore.repositoryDetails.typeS3.storageClassLabel": "ストレージクラス",
"xpack.snapshotRestore.repositoryDetails.typeTitle": "レポジトリタイプ",
"xpack.snapshotRestore.repositoryDetails.verificationDetails": "認証情報レポジトリ「{name}」",
"xpack.snapshotRestore.repositoryDetails.verificationDetailsTitle": "詳細",
"xpack.snapshotRestore.repositoryDetails.verificationTitle": "認証ステータス",
"xpack.snapshotRestore.repositoryDetails.verifyButtonLabel": "レポジトリを検証",
Expand Down Expand Up @@ -12702,4 +12701,4 @@
"xpack.licensing.welcomeBanner.licenseIsExpiredDescription.updateYourLicenseLinkText": "ライセンスを更新",
"xpack.licensing.welcomeBanner.licenseIsExpiredTitle": "ご使用の {licenseType} ライセンスは期限切れです"
}
}
}
3 changes: 1 addition & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -11055,7 +11055,6 @@
"xpack.snapshotRestore.repositoryDetails.typeS3.serverSideEncryptionLabel": "服务器端加密",
"xpack.snapshotRestore.repositoryDetails.typeS3.storageClassLabel": "存储类",
"xpack.snapshotRestore.repositoryDetails.typeTitle": "存储库类型",
"xpack.snapshotRestore.repositoryDetails.verificationDetails": "验证详情存储库“{name}”",
"xpack.snapshotRestore.repositoryDetails.verificationDetailsTitle": "详情",
"xpack.snapshotRestore.repositoryDetails.verificationTitle": "验证状态",
"xpack.snapshotRestore.repositoryDetails.verifyButtonLabel": "验证存储库",
Expand Down Expand Up @@ -12791,4 +12790,4 @@
"xpack.licensing.welcomeBanner.licenseIsExpiredDescription.updateYourLicenseLinkText": "更新您的许可",
"xpack.licensing.welcomeBanner.licenseIsExpiredTitle": "您的{licenseType}许可已过期"
}
}
}
4 changes: 3 additions & 1 deletion x-pack/test/functional/apps/snapshot_restore/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expect(await repositoriesButton.isDisplayed()).to.be(true);
});

describe('Reposiories Tab', async () => {
describe('Repositories Tab', async () => {
before(async () => {
await es.snapshot.createRepository({
repository: 'my-repository',
Expand All @@ -46,7 +46,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

it('cleanup repository', async () => {
await pageObjects.snapshotRestore.viewRepositoryDetails('my-repository');
await pageObjects.common.sleep(25000);
const cleanupResponse = await pageObjects.snapshotRestore.performRepositoryCleanup();
await pageObjects.common.sleep(25000);
expect(cleanupResponse).to.contain('results');
expect(cleanupResponse).to.contain('deleted_bytes');
expect(cleanupResponse).to.contain('deleted_blobs');
Expand Down
34 changes: 17 additions & 17 deletions x-pack/test/functional/page_objects/snapshot_restore_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { map as mapAsync } from 'bluebird';
import { FtrProviderContext } from '../ftr_provider_context';

export function SnapshotRestorePageProvider({ getService }: FtrProviderContext) {
Expand All @@ -31,21 +29,23 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
async getRepoList() {
const table = await testSubjects.find('repositoryTable');
const rows = await table.findAllByCssSelector('[data-test-subj="row"]');
return await mapAsync(rows, async row => {
return {
repoName: await (
await row.findByCssSelector('[data-test-subj="Name_cell"]')
).getVisibleText(),
repoLink: await (
await row.findByCssSelector('[data-test-subj="Name_cell"]')
).findByCssSelector('a'),
repoType: await (
await row.findByCssSelector('[data-test-subj="Type_cell"]')
).getVisibleText(),
repoEdit: await row.findByCssSelector('[data-test-subj="editRepositoryButton"]'),
repoDelete: await row.findByCssSelector('[data-test-subj="deleteRepositoryButton"]'),
};
});
return await Promise.all(
rows.map(async row => {
return {
repoName: await (
await row.findByCssSelector('[data-test-subj="Name_cell"]')
).getVisibleText(),
repoLink: await (
await row.findByCssSelector('[data-test-subj="Name_cell"]')
).findByCssSelector('a'),
repoType: await (
await row.findByCssSelector('[data-test-subj="Type_cell"]')
).getVisibleText(),
repoEdit: await row.findByCssSelector('[data-test-subj="editRepositoryButton"]'),
repoDelete: await row.findByCssSelector('[data-test-subj="deleteRepositoryButton"]'),
};
})
);
},
async viewRepositoryDetails(name: string) {
const repos = await this.getRepoList();
Expand Down

0 comments on commit f61a139

Please sign in to comment.