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
d3abd118
Commit
d3abd118
authored
Jun 28, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename _api => _component
parent
2d24d2c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
38 deletions
+36
-38
app.js
src/app.js
+36
-38
No files found.
src/app.js
View file @
d3abd118
...
...
@@ -117,7 +117,7 @@ var css = csjs`
class
App
{
constructor
(
api
=
{},
events
=
{},
opts
=
{})
{
var
self
=
this
self
.
_
api
=
{}
self
.
_
components
=
{}
registry
.
put
({
api
:
self
,
name
:
'app'
})
var
fileStorage
=
new
Storage
(
'sol:'
)
registry
.
put
({
api
:
fileStorage
,
name
:
'fileStorage'
})
...
...
@@ -125,46 +125,45 @@ class App {
var
configStorage
=
new
Storage
(
'config:'
)
registry
.
put
({
api
:
configStorage
,
name
:
'configStorage'
})
self
.
_
api
.
config
=
new
Config
(
fileStorage
)
registry
.
put
({
api
:
self
.
_
api
.
config
,
name
:
'config'
})
self
.
_
components
.
config
=
new
Config
(
fileStorage
)
registry
.
put
({
api
:
self
.
_
components
.
config
,
name
:
'config'
})
executionContext
.
init
(
self
.
_
api
.
config
)
executionContext
.
init
(
self
.
_
components
.
config
)
executionContext
.
listenOnLastBlock
()
self
.
_
api
.
filesProviders
=
{}
self
.
_
api
.
filesProviders
[
'browser'
]
=
new
Browserfiles
(
fileStorage
)
self
.
_
api
.
filesProviders
[
'config'
]
=
new
BrowserfilesTree
(
'config'
,
configStorage
)
self
.
_
api
.
filesProviders
[
'config'
].
init
()
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
[
'browser'
],
name
:
'fileproviders/browser'
})
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
[
'config'
],
name
:
'fileproviders/config'
})
self
.
_
components
.
filesProviders
=
{}
self
.
_
components
.
filesProviders
[
'browser'
]
=
new
Browserfiles
(
fileStorage
)
self
.
_
components
.
filesProviders
[
'config'
]
=
new
BrowserfilesTree
(
'config'
,
configStorage
)
self
.
_
components
.
filesProviders
[
'config'
].
init
()
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
[
'browser'
],
name
:
'fileproviders/browser'
})
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
[
'config'
],
name
:
'fileproviders/config'
})
var
remixd
=
new
Remixd
()
registry
.
put
({
api
:
remixd
,
name
:
'remixd/config'
})
remixd
.
event
.
register
(
'system'
,
(
message
)
=>
{
if
(
message
.
error
)
toolTip
(
message
.
error
)
})
self
.
_
api
.
filesProviders
[
'localhost'
]
=
new
SharedFolder
(
remixd
)
self
.
_
api
.
filesProviders
[
'swarm'
]
=
new
BasicReadOnlyExplorer
(
'swarm'
)
self
.
_
api
.
filesProviders
[
'github'
]
=
new
BasicReadOnlyExplorer
(
'github'
)
self
.
_
api
.
filesProviders
[
'gist'
]
=
new
NotPersistedExplorer
(
'gist'
)
self
.
_
api
.
filesProviders
[
'ipfs'
]
=
new
BasicReadOnlyExplorer
(
'ipfs'
)
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
[
'localhost'
],
name
:
'fileproviders/localhost'
})
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
[
'swarm'
],
name
:
'fileproviders/swarm'
})
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
[
'github'
],
name
:
'fileproviders/github'
})
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
[
'gist'
],
name
:
'fileproviders/gist'
})
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
[
'ipfs'
],
name
:
'fileproviders/ipfs'
})
registry
.
put
({
api
:
self
.
_
api
.
filesProviders
,
name
:
'fileproviders'
})
self
.
_
components
.
filesProviders
[
'localhost'
]
=
new
SharedFolder
(
remixd
)
self
.
_
components
.
filesProviders
[
'swarm'
]
=
new
BasicReadOnlyExplorer
(
'swarm'
)
self
.
_
components
.
filesProviders
[
'github'
]
=
new
BasicReadOnlyExplorer
(
'github'
)
self
.
_
components
.
filesProviders
[
'gist'
]
=
new
NotPersistedExplorer
(
'gist'
)
self
.
_
components
.
filesProviders
[
'ipfs'
]
=
new
BasicReadOnlyExplorer
(
'ipfs'
)
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
[
'localhost'
],
name
:
'fileproviders/localhost'
})
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
[
'swarm'
],
name
:
'fileproviders/swarm'
})
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
[
'github'
],
name
:
'fileproviders/github'
})
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
[
'gist'
],
name
:
'fileproviders/gist'
})
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
[
'ipfs'
],
name
:
'fileproviders/ipfs'
})
registry
.
put
({
api
:
self
.
_
components
.
filesProviders
,
name
:
'fileproviders'
})
self
.
_view
=
{}
self
.
_components
=
{}
self
.
_components
.
compilerImport
=
new
CompilerImport
()
registry
.
put
({
api
:
self
.
_components
.
compilerImport
,
name
:
'compilerimport'
})
self
.
_components
.
gistHandler
=
new
GistHandler
()
self
.
data
=
{
_layout
:
{
right
:
{
offset
:
self
.
_
api
.
config
.
get
(
'right-offset'
)
||
400
,
offset
:
self
.
_
components
.
config
.
get
(
'right-offset'
)
||
400
,
show
:
true
},
// @TODO: adapt sizes proportionally to browser window size
left
:
{
offset
:
self
.
_
api
.
config
.
get
(
'left-offset'
)
||
200
,
offset
:
self
.
_
components
.
config
.
get
(
'left-offset'
)
||
200
,
show
:
true
}
}
...
...
@@ -179,7 +178,7 @@ class App {
if
(
layout
.
show
)
delta
=
layout
.
offset
else
delta
=
0
}
else
{
self
.
_
api
.
config
.
set
(
`
${
direction
}
-offset`
,
delta
)
self
.
_
components
.
config
.
set
(
`
${
direction
}
-offset`
,
delta
)
layout
.
offset
=
delta
}
}
...
...
@@ -232,7 +231,7 @@ class App {
self
.
_components
.
fileManager
.
saveCurrentFile
()
self
.
_components
.
editor
.
clearAnnotations
()
var
currentFile
=
self
.
_
api
.
config
.
get
(
'currentFile'
)
var
currentFile
=
self
.
_
components
.
config
.
get
(
'currentFile'
)
if
(
currentFile
)
{
if
(
/.
(
.sol
)
$/
.
exec
(
currentFile
))
{
// only compile *.sol file.
...
...
@@ -271,7 +270,7 @@ class App {
return
}
self
.
loadFiles
(
data
.
files
,
'gist'
,
(
errorLoadingFile
)
=>
{
if
(
!
errorLoadingFile
)
self
.
_
api
.
filesProviders
[
'gist'
].
id
=
gistId
if
(
!
errorLoadingFile
)
self
.
_
components
.
filesProviders
[
'gist'
].
id
=
gistId
})
})
})
...
...
@@ -281,14 +280,14 @@ class App {
if
(
!
fileProvider
)
fileProvider
=
'browser'
async
.
each
(
Object
.
keys
(
filesSet
),
(
file
,
callback
)
=>
{
helper
.
createNonClashingName
(
file
,
self
.
_
api
.
filesProviders
[
fileProvider
],
helper
.
createNonClashingName
(
file
,
self
.
_
components
.
filesProviders
[
fileProvider
],
(
error
,
name
)
=>
{
if
(
error
)
{
modalDialogCustom
.
alert
(
'Unexpected error loading the file '
+
error
)
}
else
if
(
helper
.
checkSpecialChars
(
name
))
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
}
else
{
self
.
_
api
.
filesProviders
[
fileProvider
].
set
(
name
,
filesSet
[
file
].
content
)
self
.
_
components
.
filesProviders
[
fileProvider
].
set
(
name
,
filesSet
[
file
].
content
)
}
callback
()
})
...
...
@@ -305,8 +304,8 @@ class App {
},
(
error
,
content
,
cleanUrl
,
type
,
url
)
=>
{
if
(
!
error
)
{
if
(
self
.
_
api
.
filesProviders
[
type
])
{
self
.
_
api
.
filesProviders
[
type
].
addReadOnly
(
cleanUrl
,
content
,
url
)
if
(
self
.
_
components
.
filesProviders
[
type
])
{
self
.
_
components
.
filesProviders
[
type
].
addReadOnly
(
cleanUrl
,
content
,
url
)
}
cb
(
null
,
content
)
}
else
{
...
...
@@ -476,11 +475,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
this module basically listen on user input (from terminal && editor)
and interpret them as commands
*/
var
cmdInterpreter
=
new
CommandInterpreter
()
var
cmdInterpreter
=
new
CommandInterpreter
()
// @TODO: put into editorpanel
registry
.
put
({
api
:
cmdInterpreter
,
name
:
'cmdinterpreter'
})
var
config
=
self
.
_api
.
config
var
filesProviders
=
self
.
_api
.
filesProviders
var
config
=
self
.
_components
.
config
// ----------------- file manager ----------------------------
...
...
@@ -532,13 +530,13 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// insert ballot contract if there are no files available
if
(
!
loadingFromGist
)
{
filesProviders
[
'browser'
].
resolveDirectory
(
'browser'
,
(
error
,
filesList
)
=>
{
self
.
_components
.
filesProviders
[
'browser'
].
resolveDirectory
(
'browser'
,
(
error
,
filesList
)
=>
{
if
(
error
)
console
.
error
(
error
)
if
(
Object
.
keys
(
filesList
).
length
===
0
)
{
if
(
!
filesProviders
[
'browser'
].
set
(
examples
.
ballot
.
name
,
examples
.
ballot
.
content
))
{
if
(
!
self
.
_components
.
filesProviders
[
'browser'
].
set
(
examples
.
ballot
.
name
,
examples
.
ballot
.
content
))
{
modalDialogCustom
.
alert
(
'Failed to store example contract in browser. Remix will not work properly. Please ensure Remix has access to LocalStorage. Safari in Private mode is known not to work.'
)
}
else
{
filesProviders
[
'browser'
].
set
(
examples
.
ballot_test
.
name
,
examples
.
ballot_test
.
content
)
self
.
_components
.
filesProviders
[
'browser'
].
set
(
examples
.
ballot_test
.
name
,
examples
.
ballot_test
.
content
)
}
}
})
...
...
@@ -558,7 +556,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
var
previouslyOpenedFile
=
config
.
get
(
'currentFile'
)
if
(
previouslyOpenedFile
)
{
filesProviders
[
'browser'
].
get
(
previouslyOpenedFile
,
(
error
,
content
)
=>
{
self
.
_components
.
filesProviders
[
'browser'
].
get
(
previouslyOpenedFile
,
(
error
,
content
)
=>
{
if
(
!
error
&&
content
)
{
fileManager
.
switchFile
(
previouslyOpenedFile
)
}
else
{
...
...
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