diff --git a/RELEASE.md b/RELEASE.md index 6633224477..f0b5a0a602 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -17,7 +17,9 @@ Please follow the established format: - Refactor backend integration with Kedro by replacing bootstrap_project with configure_project. (#1796) - Enhance kedro-viz doc integration. (#1874) - Fix Kedro-Viz waiting for valid Kedro project. (#1871) +- Include expandAllPipelines in initial state. (#1896) - Enhance Kedro-Viz documentation by using Kedro-sphinx-theme. (#1898) +- Remove default props from functional components. (#1906) - Fix for schema change in strawberry-graphql JSON scalar. (#1903) - Fix messaging level when package compatibility is not satisfied. (#1904) diff --git a/docs/source/conf.py b/docs/source/conf.py index 1d3edbd09d..7a21f6e72e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -54,7 +54,7 @@ intersphinx_mapping = { "kedro": ("https://docs.kedro.org/en/stable/", None), - "kedro-datasets": ("https://docs.kedro.org/projects/kedro-datasets/en/kedro-datasets-1.7.1/", None), + "kedro-datasets": ("https://docs.kedro.org/projects/kedro-datasets/en/kedro-datasets-3.0.0/", None), } # -- Options for HTML output ------------------------------------------------- diff --git a/src/actions/actions.test.js b/src/actions/actions.test.js index 4778ed741b..fde1e1b162 100644 --- a/src/actions/actions.test.js +++ b/src/actions/actions.test.js @@ -16,6 +16,7 @@ import { TOGGLE_CODE, TOGGLE_MODULAR_PIPELINE_FOCUS_MODE, TOGGLE_HOVERED_FOCUS_MODE, + TOGGLE_EXPAND_ALL_PIPELINES, changeFlag, resetData, toggleIgnoreLargeWarning, @@ -32,6 +33,7 @@ import { updateChartSize, toggleFocusMode, toggleHoveredFocusMode, + toggleExpandAllPipelines, } from '../actions'; import { TOGGLE_NODE_CLICKED, @@ -75,7 +77,18 @@ describe('actions', () => { expect(toggleLayers(visible)).toEqual(expectedAction); }); - it('should create an action to toggle whether to show layers', () => { + it('should create an action to toggle whether to expand all modular pipelines or collapse', () => { + const shouldExpandAllPipelines = false; + const expectedAction = { + type: TOGGLE_EXPAND_ALL_PIPELINES, + shouldExpandAllPipelines, + }; + expect(toggleExpandAllPipelines(shouldExpandAllPipelines)).toEqual( + expectedAction + ); + }); + + it('should create an action to toggle whether to show minimap', () => { const visible = false; const expectedAction = { type: TOGGLE_MINIMAP, diff --git a/src/actions/index.js b/src/actions/index.js index 973e16d531..47e83197af 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -24,6 +24,19 @@ export function toggleLayers(visible) { }; } +export const TOGGLE_EXPAND_ALL_PIPELINES = 'TOGGLE_EXPAND_ALL_PIPELINES'; + +/** + * Toggle whether to expand all modular pipelines or collapse + * @param {Boolean} shouldExpandAllPipelines + */ +export function toggleExpandAllPipelines(shouldExpandAllPipelines) { + return { + type: TOGGLE_EXPAND_ALL_PIPELINES, + shouldExpandAllPipelines, + }; +} + export const TOGGLE_EXPORT_MODAL = 'TOGGLE_EXPORT_MODAL'; /** diff --git a/src/actions/pipelines.js b/src/actions/pipelines.js index 06e1bc30e6..8882b425d8 100644 --- a/src/actions/pipelines.js +++ b/src/actions/pipelines.js @@ -99,7 +99,7 @@ export function loadInitialPipelineData() { // obtain the status of expandAllPipelines to decide whether it needs to overwrite the // list of visible nodes const expandAllPipelines = - state.display.expandAllPipelines || state.flags.expandAllPipelines; + state.display.expandAllPipelines || state.expandAllPipelines; let newState = await loadJsonData(url).then((data) => preparePipelineState(data, true, expandAllPipelines) ); @@ -122,7 +122,7 @@ export function loadInitialPipelineData() { */ export function loadPipelineData(pipelineID) { return async function (dispatch, getState) { - const { dataSource, pipeline, display, flags } = getState(); + const { dataSource, pipeline, display, expandAllPipelines } = getState(); if (pipelineID && pipelineID === pipeline.active) { return; @@ -136,10 +136,10 @@ export function loadPipelineData(pipelineID) { active: pipelineID, }); - const expandAllPipelines = - display.expandAllPipelines || flags.expandAllPipelines; + const shouldExpandAllPipelines = + display.expandAllPipelines || expandAllPipelines; const newState = await loadJsonData(url).then((data) => - preparePipelineState(data, false, expandAllPipelines) + preparePipelineState(data, false, shouldExpandAllPipelines) ); // Set active pipeline here rather than dispatching two separate actions, diff --git a/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.js b/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.js index 844fc7ec90..d40e6ecfeb 100644 --- a/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.js +++ b/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.js @@ -5,7 +5,7 @@ import { toggleLayers, toggleSidebar, toggleTextLabels, - changeFlag, + toggleExpandAllPipelines, } from '../../actions'; import { loadInitialPipelineData } from '../../actions/pipelines'; import IconButton from '../ui/icon-button'; @@ -110,7 +110,7 @@ export const mapStateToProps = (state) => ({ textLabels: state.textLabels, visible: state.visible, visibleLayers: Boolean(getVisibleLayerIDs(state).length), - expandedPipelines: state.flags.expandAllPipelines, + expandedPipelines: state.expandAllPipelines, }); export const mapDispatchToProps = (dispatch) => ({ @@ -127,7 +127,7 @@ export const mapDispatchToProps = (dispatch) => ({ dispatch(toggleTextLabels(Boolean(value))); }, onToggleExpandAllPipelines: (isExpanded) => { - dispatch(changeFlag('expandAllPipelines', isExpanded)); + dispatch(toggleExpandAllPipelines(isExpanded)); dispatch(loadInitialPipelineData()); }, }); diff --git a/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.test.js b/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.test.js index 732389f33c..a6f328c8a5 100644 --- a/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.test.js +++ b/src/components/flowchart-primary-toolbar/flowchart-primary-toolbar.test.js @@ -70,6 +70,7 @@ describe('PrimaryToolbar', () => { const expectedResult = { disableLayerBtn: expect.any(Boolean), textLabels: expect.any(Boolean), + expandedPipelines: expect.any(Boolean), displaySidebar: true, visible: expect.objectContaining({ exportBtn: expect.any(Boolean), @@ -127,9 +128,8 @@ describe('PrimaryToolbar', () => { const dispatch = jest.fn(); mapDispatchToProps(dispatch).onToggleExpandAllPipelines(true); expect(dispatch.mock.calls[0][0]).toEqual({ - name: 'expandAllPipelines', - type: 'CHANGE_FLAG', - value: true, + type: 'TOGGLE_EXPAND_ALL_PIPELINES', + shouldExpandAllPipelines: true, }); }); }); diff --git a/src/components/flowchart-wrapper/flowchart-wrapper.js b/src/components/flowchart-wrapper/flowchart-wrapper.js index b305bc73ea..02750f59fc 100644 --- a/src/components/flowchart-wrapper/flowchart-wrapper.js +++ b/src/components/flowchart-wrapper/flowchart-wrapper.js @@ -110,9 +110,9 @@ export const FlowChartWrapper = ({ disabledKeys && toSetQueryParam(params.types, mappedDisabledNodes); } }, - flags: (value) => { + expandAllPipelines: (value) => { if (!searchParams.has(params.expandAll)) { - toSetQueryParam(params.expandAll, value.expandAllPipelines); + toSetQueryParam(params.expandAll, value); } }, }; diff --git a/src/components/ui/button/button.js b/src/components/ui/button/button.js index 3bc486ce35..84f009a7ce 100644 --- a/src/components/ui/button/button.js +++ b/src/components/ui/button/button.js @@ -6,7 +6,14 @@ import './button.scss'; /** * Generic Kedro Button */ -const Button = ({ children, dataTest, disabled, onClick, size, mode }) => ( +const Button = ({ + children, + dataTest = 'TestDefaultDataValue', + disabled = false, + onClick, + size = 'regular', + mode = 'primary', +}) => (