Feature/translate watcher(part_1) (#23989) (#24275)

* translate watcher(pad_1)

* fix test

* fix issues

* fix the same id name

* fix default message

* fix issues
This commit is contained in:
Maryia Lapata 2018-10-19 22:38:14 +03:00 committed by GitHub
parent 0851f20744
commit 331c17db3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 466 additions and 232 deletions

View file

@ -8,7 +8,8 @@
"metricVis": "src/core_plugins/metric_vis",
"statusPage": "src/core_plugins/status_page",
"tagCloud": "src/core_plugins/tagcloud",
"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",

View file

@ -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">
@ -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">
@ -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>

View file

@ -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">
@ -22,24 +24,24 @@
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>
@ -56,14 +58,18 @@
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">

View file

@ -22,7 +22,7 @@ import { REFRESH_INTERVALS } from 'plugins/watcher/../common/constants';
const app = uiModules.get('xpack/watcher');
app.directive('watchDetail', function ($injector) {
app.directive('watchDetail', function ($injector, i18n) {
const watchService = $injector.get('xpackWatcherWatchService');
const licenseService = $injector.get('xpackWatcherLicenseService');
@ -152,17 +152,28 @@ app.directive('watchDetail', function ($injector) {
onWatchDelete = () => {
const confirmModalOptions = {
confirmButtonText: 'Delete Watch',
confirmButtonText: i18n('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('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('xpack.watcher.sections.watchDetail.deleteWatchSuccessNotificationText', {
defaultMessage: 'Deleted {watchName}',
values: { watchName: this.watch.displayName } }
),
);
this.close();
})
.catch(err => {

View file

@ -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"

View file

@ -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.last1HourLabel"
i18n-default-message="Last 1 hour"
></option>
<option
value="now-24h"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last24HoursLabel"
i18n-default-message="Last 24 hours"
></option>
<option
value="now-7d"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last7DaysLabel"
i18n-default-message="Last 7 days"
></option>
<option
value="now-30d"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last30DaysLabel"
i18n-default-message="Last 30 days"
></option>
<option
value="now-6M"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last6MonthsLabel"
i18n-default-message="Last 6 months"
></option>
<option
value="now-1y"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.last1YearLabel"
i18n-default-message="Last 1 year"
></option>
<option
value="all"
i18n-id="xpack.watcher.sections.watchDetail.watchHistoryRangeFilter.allLabel"
i18n-default-message="All"
></option>
</select>

View file

@ -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">
@ -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">
@ -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>

View file

@ -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>
@ -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>
@ -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>

View file

@ -21,7 +21,7 @@ import 'plugins/watcher/services/license';
const app = uiModules.get('xpack/watcher');
app.directive('jsonWatchEdit', function ($injector) {
app.directive('jsonWatchEdit', function ($injector, i18n) {
const watchService = $injector.get('xpackWatcherWatchService');
const licenseService = $injector.get('xpackWatcherLicenseService');
const kbnUrl = $injector.get('kbnUrl');
@ -112,11 +112,25 @@ app.directive('jsonWatchEdit', function ($injector) {
const confirmModalOptions = {
onConfirm: this.saveWatch,
confirmButtonText: 'Overwrite Watch'
confirmButtonText: i18n('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('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('xpack.watcher.sections.watchEdit.json.saveConfirmModal.descriptionFragmentText', {
defaultMessage: '(name: "{existingWatchName}")',
values: {
existingWatchName: existingWatch.name
}
})
: ''
}
});
return confirmModal(message, confirmModalOptions);
})
.catch(err => toastNotifications.addDanger(err));
@ -142,7 +156,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('xpack.watcher.sections.watchEdit.json.saveSuccessNotificationText', {
defaultMessage: 'Saved \'{watchDisplayName}\'',
values: {
watchDisplayName: this.watch.displayName
}
}),
);
this.onClose();
})
.catch(err => {
@ -154,16 +175,30 @@ app.directive('jsonWatchEdit', function ($injector) {
onWatchDelete = () => {
const confirmModalOptions = {
onConfirm: this.deleteWatch,
confirmButtonText: 'Delete Watch'
confirmButtonText: i18n('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('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('xpack.watcher.sections.watchEdit.json.deleteSuccessNotificationText', {
defaultMessage: 'Deleted \'{watchDisplayName}\'',
values: {
watchDisplayName: this.watch.displayName
}
}),
);
this.onClose();
})
.catch(err => {

View file

@ -22,9 +22,11 @@
>
<section class="kuiVerticalRhythm">
<header>
<h2 class="kuiSubTitle">
Matching the following condition
</h2>
<h2
class="kuiSubTitle"
i18n-id="xpack.watcher.sections.watchEdit.threshold.matchingFollowingConditionTitle"
i18n-default-message="Matching the following condition"
></h2>
</header>
</section>
@ -93,7 +95,10 @@
ng-disabled="thresholdWatchEdit.saveDisabled"
ng-click="thresholdWatchEdit.onWatchSave()">
<span class="kuiButton__inner">
<span>Save</span>
<span
i18n-id="xpack.watcher.sections.watchEdit.threshold.saveButtonLabel"
i18n-default-message="Save"
></span>
</span>
</button>

View file

@ -29,7 +29,7 @@ import { REFRESH_INTERVALS } from 'plugins/watcher/../common/constants';
const app = uiModules.get('xpack/watcher');
app.directive('thresholdWatchEdit', function ($injector) {
app.directive('thresholdWatchEdit', function ($injector, i18n) {
const watchService = $injector.get('xpackWatcherWatchService');
const fieldsService = $injector.get('xpackWatcherFieldsService');
const timezoneService = $injector.get('xpackWatcherTimezoneService');
@ -261,11 +261,25 @@ app.directive('thresholdWatchEdit', function ($injector) {
const confirmModalOptions = {
onConfirm: this.saveWatch,
confirmButtonText: 'Overwrite Watch'
confirmButtonText: i18n('xpack.watcher.sections.watchEdit.threshold.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('xpack.watcher.sections.watchEdit.threshold.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('xpack.watcher.sections.watchEdit.threshold.saveConfirmModal.descriptionFragmentText', {
defaultMessage: '(name: "{existingWatchName}")',
values: {
existingWatchName: existingWatch.name
}
})
: ''
}
});
return confirmModal(message, confirmModalOptions);
})
.catch(err => toastNotifications.addDanger(err));
@ -291,7 +305,14 @@ app.directive('thresholdWatchEdit', 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('xpack.watcher.sections.watchEdit.threshold.saveSuccessNotificationText', {
defaultMessage: 'Saved \'{watchDisplayName}\'',
values: {
watchDisplayName: this.watch.displayName
}
}),
);
this.onClose();
})
.catch(err => {

View file

@ -1,9 +1,24 @@
<table class="kuiTable kuiTable--fluid">
<thead>
<tr>
<th scope="col" class="kuiTableHeaderCell">Action</th>
<th scope="col" class="kuiTableHeaderCell">Type</th>
<th scope="col" class="kuiTableHeaderCell">Mode</th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.watchActionModeTable.actionColumnLabel"
i18n-default-message="Action"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.watchActionModeTable.typeColumnLabel"
i18n-default-message="Type"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.watchActionModeTable.modeColumnLabel"
i18n-default-message="Mode"
></th>
</tr>
</thead>
<tr ng-repeat="actionOption in watchActionModeTable.actionOptions">

View file

@ -1,11 +1,36 @@
<table class="kuiTable kuiTable--fluid kuiVerticalRhythm">
<thead>
<tr>
<th scope="col" class="kuiTableHeaderCell">Action</th>
<th scope="col" class="kuiTableHeaderCell">Type</th>
<th scope="col" class="kuiTableHeaderCell">Mode</th>
<th scope="col" class="kuiTableHeaderCell">State</th>
<th scope="col" class="kuiTableHeaderCell">Reason</th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.actionsExecuteSummary.actionColumnLabel"
i18n-default-message="Action"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.actionsExecuteSummary.typeColumnLabel"
i18n-default-message="Type"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.actionsExecuteSummary.modeColumnLabel"
i18n-default-message="Mode"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.actionsExecuteSummary.stateColumnLabel"
i18n-default-message="State"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchEdit.actionsExecuteSummary.reasonColumnLabel"
i18n-default-message="Reason"
></th>
</tr>
</thead>
<tr ng-repeat="actionDetail in watchEditActionsExecuteSummary.actionDetails">

View file

@ -3,9 +3,9 @@
<label
for="id"
class="kuiFormLabel"
>
ID
</label>
i18n-id="xpack.watcher.sections.watchEdit.detail.idLabel"
i18n-default-message="ID"
></label>
<input
type="text"
id="id"
@ -21,24 +21,24 @@
<div
class="kuiInputNote kuiInputNote--danger"
ng-show="watchEditDetail.form.id.$error.pattern"
>
ID must begin with a letter or underscore and contain only letters, underscores, dashes, and numbers.
</div>
i18n-id="xpack.watcher.sections.watchEdit.detail.idNamingDescription"
i18n-default-message="ID must begin with a letter or underscore and contain only letters, underscores, dashes, and numbers."
></div>
<div
class="kuiInputNote kuiInputNote--danger"
ng-show="watchEditDetail.form.id.$touched && watchEditDetail.form.id.$error.required"
>
ID is required.
</div>
i18n-id="xpack.watcher.sections.watchEdit.detail.idIsRequiredValidationMessage"
i18n-default-message="ID is required."
></div>
</div>
<div class="kuiFormSection">
<label
for="name"
class="kuiFormLabel"
>
Name
</label>
i18n-id="xpack.watcher.sections.watchEdit.detail.nameLabel"
i18n-default-message="Name"
></label>
<input
type="text"
id="name"
@ -50,17 +50,12 @@
</form>
<div class="kuiFormSection">
<label class="kuiFormLabel">
Watch JSON
(<a
href="{{ watchEditDetail.documentationLinks.watcher.putWatchApi }}"
target="_blank"
rel="noopener noreferrer"
data-test-subj="lnkPutWatchApiDoc"
>
Syntax
</a>)
</label>
<label
class="kuiFormLabel"
i18n-id="xpack.watcher.sections.watchEdit.detail.watchJSONLabel"
i18n-default-message="Watch JSON({syntax})"
i18n-values="{ syntax: '<a href=\'{{ watchEditDetail.documentationLinks.watcher.putWatchApi }}\' target=\'_blank\' rel=\'noopener noreferrer\' data-test-subj=\'lnkPutWatchApiDoc\'>' + watchEditDetail.syntaxLinkLabel + '</a>'}"
></label>
<json-editor
json="watchEditDetail.watch.watch"
on-change="watchEditDetail.onJsonChange"
@ -70,7 +65,7 @@
<div
class="kuiInputNote kuiInputNote--danger"
ng-show="!watchEditDetail.isJsonValid"
>
Invalid JSON
</div>
i18n-id="xpack.watcher.sections.watchEdit.detail.invalidJSONErrorMessage"
i18n-default-message="Invalid JSON"
></div>
</div>

View file

@ -11,7 +11,7 @@ import { documentationLinks } from 'plugins/watcher/lib/documentation_links';
const app = uiModules.get('xpack/watcher');
app.directive('watchEditDetail', function () {
app.directive('watchEditDetail', function (i18n) {
return {
restrict: 'E',
template: template,
@ -36,7 +36,7 @@ app.directive('watchEditDetail', function () {
$scope.$watch('watchEditDetail.form.$valid', () => {
this.updateIsValid();
});
this.syntaxLinkLabel = i18n('xpack.watcher.sections.watchEdit.detail.syntaxLinkLabel', { defaultMessage: 'Syntax' });
this.documentationLinks = documentationLinks;
}

View file

@ -1,40 +1,39 @@
<form name="watchEditExecuteDetail.triggerForm" novalidate>
<toggle-panel
toggle-panel-id="trigger"
button-text="Trigger Overrides"
is-collapsed="watchEditExecuteDetail.isSectionCollapsed('trigger')"
button-text="{{'xpack.watcher.sections.watchEdit.executeDetail.triggerOverridesButtonLabel' | i18n: { defaultMessage: 'Trigger Overrides' } }}"
on-toggle="watchEditExecuteDetail.onSectionToggle"
>
<div class="kuiFormSection">
<label
for="triggeredTime"
class="kuiFormLabel"
>
Triggered Time
</label>
i18n-id="xpack.watcher.sections.watchEdit.executeDetail.triggerOverrides.triggeredTimeLabel"
i18n-default-message="Triggered Time"
></label>
<input
type="text"
id="triggeredTime"
name="triggeredTime"
ng-model="watchEditExecuteDetail.executeDetails.triggeredTime"
class="kuiTextInput"
placeholder="now"
placeholder="{{'xpack.watcher.sections.watchEdit.executeDetail.triggerOverrides.triggeredTimePlaceholder' | i18n: { defaultMessage: 'now' } }}"
>
</div>
<div class="kuiFormSection">
<label
for="scheduledTime"
class="kuiFormLabel"
>
Scheduled Time
</label>
i18n-id="xpack.watcher.sections.watchEdit.executeDetail.triggerOverrides.scheduledTimeLabel"
i18n-default-message="Scheduled Time"
></label>
<input
type="text"
id="scheduledTime"
name="scheduledTime"
ng-model="watchEditExecuteDetail.executeDetails.scheduledTime"
class="kuiTextInput"
placeholder="now"
placeholder="{{'xpack.watcher.sections.watchEdit.executeDetail.triggerOverrides.scheduledTimePlaceholder' | i18n: { defaultMessage: 'now' } }}"
>
</div>
</toggle-panel>
@ -42,7 +41,7 @@
<toggle-panel
toggle-panel-id="input"
button-text="Input Overrides"
button-text="{{'xpack.watcher.sections.watchEdit.executeDetail.inputOverridesButtonLabel' | i18n: { defaultMessage: 'Input Overrides' } }}"
is-collapsed="watchEditExecuteDetail.isSectionCollapsed('input')"
on-toggle="watchEditExecuteDetail.onSectionToggle"
>
@ -50,16 +49,16 @@
<label
for="recordExecution"
class="kuiFormLabel"
>
Alternative Input
<a
i18n-id="xpack.watcher.sections.watchEdit.executeDetail.inputOverrides.alternativeInputLabel"
i18n-default-message="Alternative Input"
><a
class="copyFromPrevious"
ng-click="watchEditExecuteDetail.copyFromPreviousExecution()"
ng-show="watchEditExecuteDetail.previousWatchHistoryItem"
data-test-subj="lnkCopyFromPreviousExecution"
>
Copy from previous execution
</a>
i18n-id="xpack.watcher.sections.watchEdit.executeDetail.inputOverrides.alternativeInputLinkText"
i18n-default-message="Copy from previous execution"
></a>
</label>
<json-editor
@ -71,16 +70,16 @@
<div
class="kuiInputNote kuiInputNote--danger"
ng-show="!watchEditExecuteDetail.isAlternativeInputValid && !watchEditExecuteDetail.isAlternativeInputEmpty"
>
Invalid JSON
</div>
i18n-id="xpack.watcher.sections.watchEdit.executeDetail.inputOverrides.invalidJSONErrorMessage"
i18n-default-message="Invalid JSON"
></div>
</div>
</toggle-panel>
<form name="watchEditExecuteDetail.conditionForm" novalidate>
<toggle-panel
toggle-panel-id="condition"
button-text="Condition Overrides"
button-text="{{'xpack.watcher.sections.watchEdit.executeDetail.conditionOverridesButtonLabel' | i18n: { defaultMessage: 'Condition Overrides' } }}"
is-collapsed="watchEditExecuteDetail.isSectionCollapsed('condition')"
on-toggle="watchEditExecuteDetail.onSectionToggle"
>
@ -95,9 +94,9 @@
type="checkbox"
ng-model="watchEditExecuteDetail.executeDetails.ignoreCondition"
class="kuiCheckBox"
>
Ignore Condition (Condition is always true)
</label>
i18n-id="xpack.watcher.sections.watchEdit.executeDetail.conditionOverrides.ignoreConditionLabel"
i18n-default-message="Ignore Condition (Condition is always true)"
></label>
</div>
</toggle-panel>
</form>
@ -105,14 +104,15 @@
<form name="watchEditExecuteDetail.actionForm" novalidate>
<toggle-panel
toggle-panel-id="action"
button-text="Action Overrides"
button-text="{{'xpack.watcher.sections.watchEdit.executeDetail.actionOverridesButtonLabel' | i18n: { defaultMessage: 'Action Overrides' } }}"
is-collapsed="watchEditExecuteDetail.isSectionCollapsed('action')"
on-toggle="watchEditExecuteDetail.onSectionToggle"
>
<div class="kuiFormSection">
<label class="kuiFormLabel">
Action Modes
</label>
<label class="kuiFormLabel"
i18n-id="xpack.watcher.sections.watchEdit.executeDetail.actionOverrides.actionModesLabel"
i18n-default-message="Action Modes"
></label>
<watch-action-mode-table
xpack-watch="watchEditExecuteDetail.watch"
on-change="watchEditExecuteDetail.onActionModesChanged"

View file

@ -1,14 +1,18 @@
<div class="kuiInfoPanel kuiInfoPanel--info">
<div class="kuiInfoPanelHeader">
<span class="kuiInfoPanelHeader__icon kuiIcon kuiIcon--info fa-info"></span>
<span class="kuiInfoPanelHeader__title">
Test your watch execution
</span>
<span
class="kuiInfoPanelHeader__title"
i18n-id="xpack.watcher.sections.watchEdit.executeInfoPanel.testWatchExecutionTitle"
i18n-default-message="Test your watch execution"
></span>
</div>
<div class="kuiInfoPanelBody">
<div class="kuiInfoPanelBody__message">
To modify how the watch is executed, expand the sections below
</div>
<div
class="kuiInfoPanelBody__message"
i18n-id="xpack.watcher.sections.watchEdit.executeInfoPanel.howToModifyWatchExecutionDescription"
i18n-default-message="To modify how the watch is executed, expand the sections below"
></div>
</div>
</div>

View file

@ -1,6 +1,10 @@
<div class="kuiBar">
<div class="kuiBarSection">
<h2 class="euiTitle euiTitle--medium">New watch</h2>
<h2
class="euiTitle euiTitle--medium"
i18n-id="xpack.watcher.sections.watchEdit.titleBar.newWatchTitle"
i18n-default-message="New watch"
></h2>
</div>
<div class="kuiBarSection">
<div class="kuiButtonGroup">
@ -9,25 +13,25 @@
ng-disabled="!watchEditTitleBar.isWatchValid"
ng-click="watchEditTitleBar.onWatchSave()"
data-test-subj="btnSaveWatch"
>
Save
</button>
i18n-id="xpack.watcher.sections.watchEdit.titleBar.saveButtonLabel"
i18n-default-message="Save"
></button>
<button
class="kuiButton kuiButton--basic"
ng-click="watchEditTitleBar.onClose()"
data-test-subj="btnCancel"
>
Cancel
</button>
i18n-id="xpack.watcher.sections.watchEdit.titleBar.cancelButtonLabel"
i18n-default-message="Cancel"
></button>
<button
ng-if="!watchEditTitleBar.watch.isNew"
class="kuiButton kuiButton--danger kuiButton--iconText"
ng-click="watchEditTitleBar.onWatchDelete()"
tooltip="Delete Watch"
tooltip="{{ 'xpack.watcher.sections.watchEdit.titleBar.deleteButtonTooltip' | i18n: { defaultMessage: 'Delete Watch' } }}"
data-test-subj="btnDeleteWatch"
>
Delete
</button>
i18n-id="xpack.watcher.sections.watchEdit.titleBar.deleteButtonLabel"
i18n-default-message="Delete"
></button>
</div>
</div>
</div>

View file

@ -12,8 +12,11 @@
<div class="kuiFieldGroupSection kuiFieldGroupSection--wide">
<label
for="{{watchEditTitlePanel.makeId('watchName')}}"
class="kuiLabel kuiVerticalRhythmSmall">
Name
class="kuiLabel kuiVerticalRhythmSmall"
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.watchNameLabel"
i18n-default-message="Name"
>
</label>
<div class="kuiVerticalRhythmSmall">
<input
@ -24,7 +27,7 @@
input-focus
required
ng-model="watchEditTitlePanel.watch.name"
placeholder="My Threshold Watch"
placeholder="{{'xpack.watcher.sections.watchEdit.titlePanel.watchNamePlaceholder' | i18n: { defaultMessage: 'My Threshold Watch' } }}"
>
</div>
<div class="kuiSubText kuiSubduedText kuiVerticalRhythmSmall">
@ -33,9 +36,9 @@
xpack-aria-describes="{{watchEditTitlePanel.makeId('watchName')}}"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.isValidationMessageVisible('watchName', 'required')"
>
Name is required
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.watchNameIsRequiredValidationMessage"
i18n-default-message="Name is required"
></div>
&nbsp;
</div>
</div>
@ -44,8 +47,10 @@
<div class="kuiFieldGroupSection kuiFieldGroupSection--wide">
<label
for="indexSelectSearchBox"
class="kuiLabel kuiVerticalRhythmSmall">
Indices to query
class="kuiLabel kuiVerticalRhythmSmall"
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.indicesToQueryLabel"
i18n-default-message="Indices to query"
>
</label>
<div
class="kuiVerticalRhythmSmall watchEditTitleIndexSelectContainer"
@ -66,35 +71,39 @@
xpack-aria-describes="{{watchEditTitlePanel.makeId('indexSelectSearchBox')}}"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.showRequiredIndexSelectionValidationMessage()"
>
Enter one or more indices
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.enterOneOrMoreIndicesValidationMessage"
i18n-default-message="Enter one or more indices"
></div>
<div
id="{{watchEditTitlePanel.makeId(['indexSelectSearchBox', 'invalid'])}}"
xpack-aria-describes="{{watchEditTitlePanel.makeId('indexSelectSearchBox')}}"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.showInvalidIndexValidationMessage()"
>
Your index query does not match any valid indices
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.queryDoesNotMatchAnyValidIndicesValidationMessage"
i18n-default-message="Your index query does not match any valid indices"
></div>
<div
id="{{watchEditTitlePanel.makeId(['indexSelectSearchBox', 'notimefield'])}}"
xpack-aria-describes="{{watchEditTitlePanel.makeId('indexSelectSearchBox')}}"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.showNoTimeFieldsValidationMessage()"
>
Your index query does not have an associated time field
</div>
<span>Use * to broaden your search query</span>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.associatedTimeFieldIsMissedInIndexQueryValidationMessage"
i18n-default-message="Your index query does not have an associated time field"
></div>
<span
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.howToBroadenSearchQueryDescription"
i18n-default-message="Use * to broaden your search query"
></span>
</div>
</div>
<div class="kuiFieldGroupSection">
<label
for="{{watchEditTitlePanel.makeId('timeField')}}"
class="kuiLabel kuiVerticalRhythmSmall">
Time field
</label>
class="kuiLabel kuiVerticalRhythmSmall"
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.timeFieldLabel"
i18n-default-message="Time field"
></label>
<div class="kuiVerticalRhythmSmall">
<select
class="kuiSelect"
@ -104,7 +113,11 @@
ng-model="watchEditTitlePanel.watch.timeField"
ng-options="timeField.name as timeField.name group by timeField.normalizedType for timeField in watchEditTitlePanel.timeFields"
>
<option value="">Select a field</option>
<option
value=""
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.timeFieldOptionLabel"
i18n-default-message="Select a field"
></option>
</select>
</div>
<div class="kuiSubText kuiSubduedText kuiVerticalRhythmSmall">
@ -113,9 +126,9 @@
xpack-aria-describes="{{watchEditTitlePanel.makeId('timeField')}}"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.isValidationMessageVisible('timeField', 'required')"
>
A time field is required
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.timeFieldIsRequiredValidationText"
i18n-default-message="A time field is required"
></div>
&nbsp;
</div>
</div>
@ -125,9 +138,9 @@
id="durationSelectTriggerIntervalSizeLabel"
for="durationSelectTriggerIntervalSize"
class="kuiLabel kuiVerticalRhythmSmall"
>
Run watch every
</label>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.watchIntervalLabel"
i18n-default-message="Run watch every"
></label>
<div class="kuiVerticalRhythmSmall" id="durationSelectTriggerIntervalSize" role="group">
<duration-select
@ -145,41 +158,42 @@
xpack-aria-describes="durationSelectTriggerIntervalSize"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.isValidationMessageVisible('durationSelectTriggerIntervalSize', 'required')"
>
Interval size is required
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeIsRequiredValidationMessage"
i18n-default-message="Interval size is required"
></div>
<div
id="{{watchEditTitlePanel.makeId(['durationSelectTriggerIntervalSize', 'min'])}}"
xpack-aria-describes="durationSelectTriggerIntervalSize"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.isValidationMessageVisible('durationSelectTriggerIntervalSize', 'min')"
>
Interval size cannot be a negative number
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeNegativeNumberValidationMessage"
i18n-default-message="Interval size cannot be a negative number"
></div>
<div
id="{{watchEditTitlePanel.makeId(['durationSelectTriggerIntervalSize', 'number'])}}"
xpack-aria-describes="durationSelectTriggerIntervalSize"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.isValidationMessageVisible('durationSelectTriggerIntervalSize', 'number')"
>
Interval size must be a valid number
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeValidNumberValidationMessage"
i18n-default-message="Interval size must be a valid number"
></div>
<div
id="{{watchEditTitlePanel.makeId(['durationSelectTriggerIntervalUnit', 'required'])}}"
xpack-aria-describes="durationSelectTriggerIntervalUnit"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.isValidationMessageVisible('durationSelectTriggerIntervalUnit', 'required')"
>
An interval size is required
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeUnitIsRequiredValidationMessage"
i18n-default-message="An interval size is required"
></div>
<div
id="{{watchEditTitlePanel.makeId(['durationSelectTriggerIntervalSize', 'minimumDuration'])}}"
xpack-aria-describes="durationSelectTriggerIntervalSize durationSelectTriggerIntervalUnit"
class="kuiInputNote kuiInputNote--danger"
ng-if="watchEditTitlePanel.isValidationMessageVisible('durationSelectTriggerIntervalSize', 'minimumDuration', false)"
>
The minimum duration is {{watchEditTitlePanel.triggerIntervalMinimumSize}}{{watchEditTitlePanel.triggerIntervalMinimumUnit}}
</div>
i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeMinimumDurationValidationMessage"
i18n-default-message=" The minimum duration is {minSize}{minUnit}"
i18n-values="{ minSize: watchEditTitlePanel.triggerIntervalMinimumSize, minUnit: watchEditTitlePanel.triggerIntervalMinimumUnit }"
></div>
</div>
</div>
</div>

View file

@ -19,7 +19,7 @@ const app = uiModules.get('xpack/watcher');
const VALID_NORMALIZED_TYPES = ['date'];
app.directive('watchEditTitlePanel', function ($injector) {
app.directive('watchEditTitlePanel', function ($injector, i18n) {
const htmlIdGeneratorFactory = $injector.get('xpackWatcherHtmlIdGeneratorFactory');
return {
@ -90,7 +90,10 @@ app.directive('watchEditTitlePanel', function ($injector) {
get title() {
if (this.watch.isNew) {
const typeName = this.watch.typeName.toLowerCase();
return `Create a new ${typeName}`;
return i18n('xpack.watcher.sections.watchEdit.titlePanel.createNewTypeOfWatchTitle', {
defaultMessage: 'Create a new {typeName}',
values: { typeName },
});
} else {
return this.watch.name;
}

View file

@ -1,5 +1,8 @@
<div class="watch-simulation-result">
<label>Simulation Status:</label>
<label
i18n-id="xpack.watcher.sections.watchEdit.watchExecuteSummary.simulationStatusLabel"
i18n-default-message="Simulation Status:"
></label>
<watch-state-icon watch-status="watchEditWatchExecuteSummary.watchHistoryItem.watchStatus"></watch-state-icon>
<span>{{ watchEditWatchExecuteSummary.watchHistoryItem.watchStatus.state }}</span>
</div>

View file

@ -16,7 +16,10 @@
></watch-history-item-actions-summary>
</div>
<div class="kuiViewContentItem kuiVerticalRhythm">
<label>Execution Output:</label>
<label
i18n-id="xpack.watcher.sections.watchHistoryItem.executionOutputLabel"
i18n-default-message="Execution Output:"
></label>
<watch-history-item-detail watch-history-item="watchHistoryItem.watchHistoryItem"></watch-history-item-detail>
</div>
</div>

View file

@ -1,10 +1,30 @@
<table class="kuiTable kuiTable--fluid kuiVerticalRhythm">
<thead>
<tr>
<th scope="col" class="kuiTableHeaderCell">Action</th>
<th scope="col" class="kuiTableHeaderCell">Type</th>
<th scope="col" class="kuiTableHeaderCell">State</th>
<th scope="col" class="kuiTableHeaderCell">Reason</th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchHistoryItem.actionsSummary.actionHeaderCellLabel"
i18n-default-message="Action"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchHistoryItem.actionsSummary.typeHeaderCellLabel"
i18n-default-message="Type"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchHistoryItem.actionsSummary.stateHeaderCellLabel"
i18n-default-message="State"
></th>
<th
scope="col"
class="kuiTableHeaderCell"
i18n-id="xpack.watcher.sections.watchHistoryItem.actionsSummary.reasonHeaderCellLabel"
i18n-default-message="Reason"
></th>
</tr>
</thead>
<tr ng-repeat="actionDetail in watchHistoryItemActionsSummary.actionDetails">

View file

@ -1,5 +1,8 @@
<div>
<label>Execution Status:</label>
<label
i18n-id="xpack.watcher.sections.watchHistoryItem.watchSummary.executionStatusLabel"
i18n-default-message="Execution Status:"
></label>
<watch-state-icon
watch-status="watchHistoryItemWatchSummary.watchHistoryItem.watchStatus"
></watch-state-icon>

View file

@ -1,7 +1,7 @@
<kbn-management-app section="elasticsearch/watcher">
<div class="kuiViewContent">
<forbidden-message ng-if="watchList.forbidden">
You do not have permission to manage watches.
{{ 'xpack.watcher.sections.watchList.noPermissionToManageWatchesText' | i18n: { defaultMessage: 'You do not have permission to manage watches.' } }}
</forbidden-message>
<div
@ -13,19 +13,19 @@
class="kuiButton kuiButton--primary"
ng-click="watchList.onClickCreateThresholdAlert()"
data-test-subj="createThresholdAlertButton"
tooltip="Send an alert on a specific condition"
>
Create threshold alert
</button>
tooltip="{{ 'xpack.watcher.sections.watchList.createThresholdAlertButtonTooltip' | i18n: { defaultMessage: 'Send an alert on a specific condition' } }}"
i18n-id="xpack.watcher.sections.watchList.createThresholdAlertButtonLabel"
i18n-default-message="Create threshold alert"
></button>
<button
class="kuiButton kuiButton--primary"
ng-click="watchList.onClickCreateAdvancedWatch()"
data-test-subj="createAdvancedWatchButton"
tooltip="Set up a custom watch in raw JSON"
>
Create advanced watch
</button>
tooltip="{{ 'xpack.watcher.sections.watchList.createAdvancedWatchTooltip' | i18n: { defaultMessage: 'Set up a custom watch in raw JSON' } }}"
i18n-id="xpack.watcher.sections.watchList.createAdvancedWatchButtonLabel"
i18n-default-message="Create advanced watch"
></button>
</div>
<div class="kuiControlledTable kuiVerticalRhythm">
@ -43,9 +43,9 @@
ng-disabled="!watchList.hasSelectedWatches"
ng-click="watchList.onSelectedWatchesDelete()"
data-test-subj="btnDeleteWatches"
>
Delete
</button>
i18n-id="xpack.watcher.sections.watchList.deleteWatchButtonLabel"
i18n-default-message="Delete"
></button>
</div>
<div class="kuiToolBarSection">
@ -75,15 +75,15 @@
</watch-table>
<table-info ng-show="!watchList.hasPageOfWatches">
No watches found.
{{ 'xpack.watcher.sections.watchList.watchesNotFoundText' | i18n: { defaultMessage: 'No watches found.' } }}
</table-info>
<div class="kuiToolBarFooter">
<div class="kuiToolBarFooterSection">
<tool-bar-selected-count
count="watchList.selectedWatches.length"
singular-name="watch"
plural-name="watches"
singular-name="{{ 'xpack.watcher.sections.watchList.selectedSingleWatchText' | i18n: { defaultMessage: 'watch' } }}"
plural-name="{{ 'xpack.watcher.sections.watchList.selectedMultipleWatchText' | i18n: { defaultMessage: 'watches' } }}"
ng-show="watchList.hasSelectedWatches"
></tool-bar-selected-count>
</div>

View file

@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
import pluralize from 'pluralize';
import { uiModules } from 'ui/modules';
import { InitAfterBindingsWorkaround } from 'ui/compat';
import { toastNotifications } from 'ui/notify';
@ -22,7 +21,7 @@ import 'plugins/watcher/services/license';
const app = uiModules.get('xpack/watcher');
app.directive('watchList', function ($injector) {
app.directive('watchList', function ($injector, i18n) {
const pagerFactory = $injector.get('pagerFactory');
const watchesService = $injector.get('xpackWatcherWatchesService');
const licenseService = $injector.get('xpackWatcherLicenseService');
@ -137,10 +136,15 @@ app.directive('watchList', function ($injector) {
onSelectedWatchesDelete = () => {
const watchesBeingDeleted = this.selectedWatches;
const numWatchesToDelete = watchesBeingDeleted.length;
const watchesStr = pluralize('Watch', numWatchesToDelete);
const confirmModalText = `This will permanently delete ${numWatchesToDelete} ${watchesStr}. Are you sure?`;
const confirmButtonText = `Delete ${numWatchesToDelete} ${watchesStr}`;
const confirmModalText = i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesConfirmModal.descriptionText', {
defaultMessage: 'This will permanently delete {numWatchesToDelete, plural, one {# Watch} other {# Watches}}. Are you sure?',
values: { numWatchesToDelete }
});
const confirmButtonText = i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesConfirmModal.deleteButtonLabel', {
defaultMessage: 'Delete {numWatchesToDelete, plural, one {# Watch} other {# Watches}} ',
values: { numWatchesToDelete }
});
const confirmModalOptions = {
confirmButtonText,
@ -154,7 +158,6 @@ app.directive('watchList', function ($injector) {
this.watchesBeingDeleted = watchesBeingDeleted;
const numWatchesToDelete = this.watchesBeingDeleted.length;
const watchesStr = pluralize('Watch', numWatchesToDelete);
const watchIds = this.watchesBeingDeleted.map(watch => watch.id);
return watchesService.deleteWatches(watchIds)
@ -164,11 +167,23 @@ app.directive('watchList', function ($injector) {
const numTotal = numWatchesToDelete;
if (numSuccesses > 0) {
toastNotifications.addSuccess(`Deleted ${numSuccesses} out of ${numTotal} selected ${watchesStr}`);
toastNotifications.addSuccess(
i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesSuccessNotification.descriptionText', {
defaultMessage:
'Deleted {numSuccesses} out of {numTotal} selected {numWatchesToDelete, plural, one {# watch} other {# watches}}',
values: { numSuccesses, numTotal, numWatchesToDelete }
})
);
}
if (numErrors > 0) {
toastNotifications.addError(`Couldn't delete ${numErrors} out of ${numTotal} selected ${watchesStr}`);
toastNotifications.addError(
i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesErrorNotification.descriptionText', {
defaultMessage:
'Couldn\'t delete {numErrors} out of {numTotal} selected {numWatchesToDelete, plural, one {# watch} other {# watches}}',
values: { numErrors, numTotal, numWatchesToDelete }
})
);
}
this.loadWatches();

View file

@ -16,7 +16,7 @@
sort-field="watchTable.sortField"
sort-reverse="watchTable.sortReverse"
>
ID
{{ 'xpack.watcher.sections.watchList.watchTable.idColumnLabel' | i18n: { defaultMessage: 'ID' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell" width="25%">
@ -26,7 +26,7 @@
sort-field="watchTable.sortField"
sort-reverse="watchTable.sortReverse"
>
Name
{{ 'xpack.watcher.sections.watchList.watchTable.nameColumnLabel' | i18n: { defaultMessage: 'Name' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
@ -36,7 +36,7 @@
sort-field="watchTable.sortField"
sort-reverse="watchTable.sortReverse"
>
State
{{ 'xpack.watcher.sections.watchList.watchTable.stateColumnLabel' | i18n: { defaultMessage: 'State' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
@ -46,7 +46,7 @@
sort-field="watchTable.sortField"
sort-reverse="watchTable.sortReverse"
>
Comment
{{ 'xpack.watcher.sections.watchList.watchTable.commentColumnLabel' | i18n: { defaultMessage: 'Comment' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
@ -56,7 +56,7 @@
sort-field="watchTable.sortField"
sort-reverse="watchTable.sortReverse"
>
Last Fired
{{ 'xpack.watcher.sections.watchList.watchTable.lastFiredColumnLabel' | i18n: { defaultMessage: 'Last Fired' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell">
@ -66,7 +66,7 @@
sort-field="watchTable.sortField"
sort-reverse="watchTable.sortReverse"
>
Last Triggered
{{ 'xpack.watcher.sections.watchList.watchTable.lastTriggeredColumnLabel' | i18n: { defaultMessage: 'Last Triggered' } }}
</sortable-column>
</th>
<th scope="col" class="kuiTableHeaderCell"></th>
@ -155,13 +155,16 @@
<div class="kuiMenuButtonGroup kuiMenuButtonGroup--alignRight">
<a
class="kuiMenuButton kuiMenuButton--basic kuiMenuButton--iconText"
title="Edit"
title="{{ 'xpack.watcher.sections.watchList.watchTable.menuEditButtonTitle' | i18n: { defaultMessage: 'Edit' } }}"
ng-href="#/management/elasticsearch/watcher/watches/watch/{{item.watch.id}}/edit"
ng-if="watchTable.isEditable(item)"
data-test-subj="lnkWatchEdit-{{ item.watch.id }}"
>
<span class="kuiMenuButton__icon kuiIcon fa-pencil"></span>
<span>Edit</span>
<span
i18n-id="xpack.watcher.sections.watchList.watchTable.menuEditButtonLabel"
i18n-default-message="Edit"
></span>
</a>
</div>
</div>

View file

@ -5,16 +5,21 @@
*/
import { management } from 'ui/management';
import { i18n } from '@kbn/i18n';
import 'plugins/watcher/services/license';
management.getSection('elasticsearch').register('watcher', {
display: 'Watcher',
display: i18n.translate('xpack.watcher.sections.watchList.managementSection.watcherDisplayName', {
defaultMessage: 'Watcher' }
),
order: 4,
url: '#/management/elasticsearch/watcher/'
});
management.getSection('elasticsearch/watcher').register('watches', {
display: 'Watches',
display: i18n.translate('xpack.watcher.sections.watchList.managementSection.watchesDisplayName', {
defaultMessage: 'Watches' }
),
order: 1
});
@ -23,19 +28,25 @@ management.getSection('elasticsearch/watcher').register('watch', {
});
management.getSection('elasticsearch/watcher/watch').register('status', {
display: 'Status',
display: i18n.translate('xpack.watcher.sections.watchList.managementSection.statusDisplayName', {
defaultMessage: 'Status' }
),
order: 1,
visible: false
});
management.getSection('elasticsearch/watcher/watch').register('edit', {
display: 'Edit',
display: i18n.translate('xpack.watcher.sections.watchList.managementSection.editDisplayName', {
defaultMessage: 'Edit' }
),
order: 2,
visible: false
});
management.getSection('elasticsearch/watcher/watch').register('new', {
display: 'New Watch',
display: i18n.translate('xpack.watcher.sections.watchList.managementSection.newWatchDisplayName', {
defaultMessage: 'New Watch' }
),
order: 1,
visible: false
});