Skip to content

Commit

Permalink
replacing Angular watch list UI with React one (#32401)
Browse files Browse the repository at this point in the history
* replacing Angular watch list UI with React one

* fixing TS issues

* addressing PR feedback

* fixing TS issues

* more TS fixes

* TS fix

* addressing more PR feedback

* TS fixes

* removing unused/incompatible translations

* fixing functional test

* prettier fix

* fixing typp

* fixing missing comma

* fixing data-test-subject typo

* fixing functional test

* fixing functional tests

* fixing delete functional tests

* addressing PR feedback
  • Loading branch information
bmcconaghy authored Mar 7, 2019
1 parent ae754ac commit a170f7a
Show file tree
Hide file tree
Showing 42 changed files with 609 additions and 807 deletions.
17 changes: 0 additions & 17 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -8117,31 +8117,14 @@
"xpack.watcher.sections.watchHistoryItem.executionOutputLabel": "执行输出:",
"xpack.watcher.sections.watchHistoryItem.watchSummary.executionStatusLabel": "执行状态:",
"xpack.watcher.sections.watchList.createAdvancedWatchButtonLabel": "创建高级监视",
"xpack.watcher.sections.watchList.createAdvancedWatchTooltip": "以原始 JSON 格式设置定制监视",
"xpack.watcher.sections.watchList.createThresholdAlertButtonLabel": "创建阈值告警",
"xpack.watcher.sections.watchList.createThresholdAlertButtonTooltip": "在特定条件下发送告警",
"xpack.watcher.sections.watchList.deleteSelectedWatchesConfirmModal.deleteButtonLabel": "删除 {numWatchesToDelete, plural, one {# 个监视} other {# 个监视}} ",
"xpack.watcher.sections.watchList.deleteSelectedWatchesConfirmModal.descriptionText": "这将永久删除 {numWatchesToDelete, plural, one {# 个监视} other {# 个监视}}。是否确定?",
"xpack.watcher.sections.watchList.deleteSelectedWatchesErrorNotification.descriptionText": "已选的 {numTotal}{numWatchesToDelete, plural, one {# 个监视} other {# 个监视}}有 {numErrors} 个无法删除",
"xpack.watcher.sections.watchList.deleteSelectedWatchesSuccessNotification.descriptionText": "已选的 {numTotal}{numWatchesToDelete, plural, one {# 个监视} other {# 个监视}}有 {numSuccesses} 个已删除",
"xpack.watcher.sections.watchList.deleteWatchButtonLabel": "删除",
"xpack.watcher.sections.watchList.managementSection.editDisplayName": "编辑",
"xpack.watcher.sections.watchList.managementSection.newWatchDisplayName": "新建监视",
"xpack.watcher.sections.watchList.managementSection.statusDisplayName": "状态",
"xpack.watcher.sections.watchList.managementSection.watcherDisplayName": "Watcher",
"xpack.watcher.sections.watchList.managementSection.watchesDisplayName": "监视",
"xpack.watcher.sections.watchList.noPermissionToManageWatchesText": "您无权管理监视。",
"xpack.watcher.sections.watchList.selectedMultipleWatchText": "监视",
"xpack.watcher.sections.watchList.selectedSingleWatchText": "监视",
"xpack.watcher.sections.watchList.watchesNotFoundText": "未找到任何监视。",
"xpack.watcher.sections.watchList.watchTable.commentColumnLabel": "注释",
"xpack.watcher.sections.watchList.watchTable.idColumnLabel": "ID",
"xpack.watcher.sections.watchList.watchTable.lastFiredColumnLabel": "最后发送时间",
"xpack.watcher.sections.watchList.watchTable.lastTriggeredColumnLabel": "最后触发时间",
"xpack.watcher.sections.watchList.watchTable.menuEditButtonLabel": "编辑",
"xpack.watcher.sections.watchList.watchTable.menuEditButtonTitle": "编辑",
"xpack.watcher.sections.watchList.watchTable.nameColumnLabel": "名称",
"xpack.watcher.sections.watchList.watchTable.stateColumnLabel": "状态",
"xpack.watcher.server.checkLicense.licenseExpiredTextMessage": "您不能使用 {watcher},因为您的 {licenseType} 许可证已过期",
"xpack.watcher.thresholdPreviewChart.dataDoesNotExistTextMessage": "您的索引和条件未返回任何数据",
"xpack.watcher.thresholdWatchExpression.aggField.itemDescription": "/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ACTION_MODES = {

export const ACTION_MODES: { [key: string]: string } = {
// The action execution will be simulated. For example, The email action will create the email that would have been sent but will not actually send it. In this mode, the action may be throttled if the current state of the watch indicates it should be.
SIMULATE: 'simulate',

Expand All @@ -19,6 +18,5 @@ export const ACTION_MODES = {
FORCE_EXECUTE: 'force_execute',

// The action will be skipped and won’t be executed nor simulated. Effectively forcing the action to be throttled.
SKIP: 'skip'

SKIP: 'skip',
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,34 @@

import { i18n } from '@kbn/i18n';

export const ACTION_STATES = {

export const ACTION_STATES: { [key: string]: string } = {
// Action is not being executed because conditions haven't been met
OK: i18n.translate('xpack.watcher.constants.actionStates.okStateText', {
defaultMessage: 'OK'
defaultMessage: 'OK',
}),

// Action has been acknowledged by user
ACKNOWLEDGED: i18n.translate('xpack.watcher.constants.actionStates.acknowledgedStateText', {
defaultMessage: 'Acked'
defaultMessage: 'Acked',
}),

// Action has been throttled (time-based) by the system
THROTTLED: i18n.translate('xpack.watcher.constants.actionStates.throttledStateText', {
defaultMessage: 'Throttled'
defaultMessage: 'Throttled',
}),

// Action has been completed
FIRING: i18n.translate('xpack.watcher.constants.actionStates.firingStateText', {
defaultMessage: 'Firing'
defaultMessage: 'Firing',
}),

// Action has failed
ERROR: i18n.translate('xpack.watcher.constants.actionStates.errorStateText', {
defaultMessage: 'Error'
defaultMessage: 'Error',
}),

// Action has a configuration error
CONFIG_ERROR: i18n.translate('xpack.watcher.constants.actionStates.configErrorStateText', {
defaultMessage: 'Config error'
defaultMessage: 'Config error',
}),

};
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ACTION_TYPES = {

export const ACTION_TYPES: { [key: string]: string } = {
EMAIL: 'email',

WEBHOOK: 'webhook',
Expand All @@ -22,6 +21,5 @@ export const ACTION_TYPES = {

PAGERDUTY: 'pagerduty',

UNKNOWN: 'unknown/invalid'

UNKNOWN: 'unknown/invalid',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const AGG_TYPES = {

export const AGG_TYPES: { [key: string]: string } = {
COUNT: 'count',

AVERAGE: 'avg',
Expand All @@ -14,6 +13,5 @@ export const AGG_TYPES = {

MIN: 'min',

MAX: 'max'

MAX: 'max',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const COMPARATORS = {

export const COMPARATORS: { [key: string]: string } = {
GREATER_THAN: '>',

LESS_THAN: '<'

LESS_THAN: '<',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ERROR_CODES = {

export const ERROR_CODES: { [key: string]: string } = {
// Property missing on object
ERR_PROP_MISSING: 'ERR_PROP_MISSING',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ES_SCROLL_SETTINGS = {

export const ES_SCROLL_SETTINGS: {
KEEPALIVE: string;
PAGE_SIZE: number;
} = {
// How long to keep a scroll alive
KEEPALIVE: '30s',

// How many results to return per scroll response
PAGE_SIZE: 100
PAGE_SIZE: 100,
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const INDEX_NAMES = {
export const INDEX_NAMES: { [key: string]: string } = {
WATCHES: '.watches',
WATCHER_HISTORY: '.watcher-history-*',
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
*/

// Durations are in ms
export const LISTS = {
NEW_ITEMS_HIGHLIGHT_DURATION: 1 * 1000
export const LISTS: { [key: string]: number } = {
NEW_ITEMS_HIGHLIGHT_DURATION: 1 * 1000,
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const PAGINATION = {
PAGE_SIZE: 20
export const PAGINATION: { [key: string]: number } = {
PAGE_SIZE: 20,
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const WATCH_HISTORY = {
INITIAL_RANGE: 'now-1h'
export const PLUGIN: { [key: string]: string } = {
ID: 'watcher',
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// In milliseconds
const SIXTY_SECONDS = 60 * 1000;

export const REFRESH_INTERVALS = {
export const REFRESH_INTERVALS: { [key: string]: number } = {
WATCH_LIST: SIXTY_SECONDS,
WATCH_HISTORY: SIXTY_SECONDS,
WATCH_VISUALIZATION: SIXTY_SECONDS
WATCH_VISUALIZATION: SIXTY_SECONDS,
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ROUTES = {
export const ROUTES: { [key: string]: string } = {
API_ROOT: '/api/watcher',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const SORT_ORDERS = {
export const SORT_ORDERS: { [key: string]: string } = {
ASCENDING: 'asc',
DESCENDING: 'desc'
DESCENDING: 'desc',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const TIME_UNITS = {
export const TIME_UNITS: { [key: string]: string } = {
SECOND: 's',
MINUTE: 'm',
HOUR: 'h',
DAY: 'd'
DAY: 'd',
};
9 changes: 9 additions & 0 deletions x-pack/plugins/watcher/common/constants/watch_history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const WATCH_HISTORY: { [key: string]: string } = {
INITIAL_RANGE: 'now-1h',
};
33 changes: 0 additions & 33 deletions x-pack/plugins/watcher/common/constants/watch_state_comments.js

This file was deleted.

46 changes: 46 additions & 0 deletions x-pack/plugins/watcher/common/constants/watch_state_comments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* 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';

export const WATCH_STATE_COMMENTS: { [key: string]: string } = {
OK: '',

PARTIALLY_THROTTLED: i18n.translate(
'xpack.watcher.constants.watchStateComments.partiallyThrottledStateCommentText',
{
defaultMessage: 'Partially throttled',
}
),

THROTTLED: i18n.translate(
'xpack.watcher.constants.watchStateComments.throttledStateCommentText',
{
defaultMessage: 'Throttled',
}
),

PARTIALLY_ACKNOWLEDGED: i18n.translate(
'xpack.watcher.constants.watchStateComments.partiallyAcknowledgedStateCommentText',
{
defaultMessage: 'Partially acked',
}
),

ACKNOWLEDGED: i18n.translate(
'xpack.watcher.constants.watchStateComments.acknowledgedStateCommentText',
{
defaultMessage: 'Acked',
}
),

FAILING: i18n.translate(
'xpack.watcher.constants.watchStateComments.executionFailingStateCommentText',
{
defaultMessage: 'Execution failing',
}
),
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@

import { i18n } from '@kbn/i18n';

export const WATCH_STATES = {

export const WATCH_STATES: { [key: string]: string } = {
DISABLED: i18n.translate('xpack.watcher.constants.watchStates.disabledStateText', {
defaultMessage: 'Disabled'
defaultMessage: 'Disabled',
}),

OK: i18n.translate('xpack.watcher.constants.watchStates.okStateText', {
defaultMessage: 'OK'
defaultMessage: 'OK',
}),

FIRING: i18n.translate('xpack.watcher.constants.watchStates.firingStateText', {
defaultMessage: 'Firing'
defaultMessage: 'Firing',
}),

ERROR: i18n.translate('xpack.watcher.constants.watchStates.errorStateText', {
defaultMessage: 'Error!'
defaultMessage: 'Error',
}),

CONFIG_ERROR: i18n.translate('xpack.watcher.constants.watchStates.configErrorStateText', {
defaultMessage: 'Config error'
defaultMessage: 'Config error',
}),

};
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const WATCH_TYPES = {

export const WATCH_TYPES: { [key: string]: string } = {
JSON: 'json',

THRESHOLD: 'threshold',

MONITORING: 'monitoring'

MONITORING: 'monitoring',
};
Loading

0 comments on commit a170f7a

Please sign in to comment.