Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dashboard parameter mapping issues #4211

Merged
merged 4 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion client/app/components/ParameterMappingInput.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable react/no-multi-comp */

import { isString, extend, each, map, includes, findIndex, find, fromPairs, clone, isEmpty } from 'lodash';
import { isString, extend, each, has, map, includes, findIndex, find,
fromPairs, clone, isEmpty } from 'lodash';
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand Down Expand Up @@ -158,6 +159,13 @@ export class ParameterMappingInput extends React.Component {
newMapping.param = newMapping.param.clone();
newMapping.param.setValue(newMapping.value);
ranbena marked this conversation as resolved.
Show resolved Hide resolved
}
if (has(update, 'type')) {
ranbena marked this conversation as resolved.
Show resolved Hide resolved
if (update.type === MappingType.StaticValue) {
newMapping.value = newMapping.param.value;
} else {
newMapping.value = null;
}
}
onChange(newMapping);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ class VisualizationWidget extends React.Component {
};

editParameterMappings = () => {
const { widget, dashboard, onParameterMappingsChange } = this.props;
const { widget, dashboard, onRefresh, onParameterMappingsChange } = this.props;
EditParameterMappingsDialog.showModal({
dashboard,
widget,
}).result.then((valuesChanged) => {
// refresh widget if any parameter value has been updated
if (valuesChanged) {
this.refresh();
onRefresh();
}
onParameterMappingsChange();
this.setState({ localParameters: widget.getLocalParameters() });
Expand Down