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

[RAM] Conditional actions feedback on pr review #155804

Merged
merged 3 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('validateActions', () => {
false
)
).rejects.toThrowErrorMatchingInlineSnapshot(
'"Failed to validate actions due to the following error: Action throttle cannot be shorter than the schedule interval of 1m: default (1s)"'
'"Failed to validate actions due to the following error: Action frequency cannot be shorter than the schedule interval of 1m: default (1s)"'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export async function validateActions(
errors.push(
i18n.translate('xpack.alerting.rulesClient.validateActions.actionsWithInvalidThrottles', {
defaultMessage:
'Action throttle cannot be shorter than the schedule interval of {scheduleIntervalText}: {groups}',
'Action frequency cannot be shorter than the schedule interval of {scheduleIntervalText}: {groups}',
values: {
scheduleIntervalText: data.schedule.interval,
groups: actionsWithInvalidThrottles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@ describe('create()', () => {
],
});
await expect(rulesClient.create({ data })).rejects.toThrowErrorMatchingInlineSnapshot(
`"Failed to validate actions due to the following error: Action throttle cannot be shorter than the schedule interval of 3h: default (1h), group2 (3m)"`
`"Failed to validate actions due to the following error: Action frequency cannot be shorter than the schedule interval of 3h: default (1h), group2 (3m)"`
);
expect(unsecuredSavedObjectsClient.create).not.toHaveBeenCalled();
expect(taskManager.schedule).not.toHaveBeenCalled();
Expand Down Expand Up @@ -3122,7 +3122,7 @@ describe('create()', () => {
await expect(rulesClient.create({ data })).rejects.toThrowErrorMatchingInlineSnapshot(`
"Failed to validate actions due to the following 2 errors:
- Actions missing frequency parameters: group3
- Action throttle cannot be shorter than the schedule interval of 3h: default (1h), group2 (3m)"
- Action frequency cannot be shorter than the schedule interval of 3h: default (1h), group2 (3m)"
`);
expect(unsecuredSavedObjectsClient.create).not.toHaveBeenCalled();
expect(taskManager.schedule).not.toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const ActionAlertsFilterQuery: React.FC<ActionAlertsFilterQueryProps> = (
label={i18n.translate(
'xpack.triggersActionsUI.sections.actionTypeForm.ActionAlertsFilterQueryToggleLabel',
{
defaultMessage: 'Send alert notification only if alert fields match a query',
defaultMessage: 'if alert matches a query',
}
)}
checked={queryEnabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const useDefaultTimezone = () => {
const useTimeframe = (initialTimeframe?: AlertsFilterTimeframe) => {
const timezone = useDefaultTimezone();
const DEFAULT_TIMEFRAME = {
days: [],
days: ISO_WEEKDAYS,
timezone,
hours: {
start: '00:00',
Expand Down Expand Up @@ -114,7 +114,9 @@ export const ActionAlertsFilterTimeframe: React.FC<ActionAlertsFilterTimeframePr
const newDays = previouslyHasDay
? timeframe.days.filter((d) => d !== day)
: [...timeframe.days, day];
updateTimeframe({ days: newDays });
if (newDays.length !== 0) {
updateTimeframe({ days: newDays });
}
},
[timeframe, updateTimeframe]
);
Expand Down Expand Up @@ -144,7 +146,7 @@ export const ActionAlertsFilterTimeframe: React.FC<ActionAlertsFilterTimeframePr
label={i18n.translate(
'xpack.triggersActionsUI.sections.actionTypeForm.ActionAlertsFilterTimeframeToggleLabel',
{
defaultMessage: 'Send alert notification within the selected time frame only',
defaultMessage: 'if alert is generated during timeframe',
}
)}
checked={timeframeEnabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ export const ActionNotifyWhen = ({
name="throttle"
data-test-subj="throttleInput"
prepend={i18n.translate(
'xpack.triggersActionsUI.sections.ruleForm.ruleNotifyWhen.label',
'xpack.triggersActionsUI.sections.ruleForm.frequencyNotifyWhen.label',
{
defaultMessage: 'Every',
defaultMessage: 'Run action every',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-05-04 at 3 43 05 PM

We need to revert this until we get rid of the flyout

}
)}
onChange={(e) => {
Expand Down