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
c102e28f
Commit
c102e28f
authored
6 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Fix issue with multiple popovers in permissions grid. Resolves #8206
parent
1613d85a
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/components/Popover.jsx
+42
-32
42 additions, 32 deletions
frontend/src/metabase/components/Popover.jsx
frontend/src/metabase/components/TooltipPopover.jsx
+8
-1
8 additions, 1 deletion
frontend/src/metabase/components/TooltipPopover.jsx
with
50 additions
and
33 deletions
frontend/src/metabase/components/Popover.jsx
+
42
−
32
View file @
c102e28f
...
...
@@ -53,6 +53,8 @@ export default class Popover extends Component {
// by default we align the popover to the center of the target. This
// causes the edges to be aligned
alignHorizontalEdge
:
PropTypes
.
bool
,
// don't wrap the popover in an OnClickOutsideWrapper
noOnClickOutsideWrapper
:
PropTypes
.
bool
,
};
static
defaultProps
=
{
...
...
@@ -67,6 +69,7 @@ export default class Popover extends Component {
targetOffsetY
:
5
,
sizeToFit
:
false
,
autoWidth
:
false
,
noOnClickOutsideWrapper
:
false
,
};
_getPopoverElement
()
{
...
...
@@ -119,40 +122,47 @@ export default class Popover extends Component {
const
childProps
=
{
maxHeight
:
this
.
_getMaxHeight
(),
};
return
(
<
OnClickOutsideWrapper
handleDismissal
=
{
this
.
handleDismissal
}
dismissOnEscape
=
{
this
.
props
.
dismissOnEscape
}
dismissOnClickOutside
=
{
this
.
props
.
dismissOnClickOutside
}
const
content
=
(
<
div
id
=
{
this
.
props
.
id
}
className
=
{
cx
(
"
PopoverBody
"
,
{
"
PopoverBody--withBackground
"
:
this
.
props
.
hasBackground
,
"
PopoverBody--withArrow
"
:
this
.
props
.
hasArrow
&&
this
.
props
.
hasBackground
,
"
PopoverBody--autoWidth
"
:
this
.
props
.
autoWidth
,
},
// TODO kdoh 10/16/2017 we should eventually remove this
this
.
props
.
className
,
)
}
style
=
{
this
.
props
.
style
}
>
<
div
id
=
{
this
.
props
.
id
}
className
=
{
cx
(
"
PopoverBody
"
,
{
"
PopoverBody--withBackground
"
:
this
.
props
.
hasBackground
,
"
PopoverBody--withArrow
"
:
this
.
props
.
hasArrow
&&
this
.
props
.
hasBackground
,
"
PopoverBody--autoWidth
"
:
this
.
props
.
autoWidth
,
},
// TODO kdoh 10/16/2017 we should eventually remove this
this
.
props
.
className
,
)
}
style
=
{
this
.
props
.
style
}
>
{
typeof
this
.
props
.
children
===
"
function
"
?
this
.
props
.
children
(
childProps
)
:
React
.
Children
.
count
(
this
.
props
.
children
)
===
1
&&
// NOTE: workaround for https://github.com/facebook/react/issues/12136
!
Array
.
isArray
(
this
.
props
.
children
)
?
React
.
cloneElement
(
React
.
Children
.
only
(
this
.
props
.
children
),
childProps
,
)
:
this
.
props
.
children
}
</
div
>
</
OnClickOutsideWrapper
>
{
typeof
this
.
props
.
children
===
"
function
"
?
this
.
props
.
children
(
childProps
)
:
React
.
Children
.
count
(
this
.
props
.
children
)
===
1
&&
// NOTE: workaround for https://github.com/facebook/react/issues/12136
!
Array
.
isArray
(
this
.
props
.
children
)
?
React
.
cloneElement
(
React
.
Children
.
only
(
this
.
props
.
children
),
childProps
,
)
:
this
.
props
.
children
}
</
div
>
);
if
(
this
.
props
.
noOnClickOutsideWrapper
)
{
return
content
;
}
else
{
return
(
<
OnClickOutsideWrapper
handleDismissal
=
{
this
.
handleDismissal
}
dismissOnEscape
=
{
this
.
props
.
dismissOnEscape
}
dismissOnClickOutside
=
{
this
.
props
.
dismissOnClickOutside
}
>
{
content
}
</
OnClickOutsideWrapper
>
);
}
}
_setTetherOptions
(
tetherOptions
,
o
)
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/components/TooltipPopover.jsx
+
8
−
1
View file @
c102e28f
...
...
@@ -32,7 +32,14 @@ const TooltipPopover = ({ children, maxWidth, ...props }) => {
}
return
(
<
Popover
className
=
"PopoverBody--tooltip"
targetOffsetY
=
{
10
}
{
...
props
}
>
<
Popover
className
=
"PopoverBody--tooltip"
targetOffsetY
=
{
10
}
// OnClickOutsideWrapper is unecessary and causes existing popovers not to
// be dismissed if a tooltip is visisble, so pass noOnClickOutsideWrapper
noOnClickOutsideWrapper
{
...
props
}
>
{
popoverContent
}
</
Popover
>
);
...
...
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