Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/translate watcher(part_1) #23989

Merged
merged 18 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from 10 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
3 changes: 2 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"markdownVis": "src/core_plugins/markdown_vis",
"metricVis": "src/core_plugins/metric_vis",
"statusPage": "src/core_plugins/status_page",
"xpack.idxMgmt": "x-pack/plugins/index_management"
"xpack.idxMgmt": "x-pack/plugins/index_management",
"xpack.watcher": "x-pack/plugins/watcher"
},
"exclude": [
"src/ui/ui_render/bootstrap/app_bootstrap.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sort-field="actionStatusTable.sortField"
sort-reverse="actionStatusTable.sortReverse"
>
Action
{{ 'xpack.watcher.sections.watchDetail.actionStatusTable.actionColumnLabel' | i18n: { defaultMessage: 'Action' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
Expand All @@ -18,7 +18,7 @@
sort-field="actionStatusTable.sortField"
sort-reverse="actionStatusTable.sortReverse"
>
State
{{ 'xpack.watcher.sections.watchDetail.actionStatusTable.stateColumnLabel' | i18n: { defaultMessage: 'State' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
Expand All @@ -45,12 +45,15 @@
<button
class="kuiMenuButton kuiMenuButton--basic kuiMenuButton--iconText"
ng-click="actionStatusTable.onActionAcknowledge(actionStatus)"
title="Acknowledge"
title="{{ 'xpack.watcher.sections.watchDetail.actionStatusTable.acknowledgeButtonTitle' | i18n: { defaultMessage: 'Acknowledge' } }}"
ng-if="actionStatus.isAckable"
data-test-subj="btnActionAcknowledge-{{ actionStatus.id }}"
>
<span class="kuiMenuButton__icon kuiIcon fa-thumbs-up"></span>
<span>Acknowledge</span>
<span
i18n-id="xpack.watcher.sections.watchDetail.actionStatusTable.acknowledgeButtonLabel"
i18n-default-message="Acknowledge"
></span>
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

<!-- Watch Details -->
<div class="kuiBarSection">
<h1 class="kuiTitle">
Current Status
</h1>
<h1
class="kuiTitle"
i18n-id="xpack.watcher.sections.watchDetail.currentStatusTitle"
i18n-default-message="Current Status"
></h1>
</div>

<div class="kuiBarSection">
Expand All @@ -22,24 +24,24 @@ <h1 class="kuiTitle">
ng-click="watchDetail.onWatchDeactivate()"
class="kuiButton kuiButton--basic"
data-test-subj="btnDeactivateWatch"
>
Deactivate
</button>
i18n-id="xpack.watcher.sections.watchDetail.deactivateButtonLabel"
i18n-default-message="Deactivate"
></button>
<button
ng-if="!watchDetail.watch.watchStatus.isActive"
ng-click="watchDetail.onWatchActivate()"
class="kuiButton kuiButton--basic"
data-test-subj="btnActivateWatch"
>
Activate
</button>
i18n-id="xpack.watcher.sections.watchDetail.activateButtonLabel"
i18n-default-message="Activate"
></button>
<button
ng-click="watchDetail.onWatchDelete()"
class="kuiButton kuiButton--danger"
data-test-subj="btnDeleteWatch"
>
Delete
</button>
i18n-id="xpack.watcher.sections.watchDetail.deleteButtonLabel"
i18n-default-message="Delete"
></button>
</div>
</div>
</div>
Expand All @@ -56,14 +58,18 @@ <h1 class="kuiTitle">
sort-reverse="watchDetail.actionStatusTableSortReverse"
on-sort-change="watchDetail.onActionSortChange"
></action-status-table>
<table-info ng-show="!watchDetail.hasActionStatusTableActions">No actions found.</table-info>
<table-info ng-show="!watchDetail.hasActionStatusTableActions">
{{ 'xpack.watcher.sections.watchDetail.noActionsFoundText' | i18n: { defaultMessage: 'No actions found.' } }}
</table-info>
</div>

<!-- Watch History -->
<div class="kuiViewContentItem kuiVerticalRhythm">
<h1 class="kuiTitle">
Watch History
</h1>
<h1
class="kuiTitle"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryTitle"
i18n-default-message="Watch History"
></h1>
</div>

<div class="kuiViewContentItem kuiVerticalRhythm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import template from './watch_detail.html';
import '../watch_history';
import '../action_status_table';
import { REFRESH_INTERVALS } from 'plugins/watcher/../common/constants';
import { i18n } from '@kbn/i18n';
Nox911 marked this conversation as resolved.
Show resolved Hide resolved

const app = uiModules.get('xpack/watcher');

Expand Down Expand Up @@ -152,17 +153,28 @@ app.directive('watchDetail', function ($injector) {

onWatchDelete = () => {
const confirmModalOptions = {
confirmButtonText: 'Delete Watch',
confirmButtonText: i18n.translate('xpack.watcher.sections.watchDetail.deleteConfirmModal.deleteWatchButtonLabel', {
defaultMessage: 'Delete Watch' }
),
onConfirm: this.deleteWatch
};

return confirmModal('This will permanently delete the watch. Are you sure?', confirmModalOptions);
return confirmModal(
i18n.translate('xpack.watcher.sections.watchDetail.deleteConfirmModal.description', {
defaultMessage: 'This will permanently delete the watch. Are you sure?' }
),
confirmModalOptions);
}

deleteWatch = () => {
return watchService.deleteWatch(this.watch.id)
.then(() => {
toastNotifications.addSuccess(`Deleted '${this.watch.displayName}'`);
toastNotifications.addSuccess(
i18n.translate('xpack.watcher.sections.watchDetail.deleteWatchSuccessNotificationText', {
defaultMessage: 'Deleted {watchName}',
values: { watchName: this.watch.displayName } }
),
);
this.close();
})
.catch(err => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

<!-- Watch history table -->
<table-info ng-show="watchHistory.isLoading">
Loading watch history&hellip;
{{ 'xpack.watcher.sections.watchDetail.watchHistory.watchHistoryLoadingText' | i18n: { defaultMessage: 'Loading watch history' } }}&hellip;
</table-info>
<table-info ng-show="!watchHistory.isLoading && !watchHistory.hasPageOfHistoryItems">
No watch history found.
{{ 'xpack.watcher.sections.watchDetail.watchHistory.watchHistoryNotFoundText' | i18n: { defaultMessage: 'No watch history found.' } }}
</table-info>
<watch-history-table
xpack-watch="watchHistory.watch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,39 @@
ng-change="watchHistoryRangeFilter.onRangeChange(watchHistoryRangeFilter.range)"
class="kuiSelect"
>
<option value="now-1h">Last 1 hour</option>
<option value="now-24h">Last 24 hours</option>
<option value="now-7d">Last 7 days</option>
<option value="now-30d">Last 30 days</option>
<option value="now-6M">Last 6 months</option>
<option value="now-1y">Last 1 year</option>
<option value="all">All</option>
<option
value="now-1h"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last1HourText"
Nox911 marked this conversation as resolved.
Show resolved Hide resolved
i18n-default-message="Last 1 hour"
></option>
<option
value="now-24h"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last24HoursText"
i18n-default-message="Last 24 hours"
></option>
<option
value="now-7d"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last7DaysText"
i18n-default-message="Last 7 days"
></option>
<option
value="now-30d"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last30DaysText"
i18n-default-message="Last 30 days"
></option>
<option
value="now-6M"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last6MonthsText"
i18n-default-message="Last 6 months"
></option>
<option
value="now-1y"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last1YearText"
i18n-default-message="Last 1 year"
></option>
<option
value="all"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.allText"
i18n-default-message="All"
></option>
</select>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sort-field="watchHistoryTable.sortField"
sort-reverse="watchHistoryTable.sortReverse"
>
Trigger Time
{{ 'xpack.watcher.sections.watchDetail.watchHistoryTable.triggerTimeColumnLabel' | i18n: { defaultMessage: 'Trigger Time' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
Expand All @@ -18,7 +18,7 @@
sort-field="watchHistoryTable.sortField"
sort-reverse="watchHistoryTable.sortReverse"
>
State
{{ 'xpack.watcher.sections.watchDetail.watchHistoryTable.stateColumnLabel' | i18n: { defaultMessage: 'State' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
Expand All @@ -28,7 +28,7 @@
sort-field="watchHistoryTable.sortField"
sort-reverse="watchHistoryTable.sortReverse"
>
Comment
{{ 'xpack.watcher.sections.watchDetail.watchHistoryTable.commentColumnLabel' | i18n: { defaultMessage: 'Comment' } }}
</sortable-column>
</th>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
>
<kbn-tab
tab-id="edit-watch"
title="Edit Watch"
title="{{ 'xpack.watcher.sections.watchEdit.json.editTabTitle' | i18n: { defaultMessage: 'Edit Watch' } }}"
>
Edit
{{ 'xpack.watcher.sections.watchEdit.json.editTabLabel' | i18n: { defaultMessage: 'Edit' } }}
</kbn-tab>
<kbn-tab
tab-id="watch-simulate"
title="Simulate Watch"
title="{{ 'xpack.watcher.sections.watchEdit.json.simulateTabTitle' | i18n: { defaultMessage: 'Simulate Watch' } }}"
>
Simulate
{{ 'xpack.watcher.sections.watchEdit.json.simulateTabLabel' | i18n: { defaultMessage: 'Simulate' } }}
</kbn-tab>
<kbn-tab
tab-id="simulate-results"
title="Simulate Results"
title="{{ 'xpack.watcher.sections.watchEdit.json.simulateResultsTabTitle' | i18n: { defaultMessage: 'Simulate Results' } }}"
ng-if="jsonWatchEdit.simulateResults"
>
Simulation Results
{{ 'xpack.watcher.sections.watchEdit.json.simulateResultsTabLabel' | i18n: { defaultMessage: 'Simulation Results' } }}
</kbn-tab>
</kbn-tabs>
</div>
Expand Down Expand Up @@ -79,8 +79,11 @@
ng-click="jsonWatchEdit.onWatchExecute()"
data-test-subj="btnSimulateWatch"
>
<span class="kuiButton__icon kuiIcon fa-play"></span>
Simulate Watch
<span
class="kuiButton__icon kuiIcon fa-play"
i18n-id="xpack.watcher.sections.watchEdit.json.simulateWatchButtonLabel"
i18n-default-message="Simulate Watch"
></span>
</button>
</div>
</div>
Expand All @@ -104,7 +107,10 @@
</div>

<div class="kuiVerticalRhythm">
<label>Simulation Output:</label>
<label
i18n-id="xpack.watcher.sections.watchEdit.json.simulationOutputLabel"
i18n-default-message="Simulation Output:"
></label>
<watch-history-item-detail
watch-history-item="jsonWatchEdit.simulateResults"
></watch-history-item-detail>
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 { i18n } from '@kbn/i18n';
Nox911 marked this conversation as resolved.
Show resolved Hide resolved
import { uiModules } from 'ui/modules';
import { InitAfterBindingsWorkaround } from 'ui/compat';
import { toastNotifications } from 'ui/notify';
Expand Down Expand Up @@ -112,11 +113,25 @@ app.directive('jsonWatchEdit', function ($injector) {

const confirmModalOptions = {
onConfirm: this.saveWatch,
confirmButtonText: 'Overwrite Watch'
confirmButtonText: i18n.translate('xpack.watcher.sections.watchEdit.json.saveConfirmModal.overwriteWatchButtonLabel', {
defaultMessage: 'Overwrite Watch',
}),
};

const watchNameMessageFragment = existingWatch.name ? ` (name: "${existingWatch.name}")` : '';
const message = `Watch with ID "${this.watch.id}"${watchNameMessageFragment} already exists. Do you want to overwrite it?`;
const message = i18n.translate('xpack.watcher.sections.watchEdit.json.saveConfirmModal.description', {
defaultMessage: 'Watch with ID "{watchId}"{watchNameMessageFragment} already exists. Do you want to overwrite it?',
values: {
watchId: this.watch.id,
watchNameMessageFragment: existingWatch.name
? i18n.translate('xpack.watcher.sections.watchEdit.json.saveConfirmModal.descriptionFragmentText', {
defaultMessage: '(name: "{existingWatchName}")',
values: {
existingWatchName: existingWatch.name
}
})
: ''
}
});
return confirmModal(message, confirmModalOptions);
})
.catch(err => toastNotifications.addDanger(err));
Expand All @@ -142,7 +157,14 @@ app.directive('jsonWatchEdit', function ($injector) {
return watchService.saveWatch(this.watch)
.then(() => {
this.watch.isNew = false; // without this, the message displays 'New Watch'
toastNotifications.addSuccess(`Saved '${this.watch.displayName}'`);
toastNotifications.addSuccess(
i18n.translate('xpack.watcher.sections.watchEdit.json.saveSuccessNotificationText', {
defaultMessage: 'Saved \'{watchDisplayName}\'',
values: {
watchDisplayName: this.watch.displayName
}
}),
);
this.onClose();
})
.catch(err => {
Expand All @@ -154,16 +176,30 @@ app.directive('jsonWatchEdit', function ($injector) {
onWatchDelete = () => {
const confirmModalOptions = {
onConfirm: this.deleteWatch,
confirmButtonText: 'Delete Watch'
confirmButtonText: i18n.translate('xpack.watcher.sections.watchEdit.json.deleteConfirmModal.overwriteWatchButtonLabel', {
defaultMessage: 'Delete Watch',
}),
};

return confirmModal('This will permanently delete the watch. Are you sure?', confirmModalOptions);
return confirmModal(
i18n.translate('xpack.watcher.sections.watchEdit.json.deleteConfirmModal.description', {
defaultMessage: 'This will permanently delete the watch. Are you sure?',
}),
confirmModalOptions
);
}

deleteWatch = () => {
return watchService.deleteWatch(this.watch.id)
.then(() => {
toastNotifications.addSuccess(`Deleted '${this.watch.displayName}'`);
toastNotifications.addSuccess(
i18n.translate('xpack.watcher.sections.watchEdit.json.deleteSuccessNotificationText', {
defaultMessage: 'Deleted \'{watchDisplayName}\'',
values: {
watchDisplayName: this.watch.displayName
}
}),
);
this.onClose();
})
.catch(err => {
Expand Down
Loading