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
e7cba12d
Commit
e7cba12d
authored
Dec 18, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instanciate PluginManager in app.js and use it for compilation notification
parent
12c41cb9
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
60 deletions
+44
-60
app.js
src/app.js
+17
-0
contextualListener.js
src/app/editor/contextualListener.js
+2
-3
compiler-metadata.js
src/app/files/compiler-metadata.js
+5
-5
editor-panel.js
src/app/panels/editor-panel.js
+8
-6
file-panel.js
src/app/panels/file-panel.js
+2
-5
pluginManager.js
src/app/plugin/pluginManager.js
+7
-41
compile-tab.js
src/app/tabs/compile-tab.js
+3
-0
No files found.
src/app.js
View file @
e7cba12d
...
@@ -362,6 +362,23 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -362,6 +362,23 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
var
fileManager
=
self
.
_components
.
fileManager
var
fileManager
=
self
.
_components
.
fileManager
registry
.
put
({
api
:
fileManager
,
name
:
'filemanager'
})
registry
.
put
({
api
:
fileManager
,
name
:
'filemanager'
})
// ---------------- Plugin Manager -------------------------------
let
pluginManager
=
new
PluginManager
(
self
,
self
.
_components
.
compilersArtefacts
,
txlistener
,
self
.
_components
.
fileProviders
,
self
.
_components
.
fileManager
,
udapp
)
registry
.
put
({
api
:
pluginManager
,
name
:
'pluginmanager'
})
pluginManager
.
event
.
register
(
'sendCompilationResult'
,
(
file
,
source
,
languageVersion
,
data
)
=>
{
// TODO check whether the tab is configured
let
compiler
=
new
CompilerAbstract
(
languageVersion
,
data
,
source
)
self
.
_components
.
compilersArtefacts
[
'__last'
]
=
compiler
})
self
.
_components
.
editorpanel
.
init
()
self
.
_components
.
editorpanel
.
init
()
self
.
_components
.
fileManager
.
init
()
self
.
_components
.
fileManager
.
init
()
...
...
src/app/editor/contextualListener.js
View file @
e7cba12d
...
@@ -15,6 +15,7 @@ class ContextualListener {
...
@@ -15,6 +15,7 @@ class ContextualListener {
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
editor
=
opts
.
editor
self
.
editor
=
opts
.
editor
self
.
pluginManager
=
opts
.
pluginManager
self
.
_deps
=
{
self
.
_deps
=
{
compilersArtefacts
:
self
.
_components
.
registry
.
get
(
'compilersartefacts'
).
api
,
compilersArtefacts
:
self
.
_components
.
registry
.
get
(
'compilersartefacts'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
...
@@ -26,15 +27,13 @@ class ContextualListener {
...
@@ -26,15 +27,13 @@ class ContextualListener {
}
}
this
.
_activeHighlights
=
[]
this
.
_activeHighlights
=
[]
self
.
_deps
.
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
self
.
pluginManager
.
event
.
register
(
'sendCompilationResult'
,
(
file
,
source
,
languageVersion
,
data
)
=>
{
this
.
_stopHighlighting
()
this
.
_stopHighlighting
()
this
.
_index
=
{
this
.
_index
=
{
Declarations
:
{},
Declarations
:
{},
FlatReferences
:
{}
FlatReferences
:
{}
}
}
if
(
success
)
{
this
.
_buildIndex
(
data
,
source
)
this
.
_buildIndex
(
data
,
source
)
}
})
})
self
.
editor
.
event
.
register
(
'contentChanged'
,
()
=>
{
this
.
_stopHighlighting
()
})
self
.
editor
.
event
.
register
(
'contentChanged'
,
()
=>
{
this
.
_stopHighlighting
()
})
...
...
src/app/files/compiler-metadata.js
View file @
e7cba12d
'use strict'
'use strict'
var
executionContext
=
require
(
'../../execution-context'
)
var
executionContext
=
require
(
'../../execution-context'
)
var
CompilerAbstract
=
require
(
'../compiler/compiler-abstract'
)
class
CompilerMetadata
{
class
CompilerMetadata
{
constructor
(
events
,
opts
)
{
constructor
(
opts
)
{
var
self
=
this
var
self
=
this
self
.
_events
=
events
self
.
_opts
=
opts
self
.
_opts
=
opts
self
.
networks
=
[
'VM:-'
,
'main:1'
,
'ropsten:3'
,
'rinkeby:4'
,
'kovan:42'
,
'Custom'
]
self
.
networks
=
[
'VM:-'
,
'main:1'
,
'ropsten:3'
,
'rinkeby:4'
,
'kovan:42'
,
'Custom'
]
}
}
syncContractMetadata
()
{
syncContractMetadata
()
{
var
self
=
this
var
self
=
this
self
.
_events
.
compiler
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
self
.
_opts
.
pluginManager
.
event
.
register
(
'sendCompilationResult'
,
(
file
,
source
,
languageVersion
,
data
)
=>
{
if
(
!
success
)
return
if
(
!
self
.
_opts
.
config
.
get
(
'settings/generate-contract-metadata'
))
return
if
(
!
self
.
_opts
.
config
.
get
(
'settings/generate-contract-metadata'
))
return
let
compiler
=
new
CompilerAbstract
(
languageVersion
,
data
,
source
)
var
provider
=
self
.
_opts
.
fileManager
.
currentFileProvider
()
var
provider
=
self
.
_opts
.
fileManager
.
currentFileProvider
()
var
path
=
self
.
_opts
.
fileManager
.
currentPath
()
var
path
=
self
.
_opts
.
fileManager
.
currentPath
()
if
(
provider
&&
path
)
{
if
(
provider
&&
path
)
{
self
.
_opts
.
compiler
.
visitContracts
((
contract
)
=>
{
compiler
.
visitContracts
((
contract
)
=>
{
if
(
contract
.
file
!==
source
.
target
)
return
if
(
contract
.
file
!==
source
.
target
)
return
var
fileName
=
path
+
'/'
+
contract
.
name
+
'.json'
var
fileName
=
path
+
'/'
+
contract
.
name
+
'.json'
...
...
src/app/panels/editor-panel.js
View file @
e7cba12d
...
@@ -26,7 +26,7 @@ class EditorPanel {
...
@@ -26,7 +26,7 @@ class EditorPanel {
txListener
:
self
.
_components
.
registry
.
get
(
'txlistener'
).
api
,
txListener
:
self
.
_components
.
registry
.
get
(
'txlistener'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
udapp
:
self
.
_components
.
registry
.
get
(
'udapp'
).
api
,
udapp
:
self
.
_components
.
registry
.
get
(
'udapp'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compil
er'
).
api
pluginManager
:
self
.
_components
.
registry
.
get
(
'pluginmanag
er'
).
api
}
}
self
.
data
=
{
self
.
data
=
{
_FILE_SCROLL_DELTA
:
200
,
_FILE_SCROLL_DELTA
:
200
,
...
@@ -40,16 +40,18 @@ class EditorPanel {
...
@@ -40,16 +40,18 @@ class EditorPanel {
self
.
_view
=
{}
self
.
_view
=
{}
var
editor
=
new
Editor
({})
var
editor
=
new
Editor
({})
self
.
_components
.
registry
.
put
({
api
:
editor
,
name
:
'editor'
})
self
.
_components
.
registry
.
put
({
api
:
editor
,
name
:
'editor'
})
var
contextualListener
=
new
ContextualListener
({
editor
:
editor
})
var
contextualListener
=
new
ContextualListener
({
editor
,
pluginManager
:
self
.
_deps
.
pluginManager
})
var
contextView
=
new
ContextView
({
contextualListener
,
editor
})
self
.
_components
=
{
self
.
_components
=
{
editor
:
editor
,
editor
:
editor
,
contextualListener
:
contextualListener
,
contextualListener
:
contextualListener
,
contextView
:
new
ContextView
({
contextualListener
:
contextualListener
,
editor
:
editor
}),
contextView
:
contextView
,
// TODO list of compilers is always empty; should find a path to add plugin compiler here
terminal
:
new
Terminal
({
terminal
:
new
Terminal
({
udapp
:
self
.
_deps
.
udapp
,
udapp
:
self
.
_deps
.
udapp
,
compilers
:
{
compilers
:
{}
'solidity'
:
self
.
_deps
.
compiler
}
},
},
{
{
getPosition
:
(
event
)
=>
{
getPosition
:
(
event
)
=>
{
...
...
src/app/panels/file-panel.js
View file @
e7cba12d
...
@@ -49,7 +49,7 @@ function filepanel (localRegistry) {
...
@@ -49,7 +49,7 @@ function filepanel (localRegistry) {
fileProviders
:
self
.
_components
.
registry
.
get
(
'fileproviders'
).
api
,
fileProviders
:
self
.
_components
.
registry
.
get
(
'fileproviders'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
pluginManager
:
self
.
_components
.
registry
.
get
(
'pluginmanager'
).
api
,
}
}
var
fileExplorer
=
new
FileExplorer
(
self
.
_components
.
registry
,
self
.
_deps
.
fileProviders
[
'browser'
])
var
fileExplorer
=
new
FileExplorer
(
self
.
_components
.
registry
,
self
.
_deps
.
fileProviders
[
'browser'
])
var
fileSystemExplorer
=
new
FileExplorer
(
self
.
_components
.
registry
,
self
.
_deps
.
fileProviders
[
'localhost'
])
var
fileSystemExplorer
=
new
FileExplorer
(
self
.
_components
.
registry
,
self
.
_deps
.
fileProviders
[
'localhost'
])
...
@@ -63,11 +63,8 @@ function filepanel (localRegistry) {
...
@@ -63,11 +63,8 @@ function filepanel (localRegistry) {
// ----------------- editor panel ----------------------
// ----------------- editor panel ----------------------
self
.
_compilerMetadata
=
new
CompilerMetadata
(
self
.
_compilerMetadata
=
new
CompilerMetadata
(
{
{
compiler
:
self
.
_deps
.
compiler
.
event
},
{
fileManager
:
self
.
_deps
.
fileManager
,
fileManager
:
self
.
_deps
.
fileManager
,
compiler
:
self
.
_deps
.
compil
er
,
pluginManager
:
self
.
_deps
.
pluginManag
er
,
config
:
self
.
_deps
.
config
config
:
self
.
_deps
.
config
}
}
)
)
...
...
src/app/plugin/pluginManager.js
View file @
e7cba12d
...
@@ -101,14 +101,6 @@ module.exports = class PluginManager {
...
@@ -101,14 +101,6 @@ module.exports = class PluginManager {
value
:
[
file
]
value
:
[
file
]
}))
}))
})
})
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
self
.
broadcast
(
JSON
.
stringify
({
action
:
'notification'
,
key
:
'compiler'
,
type
:
'compilationFinished'
,
value
:
[
success
,
data
,
source
]
}))
})
txlistener
.
event
.
register
(
'newTransaction'
,
(
tx
)
=>
{
txlistener
.
event
.
register
(
'newTransaction'
,
(
tx
)
=>
{
self
.
broadcast
(
JSON
.
stringify
({
self
.
broadcast
(
JSON
.
stringify
({
...
@@ -119,38 +111,6 @@ module.exports = class PluginManager {
...
@@ -119,38 +111,6 @@ module.exports = class PluginManager {
}))
}))
})
})
app
.
event
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
// TODO Fix this cause this event is no longer triggered
if
(
self
.
inFocus
&&
self
.
inFocus
!==
tabName
)
{
// trigger unfocus
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
action
:
'notification'
,
key
:
'app'
,
type
:
'unfocus'
,
value
:
[]
}))
}
if
(
self
.
plugins
[
tabName
])
{
// trigger focus
self
.
post
(
tabName
,
JSON
.
stringify
({
action
:
'notification'
,
key
:
'app'
,
type
:
'focus'
,
value
:
[]
}))
self
.
inFocus
=
tabName
pluginAPI
.
compiler
.
getCompilationResult
(
tabName
,
(
error
,
data
)
=>
{
if
(
!
error
)
return
self
.
post
(
tabName
,
JSON
.
stringify
({
action
:
'notification'
,
key
:
'compiler'
,
type
:
'compilationData'
,
value
:
[
data
]
}))
})
}
})
window
.
addEventListener
(
'message'
,
(
event
)
=>
{
window
.
addEventListener
(
'message'
,
(
event
)
=>
{
if
(
event
.
type
!==
'message'
)
return
if
(
event
.
type
!==
'message'
)
return
var
extension
=
self
.
origins
[
event
.
origin
]
var
extension
=
self
.
origins
[
event
.
origin
]
...
@@ -202,7 +162,13 @@ module.exports = class PluginManager {
...
@@ -202,7 +162,13 @@ module.exports = class PluginManager {
receivedDataFrom
(
methodName
,
mod
,
argumentsArray
)
{
receivedDataFrom
(
methodName
,
mod
,
argumentsArray
)
{
// TODO check whether 'mod' as right to do that
// TODO check whether 'mod' as right to do that
console
.
log
(
argumentsArray
)
console
.
log
(
argumentsArray
)
this
.
event
.
trigger
(
methodName
,
argumentsArray
)
this
.
event
.
trigger
(
methodName
,
argumentsArray
)
// forward to internal modules
this
.
broadcast
(
JSON
.
stringify
({
// forward to plugins
action
:
'notification'
,
key
:
mod
,
type
:
methodName
,
value
:
argumentsArray
}))
}
}
post
(
name
,
value
)
{
post
(
name
,
value
)
{
const
self
=
this
const
self
=
this
...
...
src/app/tabs/compile-tab.js
View file @
e7cba12d
...
@@ -56,6 +56,7 @@ module.exports = class CompileTab {
...
@@ -56,6 +56,7 @@ module.exports = class CompileTab {
swarmfileProvider
:
self
.
_components
.
registry
.
get
(
'fileproviders/swarm'
).
api
,
swarmfileProvider
:
self
.
_components
.
registry
.
get
(
'fileproviders/swarm'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
fileProviders
:
self
.
_components
.
registry
.
get
(
'fileproviders'
).
api
,
fileProviders
:
self
.
_components
.
registry
.
get
(
'fileproviders'
).
api
,
pluginManager
:
self
.
_components
.
registry
.
get
(
'pluginmanager'
).
api
}
}
self
.
data
=
{
self
.
data
=
{
hideWarnings
:
self
.
_deps
.
config
.
get
(
'hideWarnings'
)
||
false
,
hideWarnings
:
self
.
_deps
.
config
.
get
(
'hideWarnings'
)
||
false
,
...
@@ -127,6 +128,8 @@ module.exports = class CompileTab {
...
@@ -127,6 +128,8 @@ module.exports = class CompileTab {
// refill the dropdown list
// refill the dropdown list
self
.
_view
.
contractNames
.
innerHTML
=
''
self
.
_view
.
contractNames
.
innerHTML
=
''
if
(
success
)
{
if
(
success
)
{
// TODO consider using compile tab as a proper module instead of just forwarding event
self
.
_deps
.
pluginManager
.
receivedDataFrom
(
'sendCompilationResult'
,
'solidity-compiler'
,
[
data
.
target
,
source
,
self
.
data
.
selectedVersion
,
data
]
)
self
.
_view
.
contractNames
.
removeAttribute
(
'disabled'
)
self
.
_view
.
contractNames
.
removeAttribute
(
'disabled'
)
self
.
_components
.
compiler
.
visitContracts
(
contract
=>
{
self
.
_components
.
compiler
.
visitContracts
(
contract
=>
{
self
.
data
.
contractsDetails
[
contract
.
name
]
=
parseContracts
(
contract
.
name
,
contract
.
object
,
self
.
_components
.
compiler
.
getSource
(
contract
.
file
))
self
.
data
.
contractsDetails
[
contract
.
name
]
=
parseContracts
(
contract
.
name
,
contract
.
object
,
self
.
_components
.
compiler
.
getSource
(
contract
.
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