Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
863eae95
Commit
863eae95
authored
Oct 23, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect scroll up and scroll down
parent
be4f7b18
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
42 deletions
+133
-42
.eslintrc
libs/remix-ui/debugger-ui/.eslintrc
+1
-0
step-manager.tsx
...emix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx
+1
-1
assembly-items.tsx
...mix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
+32
-31
code-list-view.tsx
...mix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx
+2
-8
vm-debugger-head.tsx
...x-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx
+2
-2
assembly-items.ts
libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
+55
-0
calldata.ts
libs/remix-ui/debugger-ui/src/reducers/calldata.ts
+40
-0
No files found.
libs/remix-ui/debugger-ui/.eslintrc
View file @
863eae95
{
{
"rules": {
"rules": {
"no-case-declarations": "off",
"array-callback-return": "warn",
"array-callback-return": "warn",
"dot-location": ["warn", "property"],
"dot-location": ["warn", "property"],
"eqeqeq": ["warn", "smart"],
"eqeqeq": ["warn", "smart"],
...
...
libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx
View file @
863eae95
...
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
...
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
import
Slider
from
'../slider/slider'
import
Slider
from
'../slider/slider'
import
ButtonNavigator
from
'../button-navigator/button-navigator'
import
ButtonNavigator
from
'../button-navigator/button-navigator'
export
const
StepManager
=
({
stepManager
,
stepManager
:
{
jumpTo
,
traceLength
,
stepIntoBack
,
stepIntoForward
,
stepOverBack
,
stepOverForward
,
jumpOut
,
jumpNextBreakpoint
,
jumpPreviousBreakpoint
,
jumpToException
,
registerEvent
}
})
=>
{
export
const
StepManager
=
({
stepManager
:
{
jumpTo
,
traceLength
,
stepIntoBack
,
stepIntoForward
,
stepOverBack
,
stepOverForward
,
jumpOut
,
jumpNextBreakpoint
,
jumpPreviousBreakpoint
,
jumpToException
,
registerEvent
}
})
=>
{
const
[
state
,
setState
]
=
useState
({
const
[
state
,
setState
]
=
useState
({
sliderValue
:
0
,
sliderValue
:
0
,
revertWarning
:
''
,
revertWarning
:
''
,
...
...
libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
View file @
863eae95
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useRef
,
useEffect
,
useReducer
}
from
'react'
import
{
initialState
,
reducer
}
from
'../../reducers/assembly-items'
import
'./styles/assembly-items.css'
import
'./styles/assembly-items.css'
export
const
AssemblyItems
=
({
codeView
,
index
})
=>
{
export
const
AssemblyItems
=
({
registerEvent
})
=>
{
const
[
state
,
setState
]
=
useState
({
const
[
assemblyItems
,
dispatch
]
=
useReducer
(
reducer
,
initialState
)
selectedItem
:
0
,
const
[
selectedItem
,
setSelectedItem
]
=
useState
(
0
)
opCode
:
[]
const
[
scrollHeight
,
setScrollHeight
]
=
useState
(
null
)
})
const
refs
=
useRef
({})
const
refs
=
useRef
({})
const
asmItemsRef
=
useRef
(
null
)
const
asmItemsRef
=
useRef
(
null
)
useEffect
(()
=>
{
registerEvent
&&
registerEvent
(
'codeManagerChanged'
,
(
code
,
address
,
index
)
=>
{
dispatch
({
type
:
'FETCH_OPCODES_SUCCESS'
,
payload
:
{
code
,
address
,
index
}
})
})
},
[])
useEffect
(()
=>
{
useEffect
(()
=>
{
indexChanged
(
index
)
indexChanged
(
assemblyItems
.
index
)
},
[
index
])
},
[
assemblyItems
.
index
])
useEffect
(()
=>
{
useEffect
(()
=>
{
opCodeChanged
(
codeView
)
if
(
asmItemsRef
.
current
.
scrollTop
>
scrollHeight
)
{
},
[
codeView
])
console
.
log
(
'scrolling up'
)
}
else
if
(
asmItemsRef
.
current
.
scrollTop
<
scrollHeight
)
{
console
.
log
(
'scrolling down'
)
}
},
[
asmItemsRef
.
current
.
scrollTop
])
const
indexChanged
=
(
index
)
=>
{
const
indexChanged
=
(
index
:
number
)
=>
{
if
(
index
<
0
)
return
if
(
index
<
0
)
return
const
{
selectedItem
}
=
state
let
currentItem
=
refs
.
current
[
selectedItem
]
?
refs
.
current
[
selectedItem
]
:
null
let
currentItem
=
refs
.
current
[
selectedItem
]
?
refs
.
current
[
selectedItem
]
:
null
if
(
currentItem
)
{
if
(
currentItem
)
{
currentItem
.
removeAttribute
(
'selected'
)
currentItem
.
removeAttribute
(
'selected'
)
currentItem
.
removeAttribute
(
'style'
)
currentItem
.
removeAttribute
(
'style'
)
...
@@ -29,39 +38,31 @@ export const AssemblyItems = ({ codeView, index }) => {
...
@@ -29,39 +38,31 @@ export const AssemblyItems = ({ codeView, index }) => {
currentItem
.
firstChild
.
removeAttribute
(
'style'
)
currentItem
.
firstChild
.
removeAttribute
(
'style'
)
}
}
const
codeView
=
asmItemsRef
.
current
const
codeView
=
asmItemsRef
.
current
currentItem
=
codeView
.
children
[
index
]
currentItem
=
codeView
.
children
[
index
]
currentItem
.
style
.
setProperty
(
'border-color'
,
'var(--primary)'
)
currentItem
.
style
.
setProperty
(
'border-color'
,
'var(--primary)'
)
currentItem
.
style
.
setProperty
(
'border-style'
,
'solid'
)
currentItem
.
style
.
setProperty
(
'border-style'
,
'solid'
)
currentItem
.
setAttribute
(
'selected'
,
'selected'
)
currentItem
.
setAttribute
(
'selected'
,
'selected'
)
codeView
.
scrollTop
=
currentItem
.
offsetTop
-
parseInt
(
codeView
.
offsetTop
)
codeView
.
scrollTop
=
currentItem
.
offsetTop
-
parseInt
(
codeView
.
offsetTop
)
setState
(
prevState
=>
{
setSelectedItem
(
index
)
return
{
...
prevState
,
selectedItem
:
index
}
})
}
}
}
}
const
opCodeChanged
=
(
codeView
)
=>
{
const
onScroll
=
()
=>
{
setState
(
prevState
=>
{
return
{
...
prevState
,
opCode
:
codeView
}
})
}
}
return
(
return
(
<
div
className=
"border rounded px-1 mt-1 bg-light"
>
<
div
className=
"border rounded px-1 mt-1 bg-light"
>
<
div
className=
'dropdownpanel'
>
<
div
className=
'dropdownpanel'
>
<
div
className=
'dropdowncontent'
>
<
div
className=
'dropdowncontent'
>
<
div
className=
"pl-2 my-1 small instructions"
id=
'asmitems'
ref=
{
asmItemsRef
}
>
<
div
className=
"pl-2 my-1 small instructions"
id=
'asmitems'
ref=
{
asmItemsRef
}
onScroll=
{
()
=>
setScrollHeight
(
asmItemsRef
.
current
.
scrollTop
)
}
>
{
{
// state.opCode
.map((item, i) =>
{
assemblyItems
.
display
.
map
((
item
,
i
)
=>
{
//
return <div className="px-1" key=
{
i
}
ref
=
{
ref
=>
refs
.
current
[
i
]
=
ref
}
>
<
span
>
{
item
}
</
span
><
/
div
>
return
<
div
className=
"px-1"
key=
{
i
}
ref=
{
ref
=>
refs
.
current
[
i
]
=
ref
}
><
span
>
{
item
}
</
span
></
div
>
//
})
})
}
}
</
div
>
</
div
>
</
div
>
</
div
>
...
...
libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx
View file @
863eae95
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
AssemblyItems
from
'./assembly-items'
import
AssemblyItems
from
'./assembly-items'
export
const
CodeListView
=
({
asm
})
=>
{
export
const
CodeListView
=
({
registerEvent
})
=>
{
const
[
state
,
setState
]
=
useState
({
const
[
state
,
setState
]
=
useState
({
code
:
[],
code
:
[],
address
:
''
,
address
:
''
,
...
@@ -9,12 +9,6 @@ export const CodeListView = ({ asm }) => {
...
@@ -9,12 +9,6 @@ export const CodeListView = ({ asm }) => {
index
:
null
index
:
null
})
})
useEffect
(()
=>
{
const
{
code
,
address
,
index
}
=
asm
changed
(
code
,
address
,
index
)
},
[
asm
])
const
indexChanged
=
(
index
)
=>
{
const
indexChanged
=
(
index
)
=>
{
if
(
index
<
0
)
return
if
(
index
<
0
)
return
setState
(
prevState
=>
{
setState
(
prevState
=>
{
...
@@ -41,7 +35,7 @@ export const CodeListView = ({ asm }) => {
...
@@ -41,7 +35,7 @@ export const CodeListView = ({ asm }) => {
return
(
return
(
<
div
id=
'asmcodes'
>
<
div
id=
'asmcodes'
>
<
AssemblyItems
codeView=
{
state
.
code
||
[]
}
index=
{
state
.
index
}
/>
<
AssemblyItems
registerEvent=
{
registerEvent
}
/>
</
div
>
</
div
>
)
)
}
}
...
...
libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx
View file @
863eae95
...
@@ -119,8 +119,8 @@ export const VmDebuggerHead = ({ vmDebuggerHead: { registerEvent } }) => {
...
@@ -119,8 +119,8 @@ export const VmDebuggerHead = ({ vmDebuggerHead: { registerEvent } }) => {
<
SolidityLocals
data=
{
solidityLocals
.
calldata
}
message=
{
solidityLocals
.
message
}
/>
<
SolidityLocals
data=
{
solidityLocals
.
calldata
}
message=
{
solidityLocals
.
message
}
/>
{
/* <SolidityState calldata={solidityState.calldata} message={solidityState.message} /> */
}
{
/* <SolidityState calldata={solidityState.calldata} message={solidityState.message} /> */
}
</
div
>
</
div
>
{
/* <div className="w-100"><CodeListView asm={asm
} /></div>
<
div
className=
"w-100"
><
CodeListView
registerEvent=
{
registerEvent
}
/></
div
>
<div className="w-100"><StepDetail stepDetail={stepDetail} /></div> */
}
{
/*
<div className="w-100"><StepDetail stepDetail={stepDetail} /></div> */
}
</
div
>
</
div
>
</
div
>
</
div
>
)
)
...
...
libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
0 → 100644
View file @
863eae95
import
{
default
as
deepEqual
}
from
'deep-equal'
interface
Action
{
type
:
string
;
payload
:
{
[
key
:
string
]:
any
};
}
export
const
initialState
=
{
opCodes
:
{
code
:
[],
index
:
0
,
address
:
''
},
display
:
[],
index
:
0
,
isRequesting
:
false
,
isSuccessful
:
false
,
hasError
:
null
}
export
const
reducer
=
(
state
=
initialState
,
action
:
Action
)
=>
{
switch
(
action
.
type
)
{
case
'FETCH_OPCODES_REQUEST'
:
return
{
...
state
,
isRequesting
:
true
,
isSuccessful
:
false
,
hasError
:
null
};
case
'FETCH_OPCODES_SUCCESS'
:
const
opCodes
=
action
.
payload
.
address
===
state
.
opCodes
.
address
?
{
...
state
.
opCodes
,
index
:
action
.
payload
.
index
}
:
deepEqual
(
action
.
payload
.
code
,
state
.
opCodes
.
code
)
?
state
.
opCodes
:
action
.
payload
const
display
=
opCodes
.
index
>
0
?
opCodes
.
code
.
slice
(
opCodes
.
index
-
1
,
opCodes
.
index
+
10
)
:
opCodes
.
code
.
slice
(
opCodes
.
index
,
opCodes
.
index
+
10
)
return
{
opCodes
,
display
,
index
:
display
.
findIndex
(
code
=>
code
===
opCodes
.
code
[
opCodes
.
index
]),
isRequesting
:
false
,
isSuccessful
:
true
,
hasError
:
null
};
case
'FETCH_OPCODES_ERROR'
:
return
{
...
state
,
isRequesting
:
false
,
isSuccessful
:
false
,
hasError
:
action
.
payload
};
default
:
throw
new
Error
();
}
}
\ No newline at end of file
libs/remix-ui/debugger-ui/src/reducers/calldata.ts
0 → 100644
View file @
863eae95
interface
Action
{
type
:
string
;
payload
:
{
[
key
:
string
]:
any
};
}
export
const
initialState
=
{
calldata
:
{},
isRequesting
:
false
,
isSuccessful
:
false
,
hasError
:
null
}
export
const
reducer
=
(
state
=
initialState
,
action
:
Action
)
=>
{
switch
(
action
.
type
)
{
case
'FETCH_CALLDATA_REQUEST'
:
return
{
...
state
,
isRequesting
:
true
,
isSuccessful
:
false
,
hasError
:
null
};
case
'FETCH_CALLDATA_SUCCESS'
:
return
{
opCodes
:
action
.
payload
,
isRequesting
:
false
,
isSuccessful
:
true
,
hasError
:
null
};
case
'FETCH_CALLDATA_ERROR'
:
return
{
...
state
,
isRequesting
:
false
,
isSuccessful
:
false
,
hasError
:
action
.
payload
};
default
:
throw
new
Error
();
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment