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
29fef2c4
Unverified
Commit
29fef2c4
authored
4 years ago
by
Tim Macdonald
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Validate dashboard sub to Slack creation (#14531)
[Fixes #14494]
parent
8c41e8c0
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
frontend/src/metabase/lib/pulse.js
+10
-8
10 additions, 8 deletions
frontend/src/metabase/lib/pulse.js
frontend/src/metabase/sharing/components/SharingSidebar.jsx
+7
-2
7 additions, 2 deletions
frontend/src/metabase/sharing/components/SharingSidebar.jsx
with
17 additions
and
10 deletions
frontend/src/metabase/lib/pulse.js
+
10
−
8
View file @
29fef2c4
...
...
@@ -46,23 +46,25 @@ export function channelIsValid(channel, channelSpec) {
return
true
;
}
function
pulseChannelsAreValid
(
pulse
,
channelSpecs
)
{
return
(
pulse
.
channels
.
filter
(
c
=>
channelIsValid
(
c
,
channelSpecs
&&
channelSpecs
[
c
.
channel_type
]),
).
length
>
0
||
false
);
}
export
function
pulseIsValid
(
pulse
,
channelSpecs
)
{
return
(
(
pulse
.
name
&&
pulse
.
cards
.
length
>
0
&&
pulse
.
channels
.
filter
(
c
=>
channelIsValid
(
c
,
channelSpecs
&&
channelSpecs
[
c
.
channel_type
]),
).
length
>
0
)
||
pulseChannelsAreValid
(
pulse
,
channelSpecs
))
||
false
);
}
export
function
dashboardPulseIsValid
(
pulse
,
channelSpecs
)
{
return
(
pulse
.
channels
.
filter
(
c
=>
channelIsValid
(
c
,
channelSpecs
&&
channelSpecs
[
c
.
channel_type
]),
).
length
>
0
||
false
);
return
pulseChannelsAreValid
(
pulse
,
channelSpecs
);
}
export
function
emailIsEnabled
(
pulse
)
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/sharing/components/SharingSidebar.jsx
+
7
−
2
View file @
29fef2c4
...
...
@@ -28,7 +28,11 @@ import User from "metabase/entities/users";
import
{
connect
}
from
"
react-redux
"
;
import
{
cleanPulse
,
createChannel
,
pulseIsValid
}
from
"
metabase/lib/pulse
"
;
import
{
cleanPulse
,
createChannel
,
dashboardPulseIsValid
,
}
from
"
metabase/lib/pulse
"
;
import
MetabaseSettings
from
"
metabase/lib/settings
"
;
import
{
...
...
@@ -604,7 +608,7 @@ class SharingSidebar extends React.Component {
onClose
=
{
this
.
handleSave
}
onCancel
=
{
this
.
onCancel
}
className
=
"text-dark"
closeIsDisabled
=
{
!
p
ulseIsValid
(
pulse
,
formInput
.
channels
)
}
closeIsDisabled
=
{
!
dashboardP
ulseIsValid
(
pulse
,
formInput
.
channels
)
}
>
<
div
className
=
"pt4 px4 flex align-center"
>
<
Icon
name
=
"mail"
className
=
"mr1"
size
=
{
21
}
/>
...
...
@@ -705,6 +709,7 @@ class SharingSidebar extends React.Component {
onClose
=
{
this
.
handleSave
}
onCancel
=
{
this
.
onCancel
}
className
=
"text-dark"
closeIsDisabled
=
{
!
dashboardPulseIsValid
(
pulse
,
formInput
.
channels
)
}
>
<
div
className
=
"pt4 flex align-center px4 mb3"
>
<
Icon
name
=
"slack"
className
=
"mr1"
size
=
{
21
}
/>
...
...
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