Skip to content

Commit cf4b1e2

Browse files
Merge branch 'precns' of github.com:MetaCell/NetPyNE-UI into precns
2 parents 7b9cfbe + ca3f3a5 commit cf4b1e2

6 files changed

Lines changed: 71 additions & 85 deletions

File tree

.travis.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
language: python
22
os: linux
3-
dist: trusty
3+
python:
4+
- "3.7"
45
node_js:
5-
- "7"
6+
- "12"
67
env:
78
global:
8-
secure: dn0FPQ5IG4M/3kdwnyI78ElQ308Vc3QnKAvkWfwMFb8QxDqxQdnTo7AV1qTMtbLrDNkeEWIgi4nc7jmXNtvGTwOfhAULVh6606Qs5B+ezTdwzajbbFMI8SKQx/pnTojOMu8dx7V4lMoR/YWcojR0VC1IWVC62TGbSB1k5BDGgH0=
9+
- secure: dn0FPQ5IG4M/3kdwnyI78ElQ308Vc3QnKAvkWfwMFb8QxDqxQdnTo7AV1qTMtbLrDNkeEWIgi4nc7jmXNtvGTwOfhAULVh6606Qs5B+ezTdwzajbbFMI8SKQx/pnTojOMu8dx7V4lMoR/YWcojR0VC1IWVC62TGbSB1k5BDGgH0=
10+
- DEFAULT_BRANCH: development
11+
- LANDING_PAGE: "http://localhost:8888/geppetto"
912
notifications:
1013
slack: metacell:5ALSeoP88DqIhORUJvxE56sq
11-
services:
12-
- docker
14+
install:
15+
- sudo apt-get install libgnutls28-dev
16+
- sudo apt install libcurl4-openssl-dev libssl-dev
17+
- sudo apt-get install python3-dev
1318
script:
14-
- travis_retry docker build -t="netpyne-ui" --build-arg branch=$TRAVIS_BRANCH .
19+
20+
- python utilities/install.py
21+
- ./NetPyNE-UI &
22+
- http_status=$(curl -s -I $1 $LANDING_PAGE | grep HTTP/1.1 | awk {'print $2'})
23+
- echo "$http_status"
24+
- cd webapp
25+
- travis_retry npm run test -- --verbose --colors
26+
- exit 0

webapp/components/layout/LayoutManager.tsx

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import {
2727
} from "./actions";
2828

2929
import { MINIMIZED_PANEL } from '.';
30+
import { TabsetPosition } from './model';
31+
import { Tab } from '@geppettoengine/geppetto-client/js/components/interface/flexLayout2/src/view/Tab';
3032

