Skip to content

Commit baf6fbb

Browse files
feat: show flowselect for single project only
1 parent 5b26f6b commit baf6fbb

6 files changed

Lines changed: 26 additions & 12 deletions

File tree

‎src/public/js/App.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const App = (props = {}) => {
4949
>
5050
<TreeDiagramsContainer />
5151
</Suspense>
52-
{/* <Suspense fallback={null}>
52+
{/* <Suspense fallback={null}>
5353
<SideBar />
5454
</Suspense>*/}
5555
</div>

‎src/public/js/components/topBar/controls/FlowSelect/index.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ const mapStateToProps = (state, props) => {
6969
};
7070
};
7171

72-
const mapDispatchToProps = {
73-
onCodeCrumbedFlowSelect: selectCodeCrumbedFlow
72+
const mapDispatchToProps = (dispatch, props) => {
73+
const { namespace } = props;
74+
75+
return {
76+
onCodeCrumbedFlowSelect: flow => dispatch(selectCodeCrumbedFlow(flow, namespace))
77+
};
7478
};
7579

7680
export default connect(

‎src/public/js/components/topBar/controls/ViewSwitches/List/ViewSwitchList.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ import ViewSwitch from '../Item/ViewSwitch';
99
import './ViewSwitchList.scss';
1010

1111
const ViewSwitchList = props => {
12-
const { switches, toggleSwitch, fireButtonAction, checkedState, disabledState } = props;
12+
const {
13+
namespacesList,
14+
switches,
15+
toggleSwitch,
16+
fireButtonAction,
17+
checkedState,
18+
disabledState
19+
} = props;
20+
1321
const leftSide = [],
1422
rightSide = [];
1523

@@ -36,7 +44,7 @@ const ViewSwitchList = props => {
3644
<div className="ViewSwitchList">
3745
<div className={'side'}>
3846
{leftSide}
39-
{/*<FlowSelect />*/}
47+
{namespacesList.length === 1 ? <FlowSelect namespace={namespacesList[0]} /> : null}
4048
</div>
4149
{/*<div className={'side'}>
4250
<ZoomControl />

‎src/public/js/components/topBar/controls/ViewSwitches/ViewSwitchesContainer.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import React from 'react';
22
import { connect } from 'react-redux';
33

4+
import { getNamespacesList } from 'core/dataBus/selectors';
5+
46
import { toggleSwitch, fireButtonAction } from 'core/controlsBus/actions';
57
import { getSwitches, getCheckedState, getDisabledState } from 'core/controlsBus/selectors';
68

79
import ViewSwitchList from './List/ViewSwitchList';
810

911
const mapStateToProps = state => {
1012
return {
13+
namespacesList: getNamespacesList(state),
1114
switches: getSwitches(state),
1215
checkedState: getCheckedState(state),
1316
disabledState: getDisabledState(state)
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
import React from 'react';
22
import { connect } from 'react-redux';
33

4+
import { getNamespacesList } from 'core/dataBus/selectors';
45
import TreeDiagram from './component/TreeDiagram';
56

6-
const TreeDiagramsContainer = ({ namespaces }) => {
7-
if (!namespaces || !namespaces.length) {
7+
const TreeDiagramsContainer = ({ namespacesList }) => {
8+
if (!namespacesList.length) {
89
return null;
910
}
1011

1112
return (
1213
<React.Fragment>
13-
{namespaces.map(namespace => (
14+
{namespacesList.map(namespace => (
1415
<TreeDiagram key={namespace} namespace={namespace} />
1516
))}
1617
</React.Fragment>
1718
);
1819
};
1920

2021
const mapStateToProps = state => ({
21-
namespaces: Object.keys(state.dataBus)
22+
namespacesList: getNamespacesList(state)
2223
});
2324

2425
export default connect(mapStateToProps)(TreeDiagramsContainer);

‎src/public/js/components/treeDiagram/component/Tree/Source/Tree.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ const SourceTree = props => {
103103
selectedNodeDependencies[path] &&
104104
!selectedNodeDependencies[path].importedModuleNames.length
105105
}
106-
onNodeClick={() =>
107-
onFileNodeClick(fileNode)
108-
}
106+
onNodeClick={() => onFileNodeClick(fileNode)}
109107
/>
110108
);
111109
} else if (type === DIR_NODE_TYPE) {

0 commit comments

Comments
 (0)