Skip to content

Commit

Permalink
fix: hide titles for maps (DHIS2-8616) (#718)
Browse files Browse the repository at this point in the history
* fix: support options and pass hideTitle for maps

* fix: hide map title also when switching from another type
  • Loading branch information
janhenrikoverland committed Apr 14, 2020
1 parent fb02c0e commit 51216c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/Item/VisualizationItem/DefaultPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class DefaultPlugin extends Component {
pluginManager.load(this.props.item, this.props.visualization, {
credentials: this.pluginCredentials,
activeType: !this.props.editMode ? this.getActiveType() : null,
options: this.props.options,
});
}
}
Expand Down Expand Up @@ -121,6 +122,7 @@ DefaultPlugin.propTypes = {
editMode: PropTypes.bool,
item: PropTypes.object,
itemFilters: PropTypes.object,
options: PropTypes.object,
style: PropTypes.object,
visualization: PropTypes.object,
};
Expand All @@ -129,6 +131,7 @@ DefaultPlugin.defaultProps = {
style: {},
item: {},
itemFilters: {},
options: {},
visualization: {},
};

Expand Down
5 changes: 5 additions & 0 deletions src/components/Item/VisualizationItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ export class Item extends Component {
);
}

props.options = {
...props.options,
hideTitle: true,
};

return <DefaultPlugin {...props} />;
}
default: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Item/VisualizationItem/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ export const getLink = (item, d2) => {
export const load = async (
item,
visualization,
{ credentials, activeType }
{ credentials, activeType, options = {} }
) => {
const config = {
...visualization,
...options,
el: getGridItemDomId(item.id),
};

Expand Down

0 comments on commit 51216c9

Please sign in to comment.