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

[Alerting UI]Changed rules table to support visual indication for disabled and muted alerts #104190

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/ja-JP.json
Expand Up @@ -22901,7 +22901,6 @@
"xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.status.active": "アクティブ",
"xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.status.inactive": "OK",
"xpack.triggersActionsUI.sections.alertDetails.alerts.disabledRuleTitle": "無効なルール",
"xpack.triggersActionsUI.sections.alertDetails.collapsedItemActons.disableTitle": "無効にする",
"xpack.triggersActionsUI.sections.alertDetails.collapsedItemActons.muteTitle": "ミュート",
"xpack.triggersActionsUI.sections.alertDetails.dismissButtonTitle": "閉じる",
"xpack.triggersActionsUI.sections.alertDetails.editAlertButtonLabel": "編集",
Expand Down Expand Up @@ -22955,10 +22954,8 @@
"xpack.triggersActionsUI.sections.alertsList.alertErrorReasonReading": "ルールの読み取り中にエラーが発生しました。",
"xpack.triggersActionsUI.sections.alertsList.alertErrorReasonRunning": "ルールの実行中にエラーが発生しました。",
"xpack.triggersActionsUI.sections.alertsList.alertErrorReasonUnknown": "不明な理由でエラーが発生しました。",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.actionsCount": "アクション",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.actionsTex": "アクション",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.alertTypeTitle": "型",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.intervalTitle": "次の間隔で実行",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.nameTitle": "名前",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.statusTitle": "ステータス",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.tagsText": "タグ",
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/translations/translations/zh-CN.json
Expand Up @@ -23262,7 +23262,6 @@
"xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.status.active": "活动",
"xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.status.inactive": "确定",
"xpack.triggersActionsUI.sections.alertDetails.alerts.disabledRuleTitle": "已禁用规则",
"xpack.triggersActionsUI.sections.alertDetails.collapsedItemActons.disableTitle": "禁用",
"xpack.triggersActionsUI.sections.alertDetails.collapsedItemActons.muteTitle": "静音",
"xpack.triggersActionsUI.sections.alertDetails.dismissButtonTitle": "关闭",
"xpack.triggersActionsUI.sections.alertDetails.editAlertButtonLabel": "编辑",
Expand Down Expand Up @@ -23316,10 +23315,8 @@
"xpack.triggersActionsUI.sections.alertsList.alertErrorReasonReading": "读取规则时发生错误。",
"xpack.triggersActionsUI.sections.alertsList.alertErrorReasonRunning": "运行规则时发生错误。",
"xpack.triggersActionsUI.sections.alertsList.alertErrorReasonUnknown": "由于未知原因发生错误。",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.actionsCount": "操作",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.actionsTex": "操作",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.alertTypeTitle": "类型",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.intervalTitle": "运行间隔",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.nameTitle": "名称",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.statusTitle": "状态",
"xpack.triggersActionsUI.sections.alertsList.alertsListTable.columns.tagsText": "标签",
Expand Down
Expand Up @@ -359,16 +359,16 @@ describe('disable button', () => {
<AlertDetails alert={alert} alertType={alertType} actionTypes={[]} {...mockAlertApis} />
)
.find(EuiSwitch)
.find('[name="disable"]')
.find('[name="enable"]')
.first();

expect(enableButton.props()).toMatchObject({
checked: false,
checked: true,
disabled: false,
});
});