3133
const styles = (theme) => createStyles({
3234
container: {
@@ -80,7 +82,7 @@ class LayoutManager {
8082
const { model } = this;
8183
let tabset = model.getNodeById(widgetConfiguration.panelName);
8284
if (tabset === undefined) {
83-
this.createTabSet(widgetConfiguration.panelName);
85+
this.createTabSet(widgetConfiguration.panelName, widgetConfiguration.defaultPosition, widgetConfiguration.defaultWeight);
8486
}
8587
this.model.doAction(
8688
Actions.addNode(
@@ -119,32 +121,52 @@ class LayoutManager {
119121
getComponent = () => withStyles(styles)(this.Component(this));
120122

121123

122-
private createTabSet(tabsetID) {
124+
private createTabSet(tabsetID, position = TabsetPosition.BOTTOM, weight = 30) {
123125
// In case the tabset doesn't exist
124126
const { model } = this;
125127
const rootNode = model.getNodeById("root");
126128

127-
let hrow = new FlexLayout.RowNode(model, {});
128-
hrow._setWeight(100);
129129

130-
const tabset = new FlexLayout.TabSetNode(model, { id: tabsetID });
131-
tabset._setWeight(20);
132130

131+
const tabset = new FlexLayout.TabSetNode(model, { id: tabsetID });
132+
tabset._setWeight(weight);
133+
let hrow = rootNode.getChildren().find(child => child.getType() === 'row');
134+
let hrowRowRow = null;
135+
switch (position) {
136+
case TabsetPosition.RIGHT:
137+
rootNode._addChild(tabset);
138+
break;
139+
case TabsetPosition.LEFT:
140+
rootNode._addChild(tabset, 0);
141+
break;
142+
case TabsetPosition.BOTTOM:
143+
case TabsetPosition.TOP: {
144+
if (!hrow) {
145+
hrow = new FlexLayout.RowNode(model, {});
146+
hrow._setWeight(100);
147+
148+
hrowRowRow = new FlexLayout.RowNode(model, {});
149+
hrowRowRow._setWeight(100 - weight);
150+
hrow._addChild(hrowRowRow);
151+
rootNode.getChildren().forEach(child => {
152+
hrowRowRow._addChild(child);
153+
});
154+
rootNode._removeAll();
155+
rootNode._addChild(hrow);
156+
}
133157

158+
if (position === TabsetPosition.BOTTOM) {
159+
hrow._addChild(tabset)
160+
} else {
161+
hrow._addChild(tabset, 0);
162+
}
134163

135-
rootNode.getChildren().forEach(child => {
136-
if (child['getWeight']) {
137-
const newWeight = (child as FlexLayout.TabSetNode).getWeight() / 2;
138-
child._setWeight(newWeight);
139-
hrow._addChild(child);
164+
break;
140165
}
141166

142-
});
167+
}
143168

144-
hrow._addChild(tabset);
145169

146-
rootNode._removeAll();
147-
rootNode._addChild(hrow);
148170
setTimeout(() => window.dispatchEvent(new Event("resize")), 1000);
149171
}
150172

@@ -387,7 +409,7 @@ class LayoutManager {
387409
const panelName = widget.panelName;
388410
let tabset = model.getNodeById(panelName);
389411
if (tabset === undefined) {
390-
this.createTabSet(panelName);
412+
this.createTabSet(panelName, widget.defaultPosition, widget.defaultWeight);
391413
}
392414
this.moveWidget(widget);
393415
}

webapp/components/layout/model.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ export enum WidgetStatus {
1414
MINIMIZED = "MINIMIZED",
1515
}
1616

17+
export enum TabsetPosition {
18+
LEFT = "LEFT",
19+
RIGHT = "RIGHT",
20+
TOP = "TOP",
21+
BOTTOM = "BOTTOM"
22+
}
23+
1724
export interface ExtendedNode extends Node {
1825
config: Widget;
1926
}
@@ -23,6 +30,8 @@ export interface Widget {
2330
status: WidgetStatus;
2431
panelName: string;
2532
defaultPanel?: any;
33+
defaultPosition?: TabsetPosition;
34+
defaultWeight?: number;
2635
hideOnClose?: boolean;
2736
name: string;
2837
enableClose?: boolean;

webapp/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export const PYTHON_CONSOLE_WIDGET = {
2828
status: WidgetStatus.MINIMIZED,
2929
component: 'PythonConsole',
3030
panelName: MINIMIZED_PANEL,
31+
defaultWeight: 30,
32+
defaultPosition: 'BOTTOM',
3133
defaultPanel: "consolePanel",
3234
enableClose: true,
3335
enableDrag: true,
@@ -78,7 +80,6 @@ export const WIDGETS_IDS = {
7880
MORPHOLOGY: 'D3Canvas',
7981
CONNECTION_PLOT: 'connectionPlot',
8082
D2_NET_PLOT: 'd2NetPlot',
81-
SHAPE_PLOT: 'shapePlot',
8283
TRACES_PLOT: 'tracesPlot',
8384
RASTER_PLOT: 'rasterPlot',
8485
SPIKE_PLOT: 'spikePlot',

webapp/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"scripts": {
88
"test": "jest --verbose",
99
"prebuild": "eslint . --color",
10-
"build": "webpack --mode none -p --progress --devtool source-map",
10+
"build": "webpack --mode development -p --progress --devtool source-map",
1111
"prebuild-dev": "eslint . --color --fix",
12-
"build-dev": "webpack --mode none --devtool eval",
12+
"build-dev": "webpack --mode development --devtool source-map",
1313
"prebuild-dev-noTest": "eslint . --color --fix",
14-
"build-dev-noTest": "webpack --mode none --devtool source-map --env.noTest=true",
14+
"build-dev-noTest": "webpack --mode development --devtool source-map --env.noTest=true",
1515
"prebuild-dev-noTest:watch": "eslint . --color --fix",
16-
"build-dev-noTest:watch": "webpack --mode none --devtool source-map --env.noTest=true --progress --watch",
16+
"build-dev-noTest:watch": "webpack --mode development --devtool source-map --env.noTest=true --progress --watch",
1717
"prestart": "eslint . --color --fix",
1818
"start": "node --max_old_space_size=2048 node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --config webpack.config.dev.js"
1919
},

webapp/travis-install.sh

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)