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
a2161bf9
Commit
a2161bf9
authored
9 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Move card header to Visualization so we can show it when there's an error
parent
cdd48c48
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/dashboard/components/DashCard.jsx
+1
-10
1 addition, 10 deletions
frontend/src/dashboard/components/DashCard.jsx
frontend/src/visualizations/components/Visualization.jsx
+38
-26
38 additions, 26 deletions
frontend/src/visualizations/components/Visualization.jsx
with
39 additions
and
36 deletions
frontend/src/dashboard/components/DashCard.jsx
+
1
−
10
View file @
a2161bf9
...
...
@@ -4,7 +4,6 @@ import ReactDOM from "react-dom";
import
visualizations
from
"
metabase/visualizations
"
;
import
Visualization
from
"
metabase/visualizations/components/Visualization.jsx
"
;
import
LegendHeader
from
"
metabase/visualizations/components/LegendHeader.jsx
"
;
import
LoadingSpinner
from
"
metabase/components/LoadingSpinner.jsx
"
;
import
Icon
from
"
metabase/components/Icon.jsx
"
;
...
...
@@ -127,19 +126,11 @@ export default class DashCard extends Component {
}
render
()
{
const
{
dashcard
,
onAddSeries
,
onRemove
,
isEditing
}
=
this
.
props
;
const
{
dashcard
}
=
this
.
props
;
const
series
=
[
dashcard
.
card
].
concat
(
dashcard
.
series
||
[]).
map
(
card
=>
({
card
}));
const
Viz
=
visualizations
.
get
(
series
[
0
].
card
.
display
);
return
(
<
div
className
=
{
"
Card bordered rounded flex flex-column
"
+
cx
({
"
Card--recent
"
:
dashcard
.
isAdded
})
}
>
{
!
Viz
.
noHeader
&&
<
div
className
=
"p1"
>
<
LegendHeader
series
=
{
series
}
actionButtons
=
{
isEditing
?
<
DashCardActionButtons
visualization
=
{
Viz
}
series
=
{
series
}
onRemove
=
{
onRemove
}
onAddSeries
=
{
onAddSeries
}
/>
:
undefined
}
/>
</
div
>
}
{
this
.
renderCard
(
Viz
)
}
</
div
>
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/visualizations/components/Visualization.jsx
+
38
−
26
View file @
a2161bf9
import
React
,
{
Component
,
PropTypes
}
from
"
react
"
;
import
LegendHeader
from
"
metabase/visualizations/components/LegendHeader.jsx
"
;
import
visualizations
from
"
metabase/visualizations
"
;
import
i
from
"
icepick
"
;
import
_
from
"
underscore
"
;
import
cx
from
"
classnames
"
;
export
default
class
Visualization
extends
Component
{
constructor
(
props
,
context
)
{
...
...
@@ -80,33 +82,43 @@ export default class Visualization extends Component {
}
render
()
{
let
{
series
,
actionButtons
,
className
,
isDashboard
}
=
this
.
props
;
let
CardVisualization
=
visualizations
.
get
(
series
[
0
].
card
.
display
);
let
error
=
this
.
props
.
error
||
this
.
state
.
error
;
if
(
error
)
{
return
(
<
div
className
=
"QueryError flex full align-center text-error"
>
<
div
className
=
"QueryError-iconWrapper"
>
<
svg
className
=
"QueryError-icon"
viewBox
=
"0 0 32 32"
width
=
"64"
height
=
"64"
fill
=
"currentcolor"
>
<
path
d
=
"M4 8 L8 4 L16 12 L24 4 L28 8 L20 16 L28 24 L24 28 L16 20 L8 28 L4 24 L12 16 z "
></
path
>
</
svg
>
return
(
<
div
className
=
{
cx
(
className
,
"
flex flex-column
"
)
}
>
{
isDashboard
&&
(
error
||
!
CardVisualization
.
noHeader
)
?
<
div
className
=
"p1 flex-no-shrink"
>
<
LegendHeader
series
=
{
series
}
actionButtons
=
{
actionButtons
}
/>
</
div
>
<
span
className
=
"QueryError-message"
>
{
error
}
</
span
>
</
div
>
);
}
else
{
let
{
series
}
=
this
.
props
;
let
CardVisualization
=
visualizations
.
get
(
series
[
0
].
card
.
display
);
return
(
<
CardVisualization
{
...
this
.
props
}
series
=
{
series
}
card
=
{
series
[
0
].
card
}
// convienence for single-series visualizations
data
=
{
series
[
0
].
data
}
// convienence for single-series visualizations
hovered
=
{
this
.
state
.
hovered
}
onHoverChange
=
{
this
.
onHoverChange
}
onRenderError
=
{
this
.
onRenderError
}
onRender
=
{
this
.
onRender
}
/>
);
}
:
null
}
{
error
?
<
div
className
=
"QueryError flex flex-full align-center text-error"
>
<
div
className
=
"QueryError-iconWrapper hide"
>
<
svg
className
=
"QueryError-icon"
viewBox
=
"0 0 32 32"
width
=
"64"
height
=
"64"
fill
=
"currentcolor"
>
<
path
d
=
"M4 8 L8 4 L16 12 L24 4 L28 8 L20 16 L28 24 L24 28 L16 20 L8 28 L4 24 L12 16 z "
></
path
>
</
svg
>
</
div
>
<
span
className
=
"QueryError-message"
>
{
error
}
</
span
>
</
div
>
:
<
CardVisualization
{
...
this
.
props
}
className
=
"flex-full"
series
=
{
series
}
card
=
{
series
[
0
].
card
}
// convienence for single-series visualizations
data
=
{
series
[
0
].
data
}
// convienence for single-series visualizations
hovered
=
{
this
.
state
.
hovered
}
onHoverChange
=
{
this
.
onHoverChange
}
onRenderError
=
{
this
.
onRenderError
}
onRender
=
{
this
.
onRender
}
/>
}
</
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