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
aab70b5c
Unverified
Commit
aab70b5c
authored
4 years ago
by
Kyle Doherty
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
disable sharing popover if the dashboard doesn't have data (#14266)
parent
96e15892
Branches
backport-restore-cancellations-release-x.50.x
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/dashboard/components/DashboardActions.jsx
+22
-2
22 additions, 2 deletions
...nd/src/metabase/dashboard/components/DashboardActions.jsx
with
22 additions
and
2 deletions
frontend/src/metabase/dashboard/components/DashboardActions.jsx
+
22
−
2
View file @
aab70b5c
import
React
from
"
react
"
;
import
{
t
}
from
"
ttag
"
;
import
cx
from
"
classnames
"
;
import
DashboardSharingEmbeddingModal
from
"
../containers/DashboardSharingEmbeddingModal.jsx
"
;
import
FullscreenIcon
from
"
metabase/components/icons/FullscreenIcon
"
;
...
...
@@ -26,6 +27,7 @@ export const getDashboardActions = (
onRefreshPeriodChange
,
onSharingClick
,
onEmbeddingClick
,
dashcardData
,
},
)
=>
{
const
isPublicLinksEnabled
=
MetabaseSettings
.
get
(
"
enable-public-sharing
"
);
...
...
@@ -33,6 +35,11 @@ export const getDashboardActions = (
const
buttons
=
[];
/* we consider the dashboard to be shareable if there is at least one card with data in it on the dashboard
markdown cards don't appear in dashcardData so we check to see if there is at least one value
*/
const
canShareDashboard
=
Object
.
keys
(
dashcardData
).
length
>
0
;
if
(
!
isEditing
&&
!
isEmpty
)
{
const
extraButtonClassNames
=
"
bg-brand-hover text-white-hover py2 px3 text-bold block cursor-pointer
"
;
...
...
@@ -40,9 +47,22 @@ export const getDashboardActions = (
buttons
.
push
(
<
PopoverWithTrigger
ref
=
"popover"
disabled
=
{
!
canShareDashboard
}
triggerElement
=
{
<
Tooltip
tooltip
=
{
t
`Sharing`
}
>
<
Icon
name
=
"share"
className
=
"text-brand-hover"
/>
<
Tooltip
tooltip
=
{
canShareDashboard
?
t
`Sharing`
:
t
`Add data to share this dashboard`
}
>
<
Icon
name
=
"share"
className
=
{
cx
({
"
text-brand-hover
"
:
canShareDashboard
,
"
text-light
"
:
!
canShareDashboard
,
})
}
/>
</
Tooltip
>
}
>
...
...
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