Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
VILLASweb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ACS
P
Public
VILLASframework
VILLASweb
Commits
e8806892
Commit
e8806892
authored
Jan 27, 2020
by
Sonja Happ
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-react-lifecycles' into example-dashboard
parents
0dc1365a
6f4604c7
Changes
41
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
5082 additions
and
3258 deletions
+5082
-3258
package-lock.json
package-lock.json
+4568
-2842
package.json
package.json
+29
-26
src/app.js
src/app.js
+4
-4
src/common/editable-header.js
src/common/editable-header.js
+4
-2
src/common/home.js
src/common/home.js
+0
-6
src/common/table.js
src/common/table.js
+10
-10
src/file/select-file.js
src/file/select-file.js
+113
-113
src/simulationmodel/signal-mapping.js
src/simulationmodel/signal-mapping.js
+9
-6
src/simulationmodel/simulation-model.js
src/simulationmodel/simulation-model.js
+1
-1
src/simulator/select-simulator.js
src/simulator/select-simulator.js
+15
-13
src/simulator/simulator-action.js
src/simulator/simulator-action.js
+9
-6
src/simulator/simulators.js
src/simulator/simulators.js
+1
-1
src/user/login.js
src/user/login.js
+8
-6
src/user/logout.js
src/user/logout.js
+1
-1
src/widget/edit-widget-aspect-control.js
src/widget/edit-widget-aspect-control.js
+4
-2
src/widget/edit-widget-checkbox-control.js
src/widget/edit-widget-checkbox-control.js
+4
-2
src/widget/edit-widget-color-control.js
src/widget/edit-widget-color-control.js
+4
-3
src/widget/edit-widget-color-zones-control.js
src/widget/edit-widget-color-zones-control.js
+4
-2
src/widget/edit-widget-html-content.js
src/widget/edit-widget-html-content.js
+4
-3
src/widget/edit-widget-image-control.js
src/widget/edit-widget-image-control.js
+4
-2
src/widget/edit-widget-min-max-control.js
src/widget/edit-widget-min-max-control.js
+4
-2
src/widget/edit-widget-number-control.js
src/widget/edit-widget-number-control.js
+4
-3
src/widget/edit-widget-orientation.js
src/widget/edit-widget-orientation.js
+4
-3
src/widget/edit-widget-parameters-control.js
src/widget/edit-widget-parameters-control.js
+4
-3
src/widget/edit-widget-signal-control.js
src/widget/edit-widget-signal-control.js
+4
-3
src/widget/edit-widget-signals-control.js
src/widget/edit-widget-signals-control.js
+4
-3
src/widget/edit-widget-text-control.js
src/widget/edit-widget-text-control.js
+4
-3
src/widget/edit-widget-time-control.js
src/widget/edit-widget-time-control.js
+4
-2
src/widget/widget-plot/plot.js
src/widget/widget-plot/plot.js
+20
-17
src/widget/widget.js
src/widget/widget.js
+3
-3
src/widget/widgets/custom-action.js
src/widget/widgets/custom-action.js
+5
-5
src/widget/widgets/gauge.js
src/widget/widgets/gauge.js
+78
-54
src/widget/widgets/image.js
src/widget/widgets/image.js
+5
-4
src/widget/widgets/input.js
src/widget/widgets/input.js
+12
-11
src/widget/widgets/lamp.js
src/widget/widgets/lamp.js
+14
-11
src/widget/widgets/plot-table.js
src/widget/widgets/plot-table.js
+13
-13
src/widget/widgets/plot.js
src/widget/widgets/plot.js
+23
-12
src/widget/widgets/slider.js
src/widget/widgets/slider.js
+27
-16
src/widget/widgets/table.js
src/widget/widgets/table.js
+28
-18
src/widget/widgets/topology.js
src/widget/widgets/topology.js
+11
-9
src/widget/widgets/value.js
src/widget/widgets/value.js
+15
-12
No files found.
package-lock.json
View file @
e8806892
This diff is collapsed.
Click to expand it.
package.json
View file @
e8806892
...
@@ -3,51 +3,54 @@
...
@@ -3,51 +3,54 @@
"version"
:
"0.1.0"
,
"version"
:
"0.1.0"
,
"private"
:
true
,
"private"
:
true
,
"dependencies"
:
{
"dependencies"
:
{
"
@fortawesome/fontawesome-svg-core
"
:
"
^1.2.
19
"
,
"
@fortawesome/fontawesome-svg-core
"
:
"
^1.2.
26
"
,
"
@fortawesome/free-solid-svg-icons
"
:
"
^5.
9
.0
"
,
"
@fortawesome/free-solid-svg-icons
"
:
"
^5.
12
.0
"
,
"
@fortawesome/react-fontawesome
"
:
"
^0.1.
4
"
,
"
@fortawesome/react-fontawesome
"
:
"
^0.1.
8
"
,
"
babel-runtime
"
:
"
^6.26.0
"
,
"
babel-runtime
"
:
"
^6.26.0
"
,
"
bootstrap
"
:
"
^4.
3
.1
"
,
"
bootstrap
"
:
"
^4.
4
.1
"
,
"
classnames
"
:
"
^2.2.6
"
,
"
classnames
"
:
"
^2.2.6
"
,
"
d3-array
"
:
"
^2.
2
.0
"
,
"
d3-array
"
:
"
^2.
4
.0
"
,
"
d3-axis
"
:
"
^1.0.12
"
,
"
d3-axis
"
:
"
^1.0.12
"
,
"
d3-scale
"
:
"
^3.
0.0
"
,
"
d3-scale
"
:
"
^3.
2.1
"
,
"
d3-scale-chromatic
"
:
"
^1.
3.3
"
,
"
d3-scale-chromatic
"
:
"
^1.
5.0
"
,
"
d3-selection
"
:
"
^1.4.
0
"
,
"
d3-selection
"
:
"
^1.4.
1
"
,
"
d3-shape
"
:
"
^1.3.
5
"
,
"
d3-shape
"
:
"
^1.3.
7
"
,
"
d3-time-format
"
:
"
^2.
1
.3
"
,
"
d3-time-format
"
:
"
^2.
2
.3
"
,
"
es6-promise
"
:
"
^4.2.8
"
,
"
es6-promise
"
:
"
^4.2.8
"
,
"
fibers
"
:
"
^4.0.2
"
,
"
file-saver
"
:
"
^2.0.2
"
,
"
file-saver
"
:
"
^2.0.2
"
,
"
flux
"
:
"
^3.1.3
"
,
"
flux
"
:
"
^3.1.3
"
,
"
frontend-collective-react-dnd-scrollzone
"
:
"
^1.0.2
"
,
"
frontend-collective-react-dnd-scrollzone
"
:
"
^1.0.2
"
,
"
gaugeJS
"
:
"
^1.3.7
"
,
"
gaugeJS
"
:
"
^1.3.7
"
,
"
handlebars
"
:
"
^4.
5
.1
"
,
"
handlebars
"
:
"
^4.
7
.1
"
,
"
immutable
"
:
"
^4.0.0-rc.12
"
,
"
immutable
"
:
"
^4.0.0-rc.12
"
,
"
jquery
"
:
"
^3.4.1
"
,
"
jquery
"
:
"
^3.4.1
"
,
"
jszip
"
:
"
^3.2.2
"
,
"
jszip
"
:
"
^3.2.2
"
,
"libcimsvg"
:
"git+https://git.rwth-aachen.de/acs/public/cim/pintura-npm-package.git"
,
"libcimsvg"
:
"git+https://git.rwth-aachen.de/acs/public/cim/pintura-npm-package.git"
,
"
lodash
"
:
"
^4.17.15
"
,
"
lodash
"
:
"
^4.17.15
"
,
"
node-sass
"
:
"
^4.13.0
"
,
"
prop-types
"
:
"
^15.7.2
"
,
"
prop-types
"
:
"
^15.7.2
"
,
"
rc-slider
"
:
"
^8.
6.13
"
,
"
rc-slider
"
:
"
^8.
7.1
"
,
"
react
"
:
"
^16.
8.6
"
,
"
react
"
:
"
^16.
12.0
"
,
"
react-bootstrap
"
:
"
^1.0.0-beta.
9
"
,
"
react-bootstrap
"
:
"
^1.0.0-beta.
16
"
,
"
react-contexify
"
:
"
^4.1.1
"
,
"
react-contexify
"
:
"
^4.1.1
"
,
"
react-d3
"
:
"
^0.4.0
"
,
"
react-d3
"
:
"
^0.4.0
"
,
"
react-dnd
"
:
"
^9.
3.2
"
,
"
react-dnd
"
:
"
^9.
5.1
"
,
"
react-dnd-html5-backend
"
:
"
^9.
3.2
"
,
"
react-dnd-html5-backend
"
:
"
^9.
5.1
"
,
"
react-dom
"
:
"
^16.
8.6
"
,
"
react-dom
"
:
"
^16.
12.0
"
,
"
react-fullscreenable
"
:
"
^2.5.1-0
"
,
"
react-fullscreenable
"
:
"
^2.5.1-0
"
,
"
react-grid-system
"
:
"
^4.4.1
0
"
,
"
react-grid-system
"
:
"
^4.4.1
1
"
,
"
react-json-view
"
:
"
^1.19.1
"
,
"
react-json-view
"
:
"
^1.19.1
"
,
"
react-notification-system
"
:
"
^0.2.17
"
,
"
react-notification-system
"
:
"
^0.2.17
"
,
"
react-rnd
"
:
"
^10.0.0
"
,
"
react-rnd
"
:
"
^10.1.4
"
,
"
react-router
"
:
"
^5.0.1
"
,
"
react-router
"
:
"
^5.1.2
"
,
"
react-router-dom
"
:
"
^5.0.1
"
,
"
react-router-dom
"
:
"
^5.1.2
"
,
"
react-scripts
"
:
"
^3.0.1
"
,
"
react-scripts
"
:
"
^3.3.0
"
,
"
react-sortable-tree
"
:
"
^2.6.2
"
,
"
react-sortable-tree
"
:
"
^2.7.1
"
,
"
react-svg-pan-zoom
"
:
"
^3.1.0
"
,
"
react-svg-pan-zoom
"
:
"
^3.8.0
"
,
"
superagent
"
:
"
^5.1.0
"
,
"
sass
"
:
"
^1.24.4
"
,
"
typescript
"
:
"
^3.5.3
"
,
"
superagent
"
:
"
^5.2.1
"
,
"
typescript
"
:
"
^3.7.4
"
,
"
validator
"
:
"
^11.1.0
"
"
validator
"
:
"
^11.1.0
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
...
...
src/app.js
View file @
e8806892
...
@@ -68,7 +68,9 @@ class App extends React.Component {
...
@@ -68,7 +68,9 @@ class App extends React.Component {
};
};
}
}
componentWillMount
()
{
componentDidMount
()
{
NotificationsDataManager
.
setSystem
(
this
.
refs
.
notificationSystem
);
// if token stored locally, request user
// if token stored locally, request user
let
token
=
localStorage
.
getItem
(
"
token
"
);
let
token
=
localStorage
.
getItem
(
"
token
"
);
let
currentUser
=
JSON
.
parse
(
localStorage
.
getItem
(
"
currentUser
"
));
let
currentUser
=
JSON
.
parse
(
localStorage
.
getItem
(
"
currentUser
"
));
...
@@ -79,9 +81,7 @@ class App extends React.Component {
...
@@ -79,9 +81,7 @@ class App extends React.Component {
currentUser
:
currentUser
currentUser
:
currentUser
});
});
}
}
}
componentDidMount
()
{
// load all simulators and scenarios to fetch data
// load all simulators and scenarios to fetch data
// AppDispatcher.dispatch({
// AppDispatcher.dispatch({
// type: 'simulators/start-load',
// type: 'simulators/start-load',
...
@@ -93,7 +93,7 @@ class App extends React.Component {
...
@@ -93,7 +93,7 @@ class App extends React.Component {
// token: this.state.token
// token: this.state.token
// });
// });
NotificationsDataManager
.
setSystem
(
this
.
refs
.
notificationSystem
);
}
}
showSidebarMenu
=
()
=>
{
showSidebarMenu
=
()
=>
{
...
...
src/common/editable-header.js
View file @
e8806892
...
@@ -36,8 +36,10 @@ class EditableHeader extends React.Component {
...
@@ -36,8 +36,10 @@ class EditableHeader extends React.Component {
};
};
}
}
componentWillReceiveProps
(
nextProps
)
{
static
getDerivedStateFromProps
(
props
,
state
){
this
.
setState
({
title
:
nextProps
.
title
});
return
{
title
:
props
.
title
};
}
}
edit
=
()
=>
{
edit
=
()
=>
{
...
...
src/common/home.js
View file @
e8806892
...
@@ -45,12 +45,6 @@ class Home extends React.Component {
...
@@ -45,12 +45,6 @@ class Home extends React.Component {
return
'
?
'
;
return
'
?
'
;
}
}
componentWillMount
()
{
//RestAPI.get('/api/v1/counts').then(response => {
// this.setState({ counts: response });
//});
}
render
()
{
render
()
{
return
(
return
(
<
div
className
=
"
home-container
"
>
<
div
className
=
"
home-container
"
>
...
...
src/common/table.js
View file @
e8806892
...
@@ -32,7 +32,7 @@ class CustomTable extends Component {
...
@@ -32,7 +32,7 @@ class CustomTable extends Component {
this
.
activeInput
=
null
;
this
.
activeInput
=
null
;
this
.
state
=
{
this
.
state
=
{
rows
:
this
.
getRows
(
props
),
rows
:
CustomTable
.
getRows
(
props
),
editCell
:
[
-
1
,
-
1
]
editCell
:
[
-
1
,
-
1
]
};
};
}
}
...
@@ -45,7 +45,7 @@ class CustomTable extends Component {
...
@@ -45,7 +45,7 @@ class CustomTable extends Component {
this
.
setState
({
editCell
:
[
column
,
row
]});
// x, y
this
.
setState
({
editCell
:
[
column
,
row
]});
// x, y
}
}
addCell
(
data
,
index
,
child
)
{
static
addCell
(
data
,
index
,
child
)
{
// add data to cell
// add data to cell
let
content
=
null
;
let
content
=
null
;
...
@@ -112,7 +112,7 @@ class CustomTable extends Component {
...
@@ -112,7 +112,7 @@ class CustomTable extends Component {
}
}
if
(
child
.
props
.
checkbox
)
{
if
(
child
.
props
.
checkbox
)
{
const
checkboxKey
=
this
.
props
.
checkboxKey
;
const
checkboxKey
=
child
.
props
.
checkboxKey
;
cell
.
push
(
<
FormCheck
className
=
"
table-control-checkbox
"
inline
checked
=
{
checkboxKey
?
data
[
checkboxKey
]
:
null
}
onChange
=
{
e
=>
child
.
props
.
onChecked
(
index
,
e
)}
/>
)
;
cell
.
push
(
<
FormCheck
className
=
"
table-control-checkbox
"
inline
checked
=
{
checkboxKey
?
data
[
checkboxKey
]
:
null
}
onChange
=
{
e
=>
child
.
props
.
onChecked
(
index
,
e
)}
/>
)
;
}
}
...
@@ -122,12 +122,12 @@ class CustomTable extends Component {
...
@@ -122,12 +122,12 @@ class CustomTable extends Component {
}
}
return
cell
;
return
cell
;
}
}
// addCell
componentWillReceiveProps
(
nextProps
)
{
static
getDerivedStateFromProps
(
props
,
state
)
{
const
rows
=
this
.
getRows
(
nextP
rops
);
const
rows
=
CustomTable
.
getRows
(
p
rops
);
this
.
setState
({
rows
})
;
return
{
rows
}
;
}
}
componentDidUpdate
()
{
componentDidUpdate
()
{
...
@@ -147,7 +147,7 @@ class CustomTable extends Component {
...
@@ -147,7 +147,7 @@ class CustomTable extends Component {
this
.
setState
({
editCell
:
[
-
1
,
-
1
]
});
this
.
setState
({
editCell
:
[
-
1
,
-
1
]
});
}
}
getRows
(
props
)
{
static
getRows
(
props
)
{
if
(
props
.
data
==
null
)
{
if
(
props
.
data
==
null
)
{
return
[];
return
[];
}
}
...
@@ -156,13 +156,13 @@ class CustomTable extends Component {
...
@@ -156,13 +156,13 @@ class CustomTable extends Component {
// check if multiple columns
// check if multiple columns
if
(
Array
.
isArray
(
props
.
children
)
===
false
)
{
if
(
Array
.
isArray
(
props
.
children
)
===
false
)
{
// table only has a single column
// table only has a single column
return
[
this
.
addCell
(
data
,
index
,
props
.
children
)
];
return
[
CustomTable
.
addCell
(
data
,
index
,
props
.
children
)
];
}
}
const
row
=
[];
const
row
=
[];
for
(
let
child
of
props
.
children
)
{
for
(
let
child
of
props
.
children
)
{
row
.
push
(
this
.
addCell
(
data
,
index
,
child
));
row
.
push
(
CustomTable
.
addCell
(
data
,
index
,
child
));
}
}
return
row
;
return
row
;
...
...
src/file/select-file.js
View file @
e8806892
...
@@ -29,123 +29,123 @@ import LoginStore from '../user/login-store';
...
@@ -29,123 +29,123 @@ import LoginStore from '../user/login-store';
import
AppDispatcher
from
'
../common/app-dispatcher
'
;
import
AppDispatcher
from
'
../common/app-dispatcher
'
;
class
SelectFile
extends
React
.
Component
{
class
SelectFile
extends
React
.
Component
{
static
getStores
()
{
static
getStores
()
{
return
[
FileStore
,
LoginStore
];
return
[
FileStore
,
LoginStore
];
}
static
calculateState
()
{
return
{
files
:
FileStore
.
getState
(),
sessionToken
:
LoginStore
.
getState
().
token
,
selectedFile
:
''
,
uploadFile
:
null
,
uploadProgress
:
0
};
}
componentDidMount
()
{
AppDispatcher
.
dispatch
({
type
:
'
files/start-load
'
,
token
:
this
.
state
.
sessionToken
});
}
static
getDerivedStateFromProps
(
props
,
state
){
if
(
props
.
value
===
state
.
selectedSimulator
)
{
return
null
;
}
}
static
calculateState
()
{
let
selectedSimulator
=
props
.
value
;
return
{
if
(
selectedSimulator
==
null
)
{
files
:
FileStore
.
getState
(),
if
(
state
.
simulators
.
length
>
0
)
{
sessionToken
:
LoginStore
.
getState
().
token
,
selectedSimulator
=
state
.
simulators
[
0
].
_id
;
selectedFile
:
''
,
}
else
{
uploadFile
:
null
,
selectedSimulator
=
''
;
uploadProgress
:
0
}
};
}
}
componentDidMount
()
{
return
{
selectedSimulator
};
AppDispatcher
.
dispatch
({
}
type
:
'
files/start-load
'
,
token
:
this
.
state
.
sessionToken
handleChange
=
event
=>
{
});
this
.
setState
({
selectedFile
:
event
.
target
.
value
});
}
// send file to callback
componentWillReceiveProps
(
nextProps
)
{
if
(
this
.
props
.
onChange
!=
null
)
{
if
(
nextProps
.
value
===
this
.
state
.
selectedSimulator
)
{
const
file
=
this
.
state
.
files
.
find
(
f
=>
f
.
_id
===
event
.
target
.
value
);
return
;
}
this
.
props
.
onChange
(
file
);
}
let
selectedSimulator
=
nextProps
.
value
;
};
if
(
selectedSimulator
==
null
)
{
if
(
this
.
state
.
simulators
.
length
>
0
)
{
selectUploadFile
=
event
=>
{
selectedSimulator
=
this
.
state
.
simulators
[
0
].
_id
;
this
.
setState
({
uploadFile
:
event
.
target
.
files
[
0
]
});
}
else
{
};
selectedSimulator
=
''
;
}
startFileUpload
=
()
=>
{
}
// upload file
const
formData
=
new
FormData
();
this
.
setState
({
selectedSimulator
});
formData
.
append
(
0
,
this
.
state
.
uploadFile
);
}
AppDispatcher
.
dispatch
({
handleChange
=
event
=>
{
type
:
'
files/start-upload
'
,
this
.
setState
({
selectedFile
:
event
.
target
.
value
});
data
:
formData
,
token
:
this
.
state
.
sessionToken
,
// send file to callback
progressCallback
:
this
.
updateUploadProgress
,
if
(
this
.
props
.
onChange
!=
null
)
{
finishedCallback
:
this
.
clearProgress
const
file
=
this
.
state
.
files
.
find
(
f
=>
f
.
_id
===
event
.
target
.
value
);
});
};
this
.
props
.
onChange
(
file
);
}
updateUploadProgress
=
event
=>
{
}
this
.
setState
({
uploadProgress
:
parseInt
(
event
.
percent
.
toFixed
(),
10
)
});
};
selectUploadFile
=
event
=>
{
this
.
setState
({
uploadFile
:
event
.
target
.
files
[
0
]
});
clearProgress
=
()
=>
{
}
// select uploaded file
const
selectedFile
=
this
.
state
.
files
[
this
.
state
.
files
.
length
-
1
].
_id
;
startFileUpload
=
()
=>
{
this
.
setState
({
selectedFile
,
uploadProgress
:
0
});
// upload file
};
const
formData
=
new
FormData
();
formData
.
append
(
0
,
this
.
state
.
uploadFile
);
render
()
{
const
fileOptions
=
this
.
state
.
files
.
map
(
f
=>
AppDispatcher
.
dispatch
({
<
option
key
=
{
f
.
_id
}
value
=
{
f
.
_id
}
>
{
f
.
name
}
<
/option
>
type
:
'
files/start-upload
'
,
);
data
:
formData
,
token
:
this
.
state
.
sessionToken
,
const
progressBarStyle
=
{
progressCallback
:
this
.
updateUploadProgress
,
marginLeft
:
'
100px
'
,
finishedCallback
:
this
.
clearProgress
marginTop
:
'
-25px
'
});
};
}
return
<
div
>
updateUploadProgress
=
event
=>
{
<
FormGroup
>
this
.
setState
({
uploadProgress
:
parseInt
(
event
.
percent
.
toFixed
(),
10
)
});
<
Col
componentClass
=
{
FormLabel
}
sm
=
{
3
}
md
=
{
2
}
>
}
{
this
.
props
.
name
}
<
/Col
>
clearProgress
=
()
=>
{
// select uploaded file
<
Col
sm
=
{
9
}
md
=
{
10
}
>
const
selectedFile
=
this
.
state
.
files
[
this
.
state
.
files
.
length
-
1
].
_id
;
<
FormControl
disabled
=
{
this
.
props
.
disabled
}
componentClass
=
'
select
'
placeholder
=
'
Select file
'
onChange
=
{
this
.
handleChange
}
>
this
.
setState
({
selectedFile
,
uploadProgress
:
0
});
{
fileOptions
}
}
<
/FormControl
>
<
/Col
>
render
()
{
<
/FormGroup
>
const
fileOptions
=
this
.
state
.
files
.
map
(
f
=>
<
option
key
=
{
f
.
_id
}
value
=
{
f
.
_id
}
>
{
f
.
name
}
<
/option
>
<
FormGroup
>
);
<
Col
sm
=
{
9
}
md
=
{
10
}
smOffset
=
{
3
}
mdOffset
=
{
2
}
>
<
FormControl
disabled
=
{
this
.
props
.
disabled
}
type
=
'
file
'
onChange
=
{
this
.
selectUploadFile
}
/
>
const
progressBarStyle
=
{
<
/Col
>
marginLeft
:
'
100px
'
,
<
/FormGroup
>
marginTop
:
'
-25px
'
};
<
FormGroup
>
<
Col
sm
=
{
9
}
md
=
{
10
}
smOffset
=
{
3
}
mdOffset
=
{
2
}
>
return
<
div
>
<
Button
disabled
=
{
this
.
props
.
disabled
}
bsSize
=
'
small
'
onClick
=
{
this
.
startFileUpload
}
>
<
FormGroup
>
Upload
file
<
Col
componentClass
=
{
FormLabel
}
sm
=
{
3
}
md
=
{
2
}
>
<
/Button
>
{
this
.
props
.
name
}
<
/Col
>
<
ProgressBar
striped
active
now
=
{
this
.
state
.
uploadProgress
}
label
=
{
this
.
state
.
uploadProgress
+
'
%
'
}
style
=
{
progressBarStyle
}
/
>
<
/Col
>
<
Col
sm
=
{
9
}
md
=
{
10
}
>
<
/FormGroup
>
<
FormControl
disabled
=
{
this
.
props
.
disabled
}
componentClass
=
'
select
'
placeholder
=
'
Select file
'
onChange
=
{
this
.
handleChange
}
>
<
/div>
;
{
fileOptions
}
}
<
/FormControl
>
<
/Col
>
<
/FormGroup
>
<
FormGroup
>
<
Col
sm
=
{
9
}
md
=
{
10
}
smOffset
=
{
3
}
mdOffset
=
{
2
}
>
<
FormControl
disabled
=
{
this
.
props
.
disabled
}
type
=
'
file
'
onChange
=
{
this
.
selectUploadFile
}
/
>
<
/Col
>
<
/FormGroup
>
<
FormGroup
>
<
Col
sm
=
{
9
}
md
=
{
10
}
smOffset
=
{
3
}
mdOffset
=
{
2
}
>
<
Button
disabled
=
{
this
.
props
.
disabled
}
bsSize
=
'
small
'
onClick
=
{
this
.
startFileUpload
}
>
Upload
file
<
/Button
>
<
ProgressBar
striped
active
now
=
{
this
.
state
.
uploadProgress
}
label
=
{
this
.
state
.
uploadProgress
+
'
%
'
}
style
=
{
progressBarStyle
}
/
>
<
/Col
>
<
/FormGroup
>
<
/div>
;
}
}
}
let
fluxContainerConverter
=
require
(
'
../common/FluxContainerConverter
'
);
let
fluxContainerConverter
=
require
(
'
../common/FluxContainerConverter
'
);
...
...
src/simulationmodel/signal-mapping.js
View file @
e8806892
...
@@ -41,12 +41,15 @@ class SignalMapping extends React.Component {
...
@@ -41,12 +41,15 @@ class SignalMapping extends React.Component {
};
};
}
}
componentWillReceiveProps
(
nextProps
)
{
static
getDerivedStateFromProps
(
props
,
state
){
if
(
nextProps
.
length
===
this
.
state
.
length
&&
nextProps
.
signals
===
this
.
state
.
signals
)
{
if
(
props
.
length
===
state
.
length
&&
props
.
signals
===
state
.
signals
)
{
return
;
return
null
}
}
this
.
setState
({
length
:
nextProps
.
length
,
signals
:
nextProps
.
signals
});
return
{
length
:
props
.
length
,
signals
:
props
.
signals
};
}
}
validateLength
(){
validateLength
(){
...
...
src/simulationmodel/simulation-model.js
View file @
e8806892
...
@@ -47,7 +47,7 @@ class SimulationModel extends React.Component {
...
@@ -47,7 +47,7 @@ class SimulationModel extends React.Component {
};
};
}
}
component
Will
Mount
()
{
component
Did
Mount
()
{
AppDispatcher
.
dispatch
({
AppDispatcher
.
dispatch
({
type
:
'
simulationModels/start-load
'
,
type
:
'
simulationModels/start-load
'
,
data
:
this
.
props
.
match
.
params
.
simulationModel
,
data
:
this
.
props
.
match
.
params
.
simulationModel
,
...
...
src/simulator/select-simulator.js
View file @
e8806892
...
@@ -38,21 +38,23 @@ class SelectSimulator extends React.Component {
...
@@ -38,21 +38,23 @@ class SelectSimulator extends React.Component {
};
};
}
}
componentWillReceiveProps
(
nextProps
)
{
static
getDerivedStateFromProps
(
props
,
state
)
{
if
(
nextProps
.
value
===
this
.
state
.
selectedSimulator
)
{
if
(
props
.
value
===
state
.
selectedSimulator
)
{
return
;
return
null
;
// no change
}
}
let
selectedSimulator
=
nextProps
.
value
;
let
selectedSimulator
=
props
.
value
;
if
(
selectedSimulator
==
null
)
{
if
(
selectedSimulator
==
null
)
{
if
(
this
.
state
.
simulators
.
length
>
0
)
{
if
(
state
.
simulators
.
length
>
0
)
{
selectedSimulator
=
this
.
state
.
simulators
[
0
].
id
;
selectedSimulator
=
state
.
simulators
[
0
].
id
;
}
else
{
}
else
{
selectedSimulator
=
''
;
selectedSimulator
=
''
;
}
}
}
}
this
.
setState
({
selectedSimulator
});
return
{
selectedSimulator
};
}
}
handleChange
=
event
=>
{
handleChange
=
event
=>
{
...
@@ -64,7 +66,7 @@ class SelectSimulator extends React.Component {
...
@@ -64,7 +66,7 @@ class SelectSimulator extends React.Component {
this
.
props
.
onChange
(
simulator
);
this
.
props
.
onChange
(
simulator
);
}
}
}
}
;
render
()
{
render
()
{
const
simulatorOptions
=
this
.
state
.
simulators
.
map
(
s
=>
const
simulatorOptions
=
this
.
state
.
simulators
.
map
(
s
=>
...
...