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
dbafdb48
Commit
dbafdb48
authored
6 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Fix chart settings reset when resize + remappings not working
parent
4d9fe3bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/visualizations/components/ChartSettings.jsx
+24
-26
24 additions, 26 deletions
.../src/metabase/visualizations/components/ChartSettings.jsx
with
24 additions
and
26 deletions
frontend/src/metabase/visualizations/components/ChartSettings.jsx
+
24
−
26
View file @
dbafdb48
...
...
@@ -24,32 +24,36 @@ const DEFAULT_TAB_PRIORITY = ["Display"];
class
ChartSettings
extends
Component
{
constructor
(
props
)
{
super
(
props
);
const
initialSettings
=
props
.
series
[
0
].
card
.
visualization_settings
;
this
.
state
=
{
currentTab
:
null
,
settings
:
initialSettings
,
series
:
this
.
_getSeries
(
props
.
series
,
initialSettings
),
showWidget
:
props
.
initialWidget
,
...
this
.
_getState
(
props
.
series
,
props
.
series
[
0
].
card
.
visualization_settings
,
),
};
}
componentWillReceiveProps
(
nextProps
)
{
if
(
this
.
props
.
series
!==
nextProps
.
series
)
{
this
.
setState
({
series
:
this
.
_getSeries
(
nextProps
.
series
,
nextProps
.
series
[
0
].
card
.
visualization_settings
,
),
});
this
.
setState
(
this
.
_getState
(
nextProps
.
series
,
this
.
state
.
settings
));
}
}
_getSeries
(
series
,
settings
)
{
if
(
settings
)
{
series
=
assocIn
(
series
,
[
0
,
"
card
"
,
"
visualization_settings
"
],
settings
);
}
const
transformed
=
getVisualizationTransformed
(
extractRemappings
(
series
));
return
transformed
.
series
;
_getState
(
series
,
settings
)
{
const
rawSeries
=
assocIn
(
series
,
[
0
,
"
card
"
,
"
visualization_settings
"
],
settings
,
);
const
{
series
:
transformedSeries
}
=
getVisualizationTransformed
(
extractRemappings
(
rawSeries
),
);
return
{
settings
,
rawSeries
,
transformedSeries
,
};
}
handleSelectTab
=
tab
=>
{
...
...
@@ -58,18 +62,12 @@ class ChartSettings extends Component {
handleResetSettings
=
()
=>
{
MetabaseAnalytics
.
trackEvent
(
"
Chart Settings
"
,
"
Reset Settings
"
);
this
.
setState
({
settings
:
{},
series
:
this
.
_getSeries
(
this
.
props
.
series
,
{}),
});
this
.
setState
(
this
.
_getState
(
this
.
props
.
series
,
{}));
};
handleChangeSettings
=
changedSettings
=>
{
const
newSettings
=
updateSettings
(
this
.
state
.
settings
,
changedSettings
);
this
.
setState
({
settings
:
newSettings
,
series
:
this
.
_getSeries
(
this
.
props
.
series
,
newSettings
),
});
this
.
setState
(
this
.
_getState
(
this
.
props
.
series
,
newSettings
));
};
handleDone
=
()
=>
{
...
...
@@ -91,13 +89,13 @@ class ChartSettings extends Component {
render
()
{
const
{
isDashboard
,
question
,
addField
}
=
this
.
props
;
const
{
s
eries
,
showWidget
}
=
this
.
state
;
const
{
rawSeries
,
transformedS
eries
,
showWidget
}
=
this
.
state
;
const
widgetsById
=
{};
const
tabs
=
{};
for
(
const
widget
of
getSettingsWidgetsForSeries
(
s
eries
,
transformedS
eries
,
this
.
handleChangeSettings
,
isDashboard
,
))
{
...
...
@@ -181,7 +179,7 @@ class ChartSettings extends Component {
<
div
className
=
"mx4 flex-full relative"
>
<
Visualization
className
=
"spread"
rawSeries
=
{
s
eries
}
rawSeries
=
{
rawS
eries
}
showTitle
isEditing
isDashboard
...
...
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