Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
127d009d
Commit
127d009d
authored
7 years ago
by
DD Liu
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into monitors
parents
f385070f
4dd3ed69
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/gui/gui.jsx
+6
-8
6 additions, 8 deletions
src/components/gui/gui.jsx
src/containers/blocks.jsx
+19
-3
19 additions, 3 deletions
src/containers/blocks.jsx
src/containers/gui.jsx
+13
-0
13 additions, 0 deletions
src/containers/gui.jsx
with
38 additions
and
11 deletions
src/components/gui/gui.jsx
+
6
−
8
View file @
127d009d
...
@@ -19,6 +19,8 @@ const GUIComponent = props => {
...
@@ -19,6 +19,8 @@ const GUIComponent = props => {
basePath
,
basePath
,
children
,
children
,
vm
,
vm
,
onTabSelect
,
tabIndex
,
...
componentProps
...
componentProps
}
=
props
;
}
=
props
;
if
(
children
)
{
if
(
children
)
{
...
@@ -29,13 +31,6 @@ const GUIComponent = props => {
...
@@ -29,13 +31,6 @@ const GUIComponent = props => {
);
);
}
}
// @todo hack to resize blockly manually in case resize happened while hidden
const
handleTabSelect
=
tabIndex
=>
{
if
(
tabIndex
===
0
)
{
setTimeout
(()
=>
window
.
dispatchEvent
(
new
Event
(
'
resize
'
)));
}
};
return
(
return
(
<
Box
<
Box
className
=
{
styles
.
pageWrapper
}
className
=
{
styles
.
pageWrapper
}
...
@@ -48,7 +43,7 @@ const GUIComponent = props => {
...
@@ -48,7 +43,7 @@ const GUIComponent = props => {
<
Tabs
<
Tabs
className
=
{
styles
.
tabs
}
className
=
{
styles
.
tabs
}
forceRenderTabPanel
=
{
true
}
// eslint-disable-line react/jsx-boolean-value
forceRenderTabPanel
=
{
true
}
// eslint-disable-line react/jsx-boolean-value
onSelect
=
{
handle
TabSelect
}
onSelect
=
{
on
TabSelect
}
>
>
<
TabList
className
=
{
styles
.
tabList
}
>
<
TabList
className
=
{
styles
.
tabList
}
>
<
Tab
className
=
{
styles
.
tab
}
>
Scripts
</
Tab
>
<
Tab
className
=
{
styles
.
tab
}
>
Scripts
</
Tab
>
...
@@ -59,6 +54,7 @@ const GUIComponent = props => {
...
@@ -59,6 +54,7 @@ const GUIComponent = props => {
<
Box
className
=
{
styles
.
blocksWrapper
}
>
<
Box
className
=
{
styles
.
blocksWrapper
}
>
<
Blocks
<
Blocks
grow
=
{
1
}
grow
=
{
1
}
isVisible
=
{
tabIndex
===
0
}
// Scripts tab
options
=
{
{
options
=
{
{
media
:
`
${
basePath
}
static/blocks-media/`
media
:
`
${
basePath
}
static/blocks-media/`
}
}
}
}
...
@@ -102,6 +98,8 @@ const GUIComponent = props => {
...
@@ -102,6 +98,8 @@ const GUIComponent = props => {
GUIComponent
.
propTypes
=
{
GUIComponent
.
propTypes
=
{
basePath
:
PropTypes
.
string
,
basePath
:
PropTypes
.
string
,
children
:
PropTypes
.
node
,
children
:
PropTypes
.
node
,
onTabSelect
:
PropTypes
.
func
,
tabIndex
:
PropTypes
.
number
,
vm
:
PropTypes
.
instanceOf
(
VM
).
isRequired
vm
:
PropTypes
.
instanceOf
(
VM
).
isRequired
};
};
GUIComponent
.
defaultProps
=
{
GUIComponent
.
defaultProps
=
{
...
...
This diff is collapsed.
Click to expand it.
src/containers/blocks.jsx
+
19
−
3
View file @
127d009d
...
@@ -52,7 +52,21 @@ class Blocks extends React.Component {
...
@@ -52,7 +52,21 @@ class Blocks extends React.Component {
this
.
attachVM
();
this
.
attachVM
();
}
}
shouldComponentUpdate
(
nextProps
,
nextState
)
{
shouldComponentUpdate
(
nextProps
,
nextState
)
{
return
this
.
state
.
prompt
!==
nextState
.
prompt
;
return
this
.
state
.
prompt
!==
nextState
.
prompt
||
this
.
props
.
isVisible
!==
nextProps
.
isVisible
;
}
componentDidUpdate
(
prevProps
)
{
if
(
this
.
props
.
isVisible
===
prevProps
.
isVisible
)
{
return
;
}
// @todo hack to resize blockly manually in case resize happened while hidden
if
(
this
.
props
.
isVisible
)
{
// Scripts tab
window
.
dispatchEvent
(
new
Event
(
'
resize
'
));
this
.
workspace
.
setVisible
(
true
);
this
.
workspace
.
toolbox_
.
refreshSelection
();
}
else
{
this
.
workspace
.
setVisible
(
false
);
}
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
this
.
detachVM
();
this
.
detachVM
();
...
@@ -147,6 +161,7 @@ class Blocks extends React.Component {
...
@@ -147,6 +161,7 @@ class Blocks extends React.Component {
const
{
const
{
options
,
// eslint-disable-line no-unused-vars
options
,
// eslint-disable-line no-unused-vars
vm
,
// eslint-disable-line no-unused-vars
vm
,
// eslint-disable-line no-unused-vars
isVisible
,
// eslint-disable-line no-unused-vars
...
props
...
props
}
=
this
.
props
;
}
=
this
.
props
;
return
(
return
(
...
@@ -170,11 +185,12 @@ class Blocks extends React.Component {
...
@@ -170,11 +185,12 @@ class Blocks extends React.Component {
}
}
Blocks
.
propTypes
=
{
Blocks
.
propTypes
=
{
isVisible
:
PropTypes
.
bool
.
isRequired
,
options
:
PropTypes
.
shape
({
options
:
PropTypes
.
shape
({
media
:
PropTypes
.
string
,
media
:
PropTypes
.
string
,
zoom
:
PropTypes
.
shape
({
zoom
:
PropTypes
.
shape
({
controls
:
PropTypes
.
bool
ean
,
controls
:
PropTypes
.
bool
,
wheel
:
PropTypes
.
bool
ean
,
wheel
:
PropTypes
.
bool
,
startScale
:
PropTypes
.
number
startScale
:
PropTypes
.
number
}),
}),
colours
:
PropTypes
.
shape
({
colours
:
PropTypes
.
shape
({
...
...
This diff is collapsed.
Click to expand it.
src/containers/gui.jsx
+
13
−
0
View file @
127d009d
const
PropTypes
=
require
(
'
prop-types
'
);
const
PropTypes
=
require
(
'
prop-types
'
);
const
React
=
require
(
'
react
'
);
const
React
=
require
(
'
react
'
);
const
VM
=
require
(
'
scratch-vm
'
);
const
VM
=
require
(
'
scratch-vm
'
);
const
bindAll
=
require
(
'
lodash.bindall
'
);
const
vmListenerHOC
=
require
(
'
../lib/vm-listener-hoc.jsx
'
);
const
vmListenerHOC
=
require
(
'
../lib/vm-listener-hoc.jsx
'
);
const
GUIComponent
=
require
(
'
../components/gui/gui.jsx
'
);
const
GUIComponent
=
require
(
'
../components/gui/gui.jsx
'
);
class
GUI
extends
React
.
Component
{
class
GUI
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
bindAll
(
this
,
[
'
handleTabSelect
'
]);
this
.
state
=
{
tabIndex
:
0
};
}
componentDidMount
()
{
componentDidMount
()
{
this
.
props
.
vm
.
loadProject
(
this
.
props
.
projectData
);
this
.
props
.
vm
.
loadProject
(
this
.
props
.
projectData
);
this
.
props
.
vm
.
setCompatibilityMode
(
true
);
this
.
props
.
vm
.
setCompatibilityMode
(
true
);
...
@@ -20,6 +28,9 @@ class GUI extends React.Component {
...
@@ -20,6 +28,9 @@ class GUI extends React.Component {
componentWillUnmount
()
{
componentWillUnmount
()
{
this
.
props
.
vm
.
stopAll
();
this
.
props
.
vm
.
stopAll
();
}
}
handleTabSelect
(
tabIndex
)
{
this
.
setState
({
tabIndex
});
}
render
()
{
render
()
{
const
{
const
{
projectData
,
// eslint-disable-line no-unused-vars
projectData
,
// eslint-disable-line no-unused-vars
...
@@ -28,7 +39,9 @@ class GUI extends React.Component {
...
@@ -28,7 +39,9 @@ class GUI extends React.Component {
}
=
this
.
props
;
}
=
this
.
props
;
return
(
return
(
<
GUIComponent
<
GUIComponent
tabIndex
=
{
this
.
state
.
tabIndex
}
vm
=
{
vm
}
vm
=
{
vm
}
onTabSelect
=
{
this
.
handleTabSelect
}
{
...
componentProps
}
{
...
componentProps
}
/>
/>
);
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment