Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
77e1a472
Unverified
Commit
77e1a472
authored
9 months ago
by
Anton Kulyk
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Show alert sending time in alert form (#45062)
* Show alert sending time in alert form * F
parent
41250c62
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
e2e/test/scenarios/sharing/alert/email-alert.cy.spec.js
+25
-5
25 additions, 5 deletions
e2e/test/scenarios/sharing/alert/email-alert.cy.spec.js
frontend/src/metabase/query_builder/components/AlertModals/AlertModals.jsx
+25
-1
25 additions, 1 deletion
...base/query_builder/components/AlertModals/AlertModals.jsx
with
50 additions
and
6 deletions
e2e/test/scenarios/sharing/alert/email-alert.cy.spec.js
+
25
−
5
View file @
77e1a472
...
...
@@ -40,15 +40,35 @@ describe("scenarios > alert > email_alert", { tags: "@external" }, () => {
});
it
(
"
should respect email alerts toggled off (metabase#12349)
"
,
()
=>
{
cy
.
request
(
"
PUT
"
,
"
/api/setting/report-timezone
"
,
{
value
:
"
America/New_York
"
,
});
openAlertForQuestion
(
ORDERS_QUESTION_ID
);
// Turn off email
toggleChannel
(
"
Email
"
);
cy
.
findByTestId
(
"
alert-create
"
).
within
(()
=>
{
cy
.
findByText
(
/Emails will be sent at 12:00 AM ET/
).
should
(
"
exist
"
);
// Turn on Slack
toggleChannel
(
"
Slack
"
);
// Turn off email
toggleChannel
(
"
Email
"
);
cy
.
findByText
(
/Emails will be sent/
).
should
(
"
not.exist
"
);
cy
.
findByText
(
/Slack messages will be sent/
).
should
(
"
not.exist
"
);
cy
.
button
(
"
Done
"
).
click
();
// Turn on Slack
toggleChannel
(
"
Slack
"
);
cy
.
findByText
(
/Slack messages will be sent at 12:00 AM ET/
).
should
(
"
exist
"
,
);
toggleChannel
(
"
Email
"
);
cy
.
findByText
(
/Emails and Slack messages will be sent at 12:00 AM ET/
,
).
should
(
"
exist
"
);
toggleChannel
(
"
Email
"
);
cy
.
button
(
"
Done
"
).
click
();
});
cy
.
wait
(
"
@savedAlert
"
).
then
(({
response
:
{
body
}
})
=>
{
expect
(
body
.
channels
).
to
.
have
.
length
(
2
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/query_builder/components/AlertModals/AlertModals.jsx
+
25
−
1
View file @
77e1a472
...
...
@@ -481,6 +481,7 @@ class AlertEditFormInner extends Component {
onAlertChange
=
{
onAlertChange
}
/>
<
AlertEditSchedule
alert
=
{
alert
}
alertType
=
{
alertType
}
schedule
=
{
schedule
}
onScheduleChange
=
{
this
.
onScheduleChange
}
...
...
@@ -566,7 +567,29 @@ export const AlertSettingToggle = ({
</
div
>
);
export
function
AlertEditSchedule
({
alertType
,
schedule
,
onScheduleChange
})
{
function
getSchedulePickerSendTimeText
(
alert
)
{
const
channels
=
alert
.
channels
.
filter
(
channel
=>
channel
.
enabled
);
const
[
channel
]
=
channels
;
if
(
channels
.
length
===
0
)
{
return
;
}
if
(
channels
.
length
===
2
)
{
return
t
`Emails and Slack messages will be sent at`
;
}
if
(
channel
.
channel_type
===
"
email
"
)
{
return
t
`Emails will be sent at`
;
}
if
(
channel
.
channel_type
===
"
slack
"
)
{
return
t
`Slack messages will be sent at`
;
}
}
export
function
AlertEditSchedule
({
alert
,
alertType
,
schedule
,
onScheduleChange
,
})
{
return
(
<
div
>
<
h3
className
=
{
cx
(
CS
.
mt4
,
CS
.
mb3
,
CS
.
textDark
)
}
>
...
...
@@ -581,6 +604,7 @@ export function AlertEditSchedule({ alertType, schedule, onScheduleChange }) {
scheduleOptions
=
{
[
"
hourly
"
,
"
daily
"
,
"
weekly
"
]
}
onScheduleChange
=
{
onScheduleChange
}
textBeforeInterval
=
{
t
`Check`
}
textBeforeSendTime
=
{
getSchedulePickerSendTimeText
(
alert
)
}
/>
</
div
>
</
div
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment