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
0026c316
Unverified
Commit
0026c316
authored
Jul 04, 2018
by
yann300
Committed by
GitHub
Jul 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1387 from ethereum/refactor1
refactor RightHandPanel
parents
0f240a66
a68d6fc5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
173 additions
and
121 deletions
+173
-121
app.js
src/app.js
+0
-0
editor.js
src/app/editor/editor.js
+4
-5
editor-panel.js
src/app/panels/editor-panel.js
+4
-0
righthand-panel.js
src/app/panels/righthand-panel.js
+15
-17
pluginAPI.js
src/app/plugin/pluginAPI.js
+5
-5
pluginManager.js
src/app/plugin/pluginManager.js
+15
-8
analysis-tab.js
src/app/tabs/analysis-tab.js
+3
-3
compile-tab.js
src/app/tabs/compile-tab.js
+44
-30
debugger-tab.js
src/app/tabs/debugger-tab.js
+3
-3
plugin-tab.js
src/app/tabs/plugin-tab.js
+3
-4
run-tab.js
src/app/tabs/run-tab.js
+0
-0
settings-tab.js
src/app/tabs/settings-tab.js
+29
-17
support-tab.js
src/app/tabs/support-tab.js
+9
-5
tabbed-menu.js
src/app/tabs/tabbed-menu.js
+9
-6
test-tab.js
src/app/tabs/test-tab.js
+13
-12
recorder.js
src/recorder.js
+6
-6
universal-dapp.js
src/universal-dapp.js
+11
-0
No files found.
src/app.js
View file @
0026c316
This diff is collapsed.
Click to expand it.
src/app/editor/editor.js
View file @
0026c316
...
@@ -65,7 +65,6 @@ document.head.appendChild(yo`
...
@@ -65,7 +65,6 @@ document.head.appendChild(yo`
function
Editor
(
opts
=
{})
{
function
Editor
(
opts
=
{})
{
var
self
=
this
var
self
=
this
var
el
=
yo
`<div id="input"></div>`
var
el
=
yo
`<div id="input"></div>`
var
editor
=
ace
.
edit
(
el
)
var
editor
=
ace
.
edit
(
el
)
if
(
styles
.
appProperties
.
aceTheme
)
{
if
(
styles
.
appProperties
.
aceTheme
)
{
...
@@ -104,14 +103,14 @@ function Editor (opts = {}) {
...
@@ -104,14 +103,14 @@ function Editor (opts = {}) {
var
breakpoints
=
e
.
editor
.
session
.
getBreakpoints
()
var
breakpoints
=
e
.
editor
.
session
.
getBreakpoints
()
for
(
var
k
in
breakpoints
)
{
for
(
var
k
in
breakpoints
)
{
if
(
k
===
row
.
toString
())
{
if
(
k
===
row
.
toString
())
{
self
.
event
.
trigger
(
'breakpointCleared'
,
[
currentSession
,
row
])
event
.
trigger
(
'breakpointCleared'
,
[
currentSession
,
row
])
e
.
editor
.
session
.
clearBreakpoint
(
row
)
e
.
editor
.
session
.
clearBreakpoint
(
row
)
e
.
stop
()
e
.
stop
()
return
return
}
}
}
}
self
.
setBreakpoint
(
row
)
self
.
setBreakpoint
(
row
)
self
.
event
.
trigger
(
'breakpointAdded'
,
[
currentSession
,
row
])
event
.
trigger
(
'breakpointAdded'
,
[
currentSession
,
row
])
e
.
stop
()
e
.
stop
()
})
})
...
@@ -278,10 +277,10 @@ function Editor (opts = {}) {
...
@@ -278,10 +277,10 @@ function Editor (opts = {}) {
// Do setup on initialisation here
// Do setup on initialisation here
editor
.
on
(
'changeSession'
,
function
()
{
editor
.
on
(
'changeSession'
,
function
()
{
self
.
event
.
trigger
(
'sessionSwitched'
,
[])
event
.
trigger
(
'sessionSwitched'
,
[])
editor
.
getSession
().
on
(
'change'
,
function
()
{
editor
.
getSession
().
on
(
'change'
,
function
()
{
self
.
event
.
trigger
(
'contentChanged'
,
[])
event
.
trigger
(
'contentChanged'
,
[])
})
})
})
})
...
...
src/app/panels/editor-panel.js
View file @
0026c316
...
@@ -96,6 +96,10 @@ class EditorPanel {
...
@@ -96,6 +96,10 @@ class EditorPanel {
var
command
=
self
.
_components
.
terminal
.
commands
[
data
.
type
]
var
command
=
self
.
_components
.
terminal
.
commands
[
data
.
type
]
if
(
typeof
command
===
'function'
)
command
(
data
.
value
)
if
(
typeof
command
===
'function'
)
command
(
data
.
value
)
}
}
logMessage
(
msg
)
{
var
self
=
this
self
.
log
({
type
:
'log'
,
value
:
msg
})
}
render
()
{
render
()
{
var
self
=
this
var
self
=
this
if
(
self
.
_view
.
el
)
return
self
.
_view
.
el
if
(
self
.
_view
.
el
)
return
self
.
_view
.
el
...
...
src/app/panels/righthand-panel.js
View file @
0026c316
...
@@ -2,6 +2,8 @@ const yo = require('yo-yo')
...
@@ -2,6 +2,8 @@ const yo = require('yo-yo')
const
csjs
=
require
(
'csjs-inject'
)
const
csjs
=
require
(
'csjs-inject'
)
const
remixLib
=
require
(
'remix-lib'
)
const
remixLib
=
require
(
'remix-lib'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
const
styleguide
=
require
(
'../ui/styles-guide/theme-chooser'
)
const
styleguide
=
require
(
'../ui/styles-guide/theme-chooser'
)
const
PluginManager
=
require
(
'../plugin/pluginManager'
)
const
PluginManager
=
require
(
'../plugin/pluginManager'
)
const
TabbedMenu
=
require
(
'../tabs/tabbed-menu'
)
const
TabbedMenu
=
require
(
'../tabs/tabbed-menu'
)
...
@@ -18,32 +20,28 @@ const EventManager = remixLib.EventManager
...
@@ -18,32 +20,28 @@ const EventManager = remixLib.EventManager
const
styles
=
styleguide
.
chooser
()
const
styles
=
styleguide
.
chooser
()
module
.
exports
=
class
RighthandPanel
{
module
.
exports
=
class
RighthandPanel
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_api
=
api
self
.
_api
.
switchTab
=
x
=>
{
// @TODO: refactor
if
(
self
.
_components
.
tabbedMenu
)
self
.
_components
.
tabbedMenu
.
selectTabByClassName
(
x
)
}
self
.
_events
=
events
self
.
_events
.
rhp
=
self
.
event
// @TODO: refactor
self
.
_opts
=
opts
self
.
_view
=
{
self
.
_view
=
{
element
:
null
,
element
:
null
,
tabbedMenu
:
null
,
tabbedMenu
:
null
,
tabbedMenuViewport
:
null
,
tabbedMenuViewport
:
null
,
dragbar
:
null
dragbar
:
null
}
}
self
.
_components
=
{
self
.
_components
=
{
pluginManager
:
new
PluginManager
(
self
.
_opts
.
pluginAPI
,
self
.
_events
),
pluginManager
:
new
PluginManager
(),
tabbedMenu
:
new
TabbedMenu
(
self
.
_api
,
self
.
_events
),
tabbedMenu
:
new
TabbedMenu
(),
compile
:
new
CompileTab
(
self
.
_api
,
self
.
_events
,
self
.
_opts
),
compile
:
new
CompileTab
(),
run
:
new
RunTab
(
self
.
_api
,
self
.
_events
,
self
.
_opts
),
run
:
new
RunTab
(),
settings
:
new
SettingsTab
(
self
.
_api
,
self
.
_events
,
self
.
_opts
),
settings
:
new
SettingsTab
(),
analysis
:
new
AnalysisTab
(
self
.
_api
,
self
.
_events
,
self
.
_opts
),
analysis
:
new
AnalysisTab
(),
debug
:
new
DebuggerTab
(
self
.
_api
,
self
.
_events
,
self
.
_opts
),
debug
:
new
DebuggerTab
(),
support
:
new
SupportTab
(
self
.
_api
,
self
.
_events
,
self
.
_opts
),
support
:
new
SupportTab
(),
test
:
new
TestTab
(
self
.
_api
,
self
.
_events
,
self
.
_opts
)
test
:
new
TestTab
()
}
}
self
.
event
.
register
(
'plugin-loadRequest'
,
json
=>
{
self
.
event
.
register
(
'plugin-loadRequest'
,
json
=>
{
...
...
src/app/plugin/pluginAPI.js
View file @
0026c316
...
@@ -2,24 +2,24 @@
...
@@ -2,24 +2,24 @@
/*
/*
Defines available API. `key` / `type`
Defines available API. `key` / `type`
*/
*/
module
.
exports
=
(
app
,
compiler
)
=>
{
module
.
exports
=
(
registry
)
=>
{
return
{
return
{
config
:
{
config
:
{
setConfig
:
(
mod
,
path
,
content
,
cb
)
=>
{
setConfig
:
(
mod
,
path
,
content
,
cb
)
=>
{
app
.
_api
.
filesProviders
[
'config'
]
.
set
(
mod
+
'/'
+
path
,
content
)
registry
.
get
(
'fileProviders/config'
).
api
.
set
(
mod
+
'/'
+
path
,
content
)
cb
()
cb
()
},
},
getConfig
:
(
mod
,
path
,
cb
)
=>
{
getConfig
:
(
mod
,
path
,
cb
)
=>
{
cb
(
null
,
app
.
_api
.
filesProviders
[
'config'
]
.
get
(
mod
+
'/'
+
path
))
cb
(
null
,
registry
.
get
(
'fileProviders/config'
)
.
get
(
mod
+
'/'
+
path
))
},
},
removeConfig
:
(
mod
,
path
,
cb
)
=>
{
removeConfig
:
(
mod
,
path
,
cb
)
=>
{
cb
(
null
,
app
.
_api
.
filesProviders
[
'config'
]
.
remove
(
mod
+
'/'
+
path
))
cb
(
null
,
registry
.
get
(
'fileProviders/config'
).
api
.
remove
(
mod
+
'/'
+
path
))
if
(
cb
)
cb
()
if
(
cb
)
cb
()
}
}
},
},
compiler
:
{
compiler
:
{
getCompilationResult
:
()
=>
{
getCompilationResult
:
()
=>
{
return
compiler
.
lastCompilationResult
return
registry
.
get
(
'compiler'
).
api
.
lastCompilationResult
}
}
}
}
}
}
...
...
src/app/plugin/pluginManager.js
View file @
0026c316
'use strict'
'use strict'
var
globalRegistry
=
require
(
'../../global/registry'
)
var
PluginAPI
=
require
(
'./pluginAPI'
)
/**
/**
* Register and Manage plugin:
* Register and Manage plugin:
*
*
...
@@ -76,15 +79,19 @@
...
@@ -76,15 +79,19 @@
*
*
*/
*/
module
.
exports
=
class
PluginManager
{
module
.
exports
=
class
PluginManager
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
_opts
=
opts
self
.
_api
=
api
self
.
_events
=
events
self
.
plugins
=
{}
self
.
plugins
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
_components
.
pluginAPI
=
new
PluginAPI
(
self
.
_components
.
registry
)
self
.
_deps
=
{
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
}
self
.
inFocus
self
.
inFocus
self
.
allowedapi
=
{
'setConfig'
:
1
,
'getConfig'
:
1
,
'removeConfig'
:
1
}
self
.
allowedapi
=
{
'setConfig'
:
1
,
'getConfig'
:
1
,
'removeConfig'
:
1
}
self
.
_
events
.
compiler
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
self
.
_
deps
.
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
if
(
self
.
inFocus
)
{
if
(
self
.
inFocus
)
{
// trigger to the current focus
// trigger to the current focus
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
...
@@ -96,7 +103,7 @@ module.exports = class PluginManager {
...
@@ -96,7 +103,7 @@ module.exports = class PluginManager {
}
}
})
})
self
.
_
events
.
app
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
self
.
_
deps
.
app
.
event
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
if
(
self
.
inFocus
&&
self
.
inFocus
!==
tabName
)
{
if
(
self
.
inFocus
&&
self
.
inFocus
!==
tabName
)
{
// trigger unfocus
// trigger unfocus
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
...
@@ -119,7 +126,7 @@ module.exports = class PluginManager {
...
@@ -119,7 +126,7 @@ module.exports = class PluginManager {
action
:
'notification'
,
action
:
'notification'
,
key
:
'compiler'
,
key
:
'compiler'
,
type
:
'compilationData'
,
type
:
'compilationData'
,
value
:
[
api
.
compiler
.
getCompilationResult
()]
value
:
[
self
.
_deps
.
compiler
.
getCompilationResult
()]
}))
}))
}
}
})
})
...
@@ -142,7 +149,7 @@ module.exports = class PluginManager {
...
@@ -142,7 +149,7 @@ module.exports = class PluginManager {
data
.
value
.
push
((
error
,
result
)
=>
{
data
.
value
.
push
((
error
,
result
)
=>
{
response
(
data
.
key
,
data
.
type
,
data
.
id
,
error
,
result
)
response
(
data
.
key
,
data
.
type
,
data
.
id
,
error
,
result
)
})
})
api
[
data
.
key
][
data
.
type
].
apply
({},
data
.
value
)
self
.
_components
.
pluginAPI
[
data
.
key
][
data
.
type
].
apply
({},
data
.
value
)
}
}
}
}
},
false
)
},
false
)
...
...
src/app/tabs/analysis-tab.js
View file @
0026c316
...
@@ -2,17 +2,17 @@ var yo = require('yo-yo')
...
@@ -2,17 +2,17 @@ var yo = require('yo-yo')
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
module
.
exports
=
class
AnalysisTab
{
module
.
exports
=
class
AnalysisTab
{
constructor
(
opts
=
{
api
:
{},
events
:
{}
}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_api
=
opts
.
api
self
.
_events
=
opts
.
events
self
.
_view
=
{
el
:
null
}
self
.
_view
=
{
el
:
null
}
self
.
data
=
{}
self
.
data
=
{}
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
}
}
render
()
{
render
()
{
const
self
=
this
const
self
=
this
...
...
src/app/tabs/compile-tab.js
View file @
0026c316
...
@@ -2,6 +2,7 @@ const yo = require('yo-yo')
...
@@ -2,6 +2,7 @@ const yo = require('yo-yo')
const
csjs
=
require
(
'csjs-inject'
)
const
csjs
=
require
(
'csjs-inject'
)
const
copy
=
require
(
'clipboard-copy'
)
const
copy
=
require
(
'clipboard-copy'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
const
TreeView
=
require
(
'../ui/TreeView'
)
const
TreeView
=
require
(
'../ui/TreeView'
)
const
modalDialog
=
require
(
'../ui/modaldialog'
)
const
modalDialog
=
require
(
'../ui/modaldialog'
)
const
copyToClipboard
=
require
(
'../ui/copy-to-clipboard'
)
const
copyToClipboard
=
require
(
'../ui/copy-to-clipboard'
)
...
@@ -14,11 +15,8 @@ const addTooltip = require('../ui/tooltip')
...
@@ -14,11 +15,8 @@ const addTooltip = require('../ui/tooltip')
const
styles
=
styleGuide
.
chooser
()
const
styles
=
styleGuide
.
chooser
()
module
.
exports
=
class
CompileTab
{
module
.
exports
=
class
CompileTab
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
_opts
=
opts
self
.
_api
=
api
self
.
_events
=
events
self
.
_view
=
{
self
.
_view
=
{
el
:
null
,
el
:
null
,
autoCompile
:
null
,
autoCompile
:
null
,
...
@@ -30,22 +28,36 @@ module.exports = class CompileTab {
...
@@ -30,22 +28,36 @@ module.exports = class CompileTab {
contractNames
:
null
,
contractNames
:
null
,
contractEl
:
null
contractEl
:
null
}
}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
// dependencies
self
.
_deps
=
{
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
,
udapp
:
self
.
_components
.
registry
.
get
(
'udapp'
).
api
,
udappUI
:
self
.
_components
.
registry
.
get
(
'udappUI'
).
api
,
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
staticAnalysis
:
self
.
_components
.
registry
.
get
(
'staticanalysis'
).
api
,
renderer
:
self
.
_components
.
registry
.
get
(
'renderer'
).
api
,
transactionContextAPI
:
self
.
_components
.
registry
.
get
(
'transactionContextAPI'
).
api
}
self
.
data
=
{
self
.
data
=
{
hideWarnings
:
self
.
_
opt
s
.
config
.
get
(
'hideWarnings'
)
||
false
,
hideWarnings
:
self
.
_
dep
s
.
config
.
get
(
'hideWarnings'
)
||
false
,
autoCompile
:
self
.
_
opt
s
.
config
.
get
(
'autoCompile'
),
autoCompile
:
self
.
_
dep
s
.
config
.
get
(
'autoCompile'
),
compileTimeout
:
null
,
compileTimeout
:
null
,
contractsDetails
:
{},
contractsDetails
:
{},
maxTime
:
1000
,
maxTime
:
1000
,
timeout
:
300
timeout
:
300
}
}
self
.
_
events
.
editor
.
register
(
'contentChanged'
,
scheduleCompilation
)
self
.
_
deps
.
editor
.
event
.
register
(
'contentChanged'
,
scheduleCompilation
)
self
.
_
events
.
editor
.
register
(
'sessionSwitched'
,
scheduleCompilation
)
self
.
_
deps
.
editor
.
event
.
register
(
'sessionSwitched'
,
scheduleCompilation
)
function
scheduleCompilation
()
{
function
scheduleCompilation
()
{
if
(
!
self
.
_
opt
s
.
config
.
get
(
'autoCompile'
))
return
if
(
!
self
.
_
dep
s
.
config
.
get
(
'autoCompile'
))
return
if
(
self
.
data
.
compileTimeout
)
window
.
clearTimeout
(
self
.
data
.
compileTimeout
)
if
(
self
.
data
.
compileTimeout
)
window
.
clearTimeout
(
self
.
data
.
compileTimeout
)
self
.
data
.
compileTimeout
=
window
.
setTimeout
(()
=>
self
.
_
api
.
runCompiler
(),
self
.
data
.
timeout
)
self
.
data
.
compileTimeout
=
window
.
setTimeout
(()
=>
self
.
_
deps
.
app
.
runCompiler
(),
self
.
data
.
timeout
)
}
}
self
.
_
events
.
compiler
.
register
(
'compilationDuration'
,
function
tabHighlighting
(
speed
)
{
self
.
_
deps
.
compiler
.
event
.
register
(
'compilationDuration'
,
function
tabHighlighting
(
speed
)
{
if
(
!
self
.
_view
.
warnCompilationSlow
)
return
if
(
!
self
.
_view
.
warnCompilationSlow
)
return
if
(
speed
>
self
.
data
.
maxTime
)
{
if
(
speed
>
self
.
data
.
maxTime
)
{
const
msg
=
`Last compilation took
${
speed
}
ms. We suggest to turn off autocompilation.`
const
msg
=
`Last compilation took
${
speed
}
ms. We suggest to turn off autocompilation.`
...
@@ -55,31 +67,31 @@ module.exports = class CompileTab {
...
@@ -55,31 +67,31 @@ module.exports = class CompileTab {
self
.
_view
.
warnCompilationSlow
.
style
.
display
=
'none'
self
.
_view
.
warnCompilationSlow
.
style
.
display
=
'none'
}
}
})
})
self
.
_
events
.
editor
.
register
(
'contentChanged'
,
function
changedFile
()
{
self
.
_
deps
.
editor
.
event
.
register
(
'contentChanged'
,
function
changedFile
()
{
if
(
!
self
.
_view
.
compileIcon
)
return
if
(
!
self
.
_view
.
compileIcon
)
return
const
compileTab
=
document
.
querySelector
(
'.compileView'
)
// @TODO: compileView tab
const
compileTab
=
document
.
querySelector
(
'.compileView'
)
// @TODO: compileView tab
compileTab
.
style
.
color
=
styles
.
colors
.
red
// @TODO: compileView tab
compileTab
.
style
.
color
=
styles
.
colors
.
red
// @TODO: compileView tab
self
.
_view
.
compileIcon
.
classList
.
add
(
`
${
css
.
bouncingIcon
}
`
)
// @TODO: compileView tab
self
.
_view
.
compileIcon
.
classList
.
add
(
`
${
css
.
bouncingIcon
}
`
)
// @TODO: compileView tab
})
})
self
.
_
events
.
compiler
.
register
(
'loadingCompiler'
,
function
start
()
{
self
.
_
deps
.
compiler
.
event
.
register
(
'loadingCompiler'
,
function
start
()
{
if
(
!
self
.
_view
.
compileIcon
)
return
if
(
!
self
.
_view
.
compileIcon
)
return
self
.
_view
.
compileIcon
.
classList
.
add
(
`
${
css
.
spinningIcon
}
`
)
self
.
_view
.
compileIcon
.
classList
.
add
(
`
${
css
.
spinningIcon
}
`
)
self
.
_view
.
warnCompilationSlow
.
style
.
display
=
'none'
self
.
_view
.
warnCompilationSlow
.
style
.
display
=
'none'
self
.
_view
.
compileIcon
.
setAttribute
(
'title'
,
'compiler is loading, please wait a few moments.'
)
self
.
_view
.
compileIcon
.
setAttribute
(
'title'
,
'compiler is loading, please wait a few moments.'
)
})
})
self
.
_
events
.
compiler
.
register
(
'compilationStarted'
,
function
start
()
{
self
.
_
deps
.
compiler
.
event
.
register
(
'compilationStarted'
,
function
start
()
{
if
(
!
self
.
_view
.
compileIcon
)
return
if
(
!
self
.
_view
.
compileIcon
)
return
self
.
_view
.
errorContainer
.
innerHTML
=
''
self
.
_view
.
errorContainer
.
innerHTML
=
''
self
.
_view
.
compileIcon
.
classList
.
remove
(
`
${
css
.
bouncingIcon
}
`
)
self
.
_view
.
compileIcon
.
classList
.
remove
(
`
${
css
.
bouncingIcon
}
`
)
self
.
_view
.
compileIcon
.
classList
.
add
(
`
${
css
.
spinningIcon
}
`
)
self
.
_view
.
compileIcon
.
classList
.
add
(
`
${
css
.
spinningIcon
}
`
)
self
.
_view
.
compileIcon
.
setAttribute
(
'title'
,
'compiling...'
)
self
.
_view
.
compileIcon
.
setAttribute
(
'title'
,
'compiling...'
)
})
})
self
.
_
events
.
compiler
.
register
(
'compilerLoaded'
,
function
loaded
()
{
self
.
_
deps
.
compiler
.
event
.
register
(
'compilerLoaded'
,
function
loaded
()
{
if
(
!
self
.
_view
.
compileIcon
)
return
if
(
!
self
.
_view
.
compileIcon
)
return
self
.
_view
.
compileIcon
.
classList
.
remove
(
`
${
css
.
spinningIcon
}
`
)
self
.
_view
.
compileIcon
.
classList
.
remove
(
`
${
css
.
spinningIcon
}
`
)
self
.
_view
.
compileIcon
.
setAttribute
(
'title'
,
''
)
self
.
_view
.
compileIcon
.
setAttribute
(
'title'
,
''
)
})
})
self
.
_
events
.
compiler
.
register
(
'compilationFinished'
,
function
finish
(
success
,
data
,
source
)
{
self
.
_
deps
.
compiler
.
event
.
register
(
'compilationFinished'
,
function
finish
(
success
,
data
,
source
)
{
if
(
self
.
_view
.
compileIcon
)
{
if
(
self
.
_view
.
compileIcon
)
{
const
compileTab
=
document
.
querySelector
(
'.compileView'
)
const
compileTab
=
document
.
querySelector
(
'.compileView'
)
compileTab
.
style
.
color
=
styles
.
colors
.
black
compileTab
.
style
.
color
=
styles
.
colors
.
black
...
@@ -94,15 +106,17 @@ module.exports = class CompileTab {
...
@@ -94,15 +106,17 @@ module.exports = class CompileTab {
self
.
_view
.
contractNames
.
innerHTML
=
''
self
.
_view
.
contractNames
.
innerHTML
=
''
if
(
success
)
{
if
(
success
)
{
self
.
_view
.
contractNames
.
removeAttribute
(
'disabled'
)
self
.
_view
.
contractNames
.
removeAttribute
(
'disabled'
)
self
.
_
opt
s
.
compiler
.
visitContracts
(
contract
=>
{
self
.
_
dep
s
.
compiler
.
visitContracts
(
contract
=>
{
self
.
data
.
contractsDetails
[
contract
.
name
]
=
parseContracts
(
contract
.
name
,
contract
.
object
,
self
.
_
opt
s
.
compiler
.
getSource
(
contract
.
file
))
self
.
data
.
contractsDetails
[
contract
.
name
]
=
parseContracts
(
contract
.
name
,
contract
.
object
,
self
.
_
dep
s
.
compiler
.
getSource
(
contract
.
file
))
var
contractName
=
yo
`<option>
${
contract
.
name
}
</option>`
var
contractName
=
yo
`<option>
${
contract
.
name
}
</option>`
self
.
_view
.
contractNames
.
appendChild
(
contractName
)
self
.
_view
.
contractNames
.
appendChild
(
contractName
)
})
})
self
.
_api
.
resetDapp
(
self
.
data
.
contractsDetails
)
self
.
_deps
.
udapp
.
reset
(
self
.
data
.
contractsDetails
,
self
.
_deps
.
transactionContextAPI
)
self
.
_deps
.
udappUI
.
reset
()
}
else
{
}
else
{
self
.
_view
.
contractNames
.
setAttribute
(
'disabled'
,
true
)
self
.
_view
.
contractNames
.
setAttribute
(
'disabled'
,
true
)
self
.
_api
.
resetDapp
({})
self
.
_deps
.
udapp
.
reset
({},
self
.
_deps
.
transactionContextAPI
)
self
.
_deps
.
udappUI
.
reset
()
}
}
// hightlight the tab if error
// hightlight the tab if error
if
(
success
)
document
.
querySelector
(
'.compileView'
).
style
.
color
=
''
// @TODO: compileView tab
if
(
success
)
document
.
querySelector
(
'.compileView'
).
style
.
color
=
''
// @TODO: compileView tab
...
@@ -111,31 +125,31 @@ module.exports = class CompileTab {
...
@@ -111,31 +125,31 @@ module.exports = class CompileTab {
var
error
=
false
var
error
=
false
if
(
data
[
'error'
])
{
if
(
data
[
'error'
])
{
error
=
true
error
=
true
self
.
_
opt
s
.
renderer
.
error
(
data
[
'error'
].
formattedMessage
,
self
.
_view
.
errorContainer
,
{
type
:
data
[
'error'
].
severity
})
self
.
_
dep
s
.
renderer
.
error
(
data
[
'error'
].
formattedMessage
,
self
.
_view
.
errorContainer
,
{
type
:
data
[
'error'
].
severity
})
}
}
if
(
data
.
errors
&&
data
.
errors
.
length
)
{
if
(
data
.
errors
&&
data
.
errors
.
length
)
{
error
=
true
error
=
true
data
.
errors
.
forEach
(
function
(
err
)
{
data
.
errors
.
forEach
(
function
(
err
)
{
if
(
self
.
_
opt
s
.
config
.
get
(
'hideWarnings'
))
{
if
(
self
.
_
dep
s
.
config
.
get
(
'hideWarnings'
))
{
if
(
err
.
severity
!==
'warning'
)
{
if
(
err
.
severity
!==
'warning'
)
{
self
.
_
opt
s
.
renderer
.
error
(
err
.
formattedMessage
,
self
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
self
.
_
dep
s
.
renderer
.
error
(
err
.
formattedMessage
,
self
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
}
}
}
else
{
}
else
{
self
.
_
opt
s
.
renderer
.
error
(
err
.
formattedMessage
,
self
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
self
.
_
dep
s
.
renderer
.
error
(
err
.
formattedMessage
,
self
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
}
}
})
})
}
}
if
(
!
error
&&
data
.
contracts
)
{
if
(
!
error
&&
data
.
contracts
)
{
self
.
_
opt
s
.
compiler
.
visitContracts
((
contract
)
=>
{
self
.
_
dep
s
.
compiler
.
visitContracts
((
contract
)
=>
{
self
.
_
opt
s
.
renderer
.
error
(
contract
.
name
,
self
.
_view
.
errorContainer
,
{
type
:
'success'
})
self
.
_
dep
s
.
renderer
.
error
(
contract
.
name
,
self
.
_view
.
errorContainer
,
{
type
:
'success'
})
})
})
}
}
})
})
self
.
_
events
.
staticAnalysis
.
register
(
'staticAnaysisWarning'
,
(
count
)
=>
{
self
.
_
deps
.
staticAnalysis
.
event
.
register
(
'staticAnaysisWarning'
,
(
count
)
=>
{
if
(
count
)
{
if
(
count
)
{
const
msg
=
`Static Analysis raised
${
count
}
warning(s) that requires your attention. Click here to show the warning(s).`
const
msg
=
`Static Analysis raised
${
count
}
warning(s) that requires your attention. Click here to show the warning(s).`
const
settings
=
{
type
:
'staticAnalysisWarning'
,
click
:
()
=>
self
.
_api
.
switchTab
(
'staticanalysisView'
),
useSpan
:
true
}
const
settings
=
{
type
:
'staticAnalysisWarning'
,
click
:
()
=>
self
.
_api
.
switchTab
(
'staticanalysisView'
),
useSpan
:
true
}
self
.
_
opt
s
.
renderer
.
error
(
msg
,
self
.
_view
.
errorContainer
,
settings
)
self
.
_
dep
s
.
renderer
.
error
(
msg
,
self
.
_view
.
errorContainer
,
settings
)
}
}
})
})
}
}
...
@@ -202,8 +216,8 @@ module.exports = class CompileTab {
...
@@ -202,8 +216,8 @@ module.exports = class CompileTab {
'swarmLocation'
:
'Swarm url where all metadata information can be found (contract needs to be published first)'
,
'swarmLocation'
:
'Swarm url where all metadata information can be found (contract needs to be published first)'
,
'web3Deploy'
:
'Copy/paste this code to any JavaScript/Web3 console to deploy this contract'
'web3Deploy'
:
'Copy/paste this code to any JavaScript/Web3 console to deploy this contract'
}
}
function
updateAutoCompile
(
event
)
{
self
.
_
opt
s
.
config
.
set
(
'autoCompile'
,
self
.
_view
.
autoCompile
.
checked
)
}
function
updateAutoCompile
(
event
)
{
self
.
_
dep
s
.
config
.
set
(
'autoCompile'
,
self
.
_view
.
autoCompile
.
checked
)
}
function
compile
(
event
)
{
self
.
_
api
.
runCompiler
()
}
function
compile
(
event
)
{
self
.
_
deps
.
app
.
runCompiler
()
}
function
hideWarnings
(
event
)
{
function
hideWarnings
(
event
)
{
self
.
_opts
.
config
.
set
(
'hideWarnings'
,
self
.
_view
.
hideWarningsBox
.
checked
)
self
.
_opts
.
config
.
set
(
'hideWarnings'
,
self
.
_view
.
hideWarningsBox
.
checked
)
self
.
_api
.
runCompiler
()
self
.
_api
.
runCompiler
()
...
...
src/app/tabs/debugger-tab.js
View file @
0026c316
...
@@ -2,18 +2,18 @@ var yo = require('yo-yo')
...
@@ -2,18 +2,18 @@ var yo = require('yo-yo')
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
var
styles
=
require
(
'../ui/styles-guide/theme-chooser'
).
chooser
()
var
styles
=
require
(
'../ui/styles-guide/theme-chooser'
).
chooser
()
module
.
exports
=
class
DebuggerTab
{
module
.
exports
=
class
DebuggerTab
{
constructor
(
opts
=
{
api
:
{},
events
:
{}
}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_api
=
opts
.
api
self
.
_events
=
opts
.
events
self
.
_view
=
{
el
:
null
}
self
.
_view
=
{
el
:
null
}
self
.
data
=
{}
self
.
data
=
{}
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
}
}
render
()
{
render
()
{
const
self
=
this
const
self
=
this
...
...
src/app/tabs/plugin-tab.js
View file @
0026c316
...
@@ -2,17 +2,16 @@ var yo = require('yo-yo')
...
@@ -2,17 +2,16 @@ var yo = require('yo-yo')
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
module
.
exports
=
class
plugintab
{
module
.
exports
=
class
plugintab
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_opts
=
opts
self
.
_api
=
api
self
.
_events
=
events
self
.
_view
=
{
el
:
null
}
self
.
_view
=
{
el
:
null
}
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
}
}
render
()
{
render
()
{
const
self
=
this
const
self
=
this
...
...
src/app/tabs/run-tab.js
View file @
0026c316
This diff is collapsed.
Click to expand it.
src/app/tabs/settings-tab.js
View file @
0026c316
...
@@ -3,6 +3,8 @@ var yo = require('yo-yo')
...
@@ -3,6 +3,8 @@ var yo = require('yo-yo')
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
minixhr
=
require
(
'minixhr'
)
var
minixhr
=
require
(
'minixhr'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
QueryParams
=
require
(
'../../lib/query-params'
)
var
QueryParams
=
require
(
'../../lib/query-params'
)
var
helper
=
require
(
'../../lib/helper'
)
var
helper
=
require
(
'../../lib/helper'
)
var
modal
=
require
(
'../ui/modal-dialog-custom'
)
var
modal
=
require
(
'../ui/modal-dialog-custom'
)
...
@@ -15,12 +17,20 @@ var Storage = remixLib.Storage
...
@@ -15,12 +17,20 @@ var Storage = remixLib.Storage
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
module
.
exports
=
class
SettingsTab
{
module
.
exports
=
class
SettingsTab
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
_opts
=
opts
self
.
_api
=
api
self
.
_events
=
events
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
// dependencies
self
.
_deps
=
{
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
udapp
:
self
.
_components
.
registry
.
get
(
'udapp'
).
api
,
udappUI
:
self
.
_components
.
registry
.
get
(
'udappUI'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
editorPanel
:
self
.
_components
.
registry
.
get
(
'editorpanel'
).
api
,
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
}
self
.
_view
=
{
/* eslint-disable */
self
.
_view
=
{
/* eslint-disable */
el
:
null
,
el
:
null
,
optionVM
:
null
,
personal
:
null
,
optimize
:
null
,
warnPersonalMode
:
null
,
optionVM
:
null
,
personal
:
null
,
optimize
:
null
,
warnPersonalMode
:
null
,
...
@@ -41,9 +51,10 @@ module.exports = class SettingsTab {
...
@@ -41,9 +51,10 @@ module.exports = class SettingsTab {
self
.
_components
.
themeStorage
=
new
Storage
(
'style:'
)
self
.
_components
.
themeStorage
=
new
Storage
(
'style:'
)
self
.
data
.
optimize
=
!!
self
.
_components
.
queryParams
.
get
().
optimize
self
.
data
.
optimize
=
!!
self
.
_components
.
queryParams
.
get
().
optimize
self
.
_components
.
queryParams
.
update
({
optimize
:
self
.
data
.
optimize
})
self
.
_components
.
queryParams
.
update
({
optimize
:
self
.
data
.
optimize
})
self
.
_
api
.
setOptimize
(
self
.
data
.
optimize
,
fals
e
)
self
.
_
deps
.
compiler
.
setOptimize
(
self
.
data
.
optimiz
e
)
self
.
data
.
currentTheme
=
self
.
_components
.
themeStorage
.
get
(
'theme'
)
||
'light'
self
.
data
.
currentTheme
=
self
.
_components
.
themeStorage
.
get
(
'theme'
)
||
'light'
self
.
_events
.
compiler
.
register
(
'compilerLoaded'
,
(
version
)
=>
self
.
setVersionText
(
version
))
self
.
_deps
.
compiler
.
event
.
register
(
'compilerLoaded'
,
(
version
)
=>
self
.
setVersionText
(
version
))
self
.
fetchAllVersion
((
allversions
,
selectedVersion
)
=>
{
self
.
fetchAllVersion
((
allversions
,
selectedVersion
)
=>
{
self
.
data
.
allversions
=
allversions
self
.
data
.
allversions
=
allversions
self
.
data
.
selectedVersion
=
selectedVersion
self
.
data
.
selectedVersion
=
selectedVersion
...
@@ -56,16 +67,16 @@ module.exports = class SettingsTab {
...
@@ -56,16 +67,16 @@ module.exports = class SettingsTab {
// Gist settings
// Gist settings
var
gistAccessToken
=
yo
`<input id="gistaccesstoken" type="password">`
var
gistAccessToken
=
yo
`<input id="gistaccesstoken" type="password">`
var
token
=
self
.
_
opt
s
.
config
.
get
(
'settings/gist-access-token'
)
var
token
=
self
.
_
dep
s
.
config
.
get
(
'settings/gist-access-token'
)
if
(
token
)
gistAccessToken
.
value
=
token
if
(
token
)
gistAccessToken
.
value
=
token
var
gistAddToken
=
yo
`<input class="
${
css
.
savegisttoken
}
" id="savegisttoken" onclick=
${()
=>
{
self
.
_
opt
s
.
config
.
set
(
'settings/gist-access-token'
,
gistAccessToken
.
value
);
tooltip
(
'Access token saved'
)
}}
value
=
"Save"
type
=
"button"
>
`
var
gistAddToken
=
yo
`<input class="
${
css
.
savegisttoken
}
" id="savegisttoken" onclick=
${()
=>
{
self
.
_
dep
s
.
config
.
set
(
'settings/gist-access-token'
,
gistAccessToken
.
value
);
tooltip
(
'Access token saved'
)
}}
value
=
"Save"
type
=
"button"
>
`
var gistRemoveToken = yo`
<
input
id
=
"removegisttoken"
onclick
=
$
{()
=>
{
gistAccessToken
.
value
=
''
;
self
.
_
opt
s
.
config
.
set
(
'settings/gist-access-token'
,
''
);
tooltip
(
'Access token removed'
)
}}
value
=
"Remove"
type
=
"button"
>
`
var gistRemoveToken = yo`
<
input
id
=
"removegisttoken"
onclick
=
$
{()
=>
{
gistAccessToken
.
value
=
''
;
self
.
_
dep
s
.
config
.
set
(
'settings/gist-access-token'
,
''
);
tooltip
(
'Access token removed'
)
}}
value
=
"Remove"
type
=
"button"
>
`
self._view.gistToken = yo`
<
div
class
=
"${css.checkboxText}"
>
$
{
gistAccessToken
}${
copyToClipboard
(()
=>
self
.
_
opt
s
.
config
.
get
(
'settings/gist-access-token'
))}${
gistAddToken
}${
gistRemoveToken
}
</div>`
self._view.gistToken = yo`
<
div
class
=
"${css.checkboxText}"
>
$
{
gistAccessToken
}${
copyToClipboard
(()
=>
self
.
_
dep
s
.
config
.
get
(
'settings/gist-access-token'
))}${
gistAddToken
}${
gistRemoveToken
}
</div>`
//
//
self
.
_view
.
optionVM
=
yo
`<input onchange=
${
onchangeOption
}
id="alwaysUseVM" type="checkbox">`
self
.
_view
.
optionVM
=
yo
`<input onchange=
${
onchangeOption
}
id="alwaysUseVM" type="checkbox">`
if
(
self
.
_
opt
s
.
config
.
get
(
'settings/always-use-vm'
))
self
.
_view
.
optionVM
.
setAttribute
(
'checked'
,
''
)
if
(
self
.
_
dep
s
.
config
.
get
(
'settings/always-use-vm'
))
self
.
_view
.
optionVM
.
setAttribute
(
'checked'
,
''
)
self
.
_view
.
personal
=
yo
`<input onchange=
${
onchangePersonal
}
id="personal" type="checkbox">`
self
.
_view
.
personal
=
yo
`<input onchange=
${
onchangePersonal
}
id="personal" type="checkbox">`
if
(
self
.
_
opt
s
.
config
.
get
(
'settings/personal-mode'
))
self
.
_view
.
personal
.
setAttribute
(
'checked'
,
''
)
if
(
self
.
_
dep
s
.
config
.
get
(
'settings/personal-mode'
))
self
.
_view
.
personal
.
setAttribute
(
'checked'
,
''
)
self
.
_view
.
optimize
=
yo
`<input onchange=
${
onchangeOptimize
}
id="optimize" type="checkbox">`
self
.
_view
.
optimize
=
yo
`<input onchange=
${
onchangeOptimize
}
id="optimize" type="checkbox">`
if
(
self
.
data
.
optimize
)
self
.
_view
.
optimize
.
setAttribute
(
'checked'
,
''
)
if
(
self
.
data
.
optimize
)
self
.
_view
.
optimize
.
setAttribute
(
'checked'
,
''
)
var
warnText
=
`Transaction sent over Web3 will use the web3.personal API - be sure the endpoint is opened before enabling it.
var
warnText
=
`Transaction sent over Web3 will use the web3.personal API - be sure the endpoint is opened before enabling it.
...
@@ -187,7 +198,7 @@ module.exports = class SettingsTab {
...
@@ -187,7 +198,7 @@ module.exports = class SettingsTab {
${
self
.
_view
.
config
.
localremixd
}
${
self
.
_view
.
config
.
localremixd
}
</div>`
</div>`
function
onchangeOption
(
event
)
{
function
onchangeOption
(
event
)
{
self
.
_
opts
.
config
.
set
(
'settings/always-use-vm'
,
!
self
.
_opt
s
.
config
.
get
(
'settings/always-use-vm'
))
self
.
_
deps
.
config
.
set
(
'settings/always-use-vm'
,
!
self
.
_dep
s
.
config
.
get
(
'settings/always-use-vm'
))
}
}
function
onloadPlugin
(
event
)
{
function
onloadPlugin
(
event
)
{
try
{
try
{
...
@@ -209,14 +220,15 @@ module.exports = class SettingsTab {
...
@@ -209,14 +220,15 @@ module.exports = class SettingsTab {
function
onchangeOptimize
(
event
)
{
function
onchangeOptimize
(
event
)
{
self
.
data
.
optimize
=
!!
self
.
_view
.
optimize
.
checked
self
.
data
.
optimize
=
!!
self
.
_view
.
optimize
.
checked
self
.
_components
.
queryParams
.
update
({
optimize
:
self
.
data
.
optimize
})
self
.
_components
.
queryParams
.
update
({
optimize
:
self
.
data
.
optimize
})
self
.
_api
.
setOptimize
(
self
.
data
.
optimize
,
true
)
self
.
_deps
.
compiler
.
setOptimize
(
self
.
data
.
optimize
)
self
.
_deps
.
app
.
runCompiler
()
}
}
function
onchangeLoadVersion
(
event
)
{
function
onchangeLoadVersion
(
event
)
{
self
.
data
.
selectedVersion
=
self
.
_view
.
versionSelector
.
value
self
.
data
.
selectedVersion
=
self
.
_view
.
versionSelector
.
value
self
.
_updateVersionSelector
()
self
.
_updateVersionSelector
()
}
}
function
onchangePersonal
(
event
)
{
function
onchangePersonal
(
event
)
{
self
.
_
opts
.
config
.
set
(
'settings/personal-mode'
,
!
self
.
_opt
s
.
config
.
get
(
'settings/personal-mode'
))
self
.
_
deps
.
config
.
set
(
'settings/personal-mode'
,
!
self
.
_dep
s
.
config
.
get
(
'settings/personal-mode'
))
}
}
return
self
.
_view
.
el
return
self
.
_view
.
el
}
}
...
@@ -250,10 +262,10 @@ module.exports = class SettingsTab {
...
@@ -250,10 +262,10 @@ module.exports = class SettingsTab {
// Workers cannot load js on "file:"-URLs and we get a
// Workers cannot load js on "file:"-URLs and we get a
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// resort to non-worker version in that case.
// resort to non-worker version in that case.
self
.
_
opt
s
.
compiler
.
loadVersion
(
true
,
url
)
self
.
_
dep
s
.
compiler
.
loadVersion
(
true
,
url
)
self
.
setVersionText
(
'(loading using worker)'
)
self
.
setVersionText
(
'(loading using worker)'
)
}
else
{
}
else
{
self
.
_
opt
s
.
compiler
.
loadVersion
(
false
,
url
)
self
.
_
dep
s
.
compiler
.
loadVersion
(
false
,
url
)
self
.
setVersionText
(
'(loading)'
)
self
.
setVersionText
(
'(loading)'
)
}
}
}
}
...
...
src/app/tabs/support-tab.js
View file @
0026c316
...
@@ -2,21 +2,25 @@ const yo = require('yo-yo')
...
@@ -2,21 +2,25 @@ const yo = require('yo-yo')
const
csjs
=
require
(
'csjs-inject'
)
const
csjs
=
require
(
'csjs-inject'
)
const
remixLib
=
require
(
'remix-lib'
)
const
remixLib
=
require
(
'remix-lib'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
const
styles
=
require
(
'../ui/styles-guide/theme-chooser'
).
chooser
()
const
styles
=
require
(
'../ui/styles-guide/theme-chooser'
).
chooser
()
const
EventManager
=
remixLib
.
EventManager
const
EventManager
=
remixLib
.
EventManager
module
.
exports
=
class
SupportTab
{
module
.
exports
=
class
SupportTab
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_api
=
api
self
.
_events
=
events
self
.
_opts
=
opts
self
.
_view
=
{
el
:
null
,
gitterIframe
:
''
}
self
.
_view
=
{
el
:
null
,
gitterIframe
:
''
}
self
.
data
=
{
gitterIsLoaded
:
false
}
self
.
data
=
{
gitterIsLoaded
:
false
}
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_events
.
app
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
_deps
=
{
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
}
self
.
_deps
.
app
.
event
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
if
(
tabName
!==
'Support'
||
self
.
data
.
gitterIsLoaded
)
return
if
(
tabName
!==
'Support'
||
self
.
data
.
gitterIsLoaded
)
return
const
iframe
=
yo
`<iframe class="
${
css
.
chatIframe
}
" src='https://gitter.im/ethereum/remix/~embed'>`
const
iframe
=
yo
`<iframe class="
${
css
.
chatIframe
}
" src='https://gitter.im/ethereum/remix/~embed'>`
self
.
_view
.
gitterIframe
.
parentNode
.
replaceChild
(
iframe
,
self
.
_view
.
gitterIframe
)
self
.
_view
.
gitterIframe
.
parentNode
.
replaceChild
(
iframe
,
self
.
_view
.
gitterIframe
)
...
...
src/app/tabs/tabbed-menu.js
View file @
0026c316
...
@@ -2,20 +2,23 @@ var yo = require('yo-yo')
...
@@ -2,20 +2,23 @@ var yo = require('yo-yo')
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
helper
=
require
(
'../../lib/helper'
)
var
helper
=
require
(
'../../lib/helper'
)
var
styles
=
require
(
'../ui/styles-guide/theme-chooser'
).
chooser
()
var
styles
=
require
(
'../ui/styles-guide/theme-chooser'
).
chooser
()
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
module
.
exports
=
class
TabbedMenu
{
module
.
exports
=
class
TabbedMenu
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_opts
=
opts
self
.
_components
=
{}
self
.
_api
=
api
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
_events
=
events
self
.
_deps
=
{
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
}
self
.
_view
=
{
el
:
null
,
viewport
:
null
,
tabs
:
{},
contents
:
{}
}
self
.
_view
=
{
el
:
null
,
viewport
:
null
,
tabs
:
{},
contents
:
{}
}
events
.
app
.
register
(
'debuggingRequested'
,
()
=>
{
self
.
_deps
.
app
.
event
.
register
(
'debuggingRequested'
,
()
=>
{
self
.
selectTabByTitle
(
'Debugger'
)
self
.
selectTabByTitle
(
'Debugger'
)
})
})
}
}
...
@@ -63,7 +66,7 @@ module.exports = class TabbedMenu {
...
@@ -63,7 +66,7 @@ module.exports = class TabbedMenu {
var
title
=
el
.
getAttribute
(
'title'
)
var
title
=
el
.
getAttribute
(
'title'
)
self
.
_view
.
contents
[
el
.
getAttribute
(
'title'
)].
style
.
display
=
'block'
self
.
_view
.
contents
[
el
.
getAttribute
(
'title'
)].
style
.
display
=
'block'
el
.
classList
.
add
(
css
.
active
)
el
.
classList
.
add
(
css
.
active
)
self
.
_
events
.
app
.
trigger
(
'tabChanged'
,
[
title
])
self
.
_
deps
.
app
.
event
.
trigger
(
'tabChanged'
,
[
title
])
}
}
}
}
...
...
src/app/tabs/test-tab.js
View file @
0026c316
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
async
=
require
(
'async'
)
var
async
=
require
(
'async'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
css
=
require
(
'./styles/test-tab-styles'
)
var
css
=
require
(
'./styles/test-tab-styles'
)
var
remixTests
=
require
(
'remix-tests'
)
var
remixTests
=
require
(
'remix-tests'
)
module
.
exports
=
class
TestTab
{
module
.
exports
=
class
TestTab
{
constructor
(
api
=
{},
events
=
{},
opts
=
{}
)
{
constructor
(
localRegistry
)
{
const
self
=
this
const
self
=
this
self
.
_opts
=
opts
self
.
_api
=
api
self
.
_events
=
events
self
.
_view
=
{
el
:
null
}
self
.
_view
=
{
el
:
null
}
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
// dependencies
self
.
_deps
=
{
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
}
self
.
data
=
{}
self
.
data
=
{}
self
.
_view
.
el
=
self
.
render
()
self
.
_view
.
el
=
self
.
render
()
self
.
_deps
.
app
.
event
.
register
(
'tabChanged'
,
tabName
=>
{
events
.
app
.
register
(
'tabChanged'
,
tabName
=>
{
if
(
tabName
!==
'test'
)
return
if
(
tabName
!==
'test'
)
return
yo
.
update
(
self
.
_view
.
el
,
self
.
render
())
yo
.
update
(
self
.
_view
.
el
,
self
.
render
())
self
.
_view
.
el
.
style
.
display
=
'block'
self
.
_view
.
el
.
style
.
display
=
'block'
...
@@ -24,8 +27,6 @@ module.exports = class TestTab {
...
@@ -24,8 +27,6 @@ module.exports = class TestTab {
return
{
render
()
{
return
self
.
_view
.
el
}
}
return
{
render
()
{
return
self
.
_view
.
el
}
}
}
}
render
()
{
render
()
{
const
self
=
this
const
api
=
self
.
_api
var
container
=
yo
`<div class="tests" id="tests"></div>`
var
container
=
yo
`<div class="tests" id="tests"></div>`
function
append
(
container
,
txt
)
{
function
append
(
container
,
txt
)
{
...
@@ -67,7 +68,7 @@ module.exports = class TestTab {
...
@@ -67,7 +68,7 @@ module.exports = class TestTab {
}
}
function
runTest
(
testFilePath
,
callback
)
{
function
runTest
(
testFilePath
,
callback
)
{
var
provider
=
api
.
fileProviderOf
(
testFilePath
)
var
provider
=
this
.
_deps
.
fileManager
.
fileProviderOf
(
testFilePath
)
provider
.
get
(
testFilePath
,
(
error
,
content
)
=>
{
provider
.
get
(
testFilePath
,
(
error
,
content
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
var
runningTest
=
{}
var
runningTest
=
{}
...
@@ -75,16 +76,16 @@ module.exports = class TestTab {
...
@@ -75,16 +76,16 @@ module.exports = class TestTab {
remixTests
.
runTestSources
(
runningTest
,
testCallback
,
resultsCallback
,
(
error
,
result
)
=>
{
remixTests
.
runTestSources
(
runningTest
,
testCallback
,
resultsCallback
,
(
error
,
result
)
=>
{
updateFinalResult
(
error
,
result
)
updateFinalResult
(
error
,
result
)
callback
(
error
)
callback
(
error
)
},
api
.
importFileCb
)
},
this
.
_deps
.
fileManager
.
importFileCb
)
}
}
})
})
}
}
let
runTests
=
function
()
{
let
runTests
=
function
()
{
container
.
innerHTML
=
''
container
.
innerHTML
=
''
var
path
=
api
.
currentPath
()
var
path
=
this
.
_deps
.
fileManager
.
currentPath
()
var
tests
=
[]
var
tests
=
[]
api
.
filesFromPath
(
path
,
(
error
,
files
)
=>
{
this
.
_deps
.
fileManager
.
filesFromPath
(
path
,
(
error
,
files
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
for
(
var
file
in
files
)
{
for
(
var
file
in
files
)
{
if
(
/.
(
_test.sol
)
$/
.
exec
(
file
))
tests
.
push
(
path
+
file
)
if
(
/.
(
_test.sol
)
$/
.
exec
(
file
))
tests
.
push
(
path
+
file
)
...
...
src/recorder.js
View file @
0026c316
...
@@ -13,9 +13,9 @@ var modal = require('./app/ui/modal-dialog-custom')
...
@@ -13,9 +13,9 @@ var modal = require('./app/ui/modal-dialog-custom')
*
*
*/
*/
class
Recorder
{
class
Recorder
{
constructor
(
compiler
,
udapp
,
opts
=
{})
{
constructor
(
compiler
,
udapp
,
logMessageCallback
,
opts
=
{})
{
var
self
=
this
var
self
=
this
self
.
_api
=
opts
.
api
self
.
logMessageCallback
=
logMessageCallback
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
data
=
{
_listen
:
true
,
_replay
:
false
,
journal
:
[],
_createdContracts
:
{},
_createdContractsReverse
:
{},
_usedAccounts
:
{},
_abis
:
{},
_contractABIReferences
:
{},
_linkReferences
:
{}
}
self
.
data
=
{
_listen
:
true
,
_replay
:
false
,
journal
:
[],
_createdContracts
:
{},
_createdContractsReverse
:
{},
_usedAccounts
:
{},
_abis
:
{},
_contractABIReferences
:
{},
_linkReferences
:
{}
}
opts
.
events
.
executioncontext
.
register
(
'contextChanged'
,
()
=>
{
opts
.
events
.
executioncontext
.
register
(
'contextChanged'
,
()
=>
{
...
@@ -184,7 +184,7 @@ class Recorder {
...
@@ -184,7 +184,7 @@ class Recorder {
run
(
records
,
accounts
,
options
,
abis
,
linkReferences
,
udapp
,
newContractFn
)
{
run
(
records
,
accounts
,
options
,
abis
,
linkReferences
,
udapp
,
newContractFn
)
{
var
self
=
this
var
self
=
this
self
.
setListen
(
false
)
self
.
setListen
(
false
)
self
.
_api
.
logMessage
(
`Running
${
records
.
length
}
transaction(s) ...`
)
self
.
logMessageCallback
(
`Running
${
records
.
length
}
transaction(s) ...`
)
async
.
eachOfSeries
(
records
,
function
(
tx
,
index
,
cb
)
{
async
.
eachOfSeries
(
records
,
function
(
tx
,
index
,
cb
)
{
var
record
=
self
.
resolveAddress
(
tx
.
record
,
accounts
,
options
)
var
record
=
self
.
resolveAddress
(
tx
.
record
,
accounts
,
options
)
var
abi
=
abis
[
tx
.
record
.
abi
]
var
abi
=
abis
[
tx
.
record
.
abi
]
...
@@ -241,14 +241,14 @@ class Recorder {
...
@@ -241,14 +241,14 @@ class Recorder {
cb
(
data
.
error
)
cb
(
data
.
error
)
return
return
}
else
{
}
else
{
self
.
_api
.
logMessage
(
`(
${
index
}
)
${
JSON
.
stringify
(
record
,
null
,
'
\
t'
)}
`
)
self
.
logMessageCallback
(
`(
${
index
}
)
${
JSON
.
stringify
(
record
,
null
,
'
\
t'
)}
`
)
self
.
_api
.
logMessage
(
`(
${
index
}
) data:
${
data
.
data
}
`
)
self
.
logMessageCallback
(
`(
${
index
}
) data:
${
data
.
data
}
`
)
record
.
data
=
{
dataHex
:
data
.
data
,
funArgs
:
tx
.
record
.
parameters
,
funAbi
:
fnABI
,
contractBytecode
:
tx
.
record
.
bytecode
,
contractName
:
tx
.
record
.
contractName
}
record
.
data
=
{
dataHex
:
data
.
data
,
funArgs
:
tx
.
record
.
parameters
,
funAbi
:
fnABI
,
contractBytecode
:
tx
.
record
.
bytecode
,
contractName
:
tx
.
record
.
contractName
}
}
}
udapp
.
runTx
(
record
,
function
(
err
,
txResult
)
{
udapp
.
runTx
(
record
,
function
(
err
,
txResult
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
)
console
.
error
(
err
)
self
.
_api
.
logMessage
(
err
+
'. Execution failed at '
+
index
)
self
.
logMessageCallback
(
err
+
'. Execution failed at '
+
index
)
}
else
{
}
else
{
var
address
=
executionContext
.
isVM
()
?
txResult
.
result
.
createdAddress
:
txResult
.
result
.
contractAddress
var
address
=
executionContext
.
isVM
()
?
txResult
.
result
.
createdAddress
:
txResult
.
result
.
contractAddress
if
(
address
)
{
if
(
address
)
{
...
...
src/universal-dapp.js
View file @
0026c316
...
@@ -148,6 +148,17 @@ UniversalDApp.prototype.getBalance = function (address, cb) {
...
@@ -148,6 +148,17 @@ UniversalDApp.prototype.getBalance = function (address, cb) {
}
}
}
}
UniversalDApp
.
prototype
.
getBalanceInEther
=
function
(
address
,
callback
)
{
var
self
=
this
self
.
getBalance
(
address
,
(
error
,
balance
)
=>
{
if
(
error
)
{
callback
(
error
)
}
else
{
callback
(
null
,
executionContext
.
web3
().
fromWei
(
balance
,
'ether'
))
}
})
}
UniversalDApp
.
prototype
.
pendingTransactions
=
function
()
{
UniversalDApp
.
prototype
.
pendingTransactions
=
function
()
{
return
this
.
txRunner
.
pendingTxs
return
this
.
txRunner
.
pendingTxs
}
}
...
...
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