it('should render a disable button when alert is disabled', () => {
it('should render a enable button when alert is disabled', () => {
const alert = mockAlert({
enabled: false,
});
Expand All @@ -390,11 +390,11 @@ describe('disable button', () => {
<AlertDetails alert={alert} alertType={alertType} actionTypes={[]} {...mockAlertApis} />
)
.find(EuiSwitch)
.find('[name="disable"]')
.find('[name="enable"]')
.first();

expect(enableButton.props()).toMatchObject({
checked: true,
checked: false,
disabled: false,
});
});
Expand Down Expand Up @@ -428,7 +428,7 @@ describe('disable button', () => {
/>
)
.find(EuiSwitch)
.find('[name="disable"]')
.find('[name="enable"]')
.first();

enableButton.simulate('click');
Expand Down Expand Up @@ -468,7 +468,7 @@ describe('disable button', () => {
/>
)
.find(EuiSwitch)
.find('[name="disable"]')
.find('[name="enable"]')
.first();

enableButton.simulate('click');
Expand Down Expand Up @@ -531,14 +531,14 @@ describe('disable button', () => {

// Disable the alert
await act(async () => {
wrapper.find('[data-test-subj="disableSwitch"] .euiSwitch__button').first().simulate('click');
wrapper.find('[data-test-subj="enableSwitch"] .euiSwitch__button').first().simulate('click');
await nextTick();
});
expect(disableAlert).toHaveBeenCalled();

// Enable the alert
await act(async () => {
wrapper.find('[data-test-subj="disableSwitch"] .euiSwitch__button').first().simulate('click');
wrapper.find('[data-test-subj="enableSwitch"] .euiSwitch__button').first().simulate('click');
await nextTick();
});
expect(enableAlert).toHaveBeenCalled();
Expand Down
Expand Up @@ -219,10 +219,10 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
<EuiFlexGroup justifyContent="flexEnd" wrap responsive={false} gutterSize="m">
<EuiFlexItem grow={false}>
<EuiSwitch
name="disable"
name="enable"
disabled={!canSaveAlert || !alertType.enabledInLicense}
checked={!isEnabled}
data-test-subj="disableSwitch"
checked={isEnabled}
data-test-subj="enableSwitch"
onChange={async () => {
if (isEnabled) {
setIsEnabled(false);
Expand All @@ -237,8 +237,8 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
}}
label={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertDetails.collapsedItemActons.disableTitle"
defaultMessage="Disable"
id="xpack.triggersActionsUI.sections.alertDetails.collapsedItemActons.enableTitle"
defaultMessage="Enable"
/>
}
/>
Expand Down
Expand Up @@ -133,6 +133,7 @@ export const AlertEdit = ({
aria-labelledby="flyoutAlertEditTitle"
size="m"
maxWidth={620}
ownFocus={false}
>
<EuiFlyoutHeader hasBorder>
<EuiTitle size="s" data-test-subj="editAlertFlyoutTitle">
Expand Down
Expand Up @@ -95,13 +95,13 @@ export const AlertStatusFilter: React.FunctionComponent<AlertStatusFilterProps>
export function getHealthColor(status: AlertExecutionStatuses) {
switch (status) {
case 'active':
return 'primary';
return 'success';
case 'error':
return 'danger';
case 'ok':
return 'subdued';
case 'pending':
return 'success';
return 'accent';
default:
return 'warning';
}
Expand Down
Expand Up @@ -5,3 +5,29 @@
color: $euiColorDarkShade;
}
}

.alertSidebarItem {
YulNaumenko marked this conversation as resolved.
Show resolved Hide resolved
&:hover,
&:focus-within,
&[class*='-isActive'] {
.alertSidebarItem__action {
opacity: 1;
}
}
}

/**
* 1. Only visually hide the action, so that it's still accessible to screen readers.
* 2. When tabbed to, this element needs to be visible for keyboard accessibility.
*/
.alertSidebarItem__action {
opacity: 0; /* 1 */

&.alertSidebarItem__mobile {
opacity: 1;
}

&:focus {
opacity: 1; /* 2 */
}
}
Expand Up @@ -368,7 +368,7 @@ describe('alerts_list component with items', () => {
it('sorts alerts when clicking the name column', async () => {
await setup();
ymao1 marked this conversation as resolved.
Show resolved Hide resolved
wrapper
.find('[data-test-subj="tableHeaderCell_name_0"] .euiTableHeaderButton')
.find('[data-test-subj="tableHeaderCell_name_1"] .euiTableHeaderButton')
.first()
.simulate('click');

Expand Down