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

Introduce metadataPanel prop in Kedro-Viz react component #1965

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Please follow the established format:
- Enable/disable preview for all the datasets when publishing Kedro-Viz from UI. (#1895)
- Display published URLs. (#1907)
- Conditionally move session store and stats file to .viz directory. (#1915)
- Introduce `metadataPanel` prop in Kedro-Viz react component. (#1965)
jitu5 marked this conversation as resolved.
Show resolved Hide resolved

## Bug fixes and other changes

Expand Down
1 change: 1 addition & 0 deletions src/components/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ App.propTypes = {
sidebar: PropTypes.bool,
miniMap: PropTypes.bool,
expandAllPipelines: PropTypes.bool,
metadataPanel: PropTypes.bool,
}),
};

Expand Down
6 changes: 4 additions & 2 deletions src/components/flowchart-wrapper/flowchart-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const FlowChartWrapper = ({
pipelines,
sidebarVisible,
activePipeline,
displayMetadataPanel,
}) => {
const history = useHistory();
const { pathname, search } = useLocation();
Expand Down Expand Up @@ -309,7 +310,7 @@ export const FlowChartWrapper = ({
return (
<div className="kedro-pipeline">
<Sidebar />
<MetaData />
{displayMetadataPanel && <MetaData />}
<PipelineWarning
errorMessage={errorMessage}
invalidUrl={isInvalidUrl}
Expand All @@ -321,7 +322,7 @@ export const FlowChartWrapper = ({
return (
<div className="kedro-pipeline">
<Sidebar />
<MetaData />
{displayMetadataPanel && <MetaData />}
<div className="pipeline-wrapper">
<PipelineWarning />
<FlowChart />
Expand Down Expand Up @@ -366,6 +367,7 @@ export const mapStateToProps = (state) => ({
pipelines: state.pipeline.ids,
activePipeline: state.pipeline.active,
sidebarVisible: state.visible.sidebar,
displayMetadataPanel: state.display.metadataPanel,
});

export const mapDispatchToProps = (dispatch) => ({
Expand Down
19 changes: 14 additions & 5 deletions src/components/flowchart/flowchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,19 @@ export class FlowChart extends Component {
* @param {Object} node Datum for a single node
*/
handleNodeClick = (event, node) => {
if (node.type === 'modularPipeline') {
this.props.onClickToExpandModularPipeline(node.id);
} else {
this.props.onLoadNodeData(node.id);
this.props.toSelectedNode(node);
const { type, id } = node;
const {
onClickToExpandModularPipeline,
displayMetadataPanel,
onLoadNodeData,
toSelectedNode,
} = this.props;

if (type === 'modularPipeline') {
onClickToExpandModularPipeline(id);
} else if (displayMetadataPanel) {
onLoadNodeData(id);
jitu5 marked this conversation as resolved.
Show resolved Hide resolved
toSelectedNode(node);
}
event.stopPropagation();
};
Expand Down Expand Up @@ -690,6 +698,7 @@ export const mapStateToProps = (state, ownProps) => ({
chartSize: getChartSize(state),
chartZoom: getChartZoom(state),
displayGlobalToolbar: state.display.globalToolbar,
displayMetadataPanel: state.display.metadataPanel,
edges: state.graph.edges || emptyEdges,
focusMode: state.visible.modularPipelineFocusMode,
graphSize: state.graph.size || emptyGraphSize,
Expand Down
1 change: 1 addition & 0 deletions src/components/flowchart/flowchart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ describe('FlowChart', () => {
inputOutputDataEdges: expect.any(Object),
focusMode: expect.any(Object),
displayGlobalToolbar: expect.any(Boolean),
displayMetadataPanel: expect.any(Boolean),
};
expect(mapStateToProps(mockState.spaceflights)).toEqual(expectedResult);
});
Expand Down
1 change: 1 addition & 0 deletions src/store/initial-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const createInitialState = () => ({
sidebar: true,
miniMap: true,
expandAllPipelines: false,
metadataPanel: true,
},
zoom: {},
runsMetadata: {},
Expand Down
Loading