Skip to content

Commit 847612c

Browse files
committed
#417 various fixes to the drawer and layout to go with the changes done for the layout manager
1 parent f8564d6 commit 847612c

10 files changed

Lines changed: 154 additions & 136 deletions

File tree

webapp/components/drawer/Drawer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import DrawerIcon from '../general/NetPyNEIcons';
2020
import useStyles from './useStyles';
2121
import Tooltip from '../general/Tooltip';
22+
import { maximizeWidget } from '@metacell/geppetto-meta-client/common/layout/actions';
2223

2324
const drawerOpenWidth = 'auto';
2425
const drawerCloseWidth = 55;
@@ -94,7 +95,9 @@ const DrawerList = ({
9495
editMode,
9596
widgets,
9697
activateWidget,
98+
maximiseWidget,
9799
updateWidget,
100+
addWidget,
98101
classes,
99102
}) => {
100103
const [expand, setExpand] = useState(false);
@@ -110,10 +113,8 @@ const DrawerList = ({
110113
if (!widget) {
111114
const widgetConf = getNewWidgetConf(widgetId);
112115
newWidget({ path: widgetConf.id, ...widgetConf });
113-
} else if (widget.status === WidgetStatus.MINIMIZED) {
114-
updateBorderWidget(widgetId);
115116
} else {
116-
activateWidget(widgetId);
117+
updateBorderWidget(widgetId);
117118
}
118119
}
119120

@@ -204,8 +205,8 @@ const DrawerList = ({
204205
setTimeout(() => window.dispatchEvent(new Event('resize')), 400);
205206
}}
206207
>
207-
{expand ? <DrawerIcon style={{ padding: '12px !important' }} name="arrow-left" fontSize="inherit" />
208-
: <DrawerIcon style={{ padding: '12px !important' }} name="arrow-right" fontSize="inherit" />}
208+
{expand ? <DrawerIcon name="arrow-left" fontSize="inherit" />
209+
: <DrawerIcon name="arrow-right" fontSize="inherit" />}
209210
</IconButton>
210211
</Tooltip>
211212
</div>

webapp/components/drawer/useStyles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default makeStyles(({
2424

2525
closeDrawer: drawerCss(false, transitions, palette, spacing),
2626

27-
buttonContainerOpen: { textAlign: 'end' },
27+
buttonContainerOpen: { textAlign: 'end', padding: '12px' },
2828
buttonContainerClosed: { textAlign: 'center', padding: '12px' },
2929
button: {
3030
color: 'white',

webapp/components/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { connect } from 'react-redux';
33
import TextField from '@material-ui/core/TextField';
44
import { getLayoutManagerInstance } from '@metacell/geppetto-meta-client/common/layout/LayoutManager';
55
import {
6+
addWidget,
67
activateWidget,
78
setWidgets,
89
updateWidget,
910
newWidget,
11+
maximiseWidget,
1012
} from '@metacell/geppetto-meta-client/common/actions';
1113
import { TOPBAR_CONSTANTS } from '../constants';
1214
import PythonControlledCapability from './general/PythonControlledCapability';
@@ -297,6 +299,8 @@ export const Drawer = connect(
297299
updateWidget: (newConf) => dispatch(updateWidget(newConf)),
298300
newWidget: (widget) => dispatch(newWidget(widget)),
299301
activateWidget: (widgetId) => dispatch(activateWidget(widgetId)),
302+
maximiseWidget: (widgetId) => dispatch(maximiseWidget(widgetId)),
303+
addWidget: (widgetConf) => dispatch(addWidget(widgetConf)),
300304
}),
301305
)(_Drawer);
302306

webapp/constants.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ export const PLOT_WIDGETS = {
387387
};
388388

389389
export const DEFAULT_NETWORK_WIDGETS = {
390-
PYTHON_CONSOLE_WIDGET,
391390
D3Canvas: {
392391
id: 'D3Canvas',
393392
name: '3D Representation',
@@ -405,7 +404,7 @@ export const DEFAULT_NETWORK_WIDGETS = {
405404
hideOnClose: true,
406405
component: 'experimentManager',
407406
panelName: MINIMIZED_PANEL,
408-
defaultPanel: 'plotPanel',
407+
defaultPanel: TOP_PANEL,
409408
enableRename: false,
410409
pos: 14,
411410
specification: TOOLS_LIST,

webapp/css/flexlayout.less

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ div.flexlayout__layout {
8585
.flexlayout__tabset-selected {
8686
background-color: @bgDarker; //color-light
8787
}
88-
.flexlayout__border_inner_bottom {
89-
// position: fixed !important;
90-
// top: 100% !important;
91-
position: fixed;
92-
bottom: -100px;
88+
.flexlayout__border_bottom {
89+
position: fixed !important;
90+
top: 110% !important;
9391
left: 0;
9492
padding-left: @gutter / 2;
9593
border-top-right-radius: @radius;

webapp/css/netpyne.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,3 @@ body {
599599
}
600600
}
601601
}
602-
603-
.bottom_icon {
604-
padding: 12px;
605-
}

webapp/redux/middleware/middleware.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ let previousLayout = {
3535
network: undefined,
3636
};
3737

38+
let previousWidgets = {
39+
edit: undefined,
40+
network: undefined,
41+
};
42+
3843
export const processError = (response) => {
3944
const parsedResponse = Utils.getErrorResponse(response);
4045
if (parsedResponse) {
@@ -112,17 +117,26 @@ const simulateNetwork = (payload) => createSimulateBackendCall(
112117
export default (store) => (next) => (action) => {
113118
const switchLayoutAction = (edit = true, reset = true) => {
114119
previousLayout[store.getState().general.editMode ? 'edit' : 'network'] = store.getState().layout;
120+
previousWidgets[store.getState().general.editMode ? 'edit' : 'network'] = store.getState().widgets;
115121
if (reset) {
116122
previousLayout = {
117123
edit: undefined,
118124
network: undefined,
119125
};
126+
previousWidgets = {
127+
edit: undefined,
128+
network: undefined,
129+
};
120130
}
121131
// TO FIX: I am not sure the one below is to fix, previously we were setting layout or widgets but I don't understand
122132
// how the widgets where making it back into the redux store without the set widgets
123133
return next(edit
124-
? GeppettoActions.setLayout(previousLayout.edit) && GeppettoActions.setWidgets({ ...Constants.EDIT_WIDGETS })
125-
: GeppettoActions.setLayout(previousLayout.network) && GeppettoActions.setWidgets({ ...Constants.DEFAULT_NETWORK_WIDGETS }));
134+
? previousLayout.edit
135+
? GeppettoActions.setLayout(previousLayout.edit) && GeppettoActions.setWidgets(previousWidgets.edit)
136+
: GeppettoActions.setWidgets({ ...Constants.EDIT_WIDGETS })
137+
: previousLayout.network
138+
? GeppettoActions.setLayout(previousLayout.network) && GeppettoActions.setWidgets(previousWidgets.network)
139+
: GeppettoActions.setWidgets({ ...Constants.DEFAULT_NETWORK_WIDGETS }));
126140
};
127141

128142
const toNetworkCallback = (reset) => () => {
Lines changed: 1 addition & 0 deletions
Loading

webapp/yalc.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "v1",
33
"packages": {
44
"@metacell/geppetto-meta-client": {
5-
"signature": "9189795eefe9451f437274f6bae6fd84",
5+
"signature": "0b89acbd0446b4c00b9c4e99ba1ce30d",
66
"file": true
77
},
88
"@metacell/geppetto-meta-core": {

0 commit comments

Comments
 (0)