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
9b66798d
Commit
9b66798d
authored
Feb 25, 2019
by
Grandschtroumpf
Committed by
yann300
Mar 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update API to promises
parent
049354b8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
33 deletions
+36
-33
SourceHighlighters.js
src/app/editor/SourceHighlighters.js
+3
-5
fileManager.js
src/app/files/fileManager.js
+12
-7
test-tab.js
src/app/tabs/test-tab.js
+4
-5
universal-dapp.js
src/universal-dapp.js
+17
-16
No files found.
src/app/editor/SourceHighlighters.js
View file @
9b66798d
...
@@ -17,22 +17,20 @@ class SourceHighlighters {
...
@@ -17,22 +17,20 @@ class SourceHighlighters {
}
}
// TODO what to do with mod?
// TODO what to do with mod?
highlight
(
mod
,
lineColumnPos
,
filePath
,
hexColor
,
cb
)
{
async
highlight
(
mod
,
lineColumnPos
,
filePath
,
hexColor
)
{
let
position
let
position
try
{
try
{
position
=
JSON
.
parse
(
lineColumnPos
)
position
=
JSON
.
parse
(
lineColumnPos
)
}
catch
(
e
)
{
}
catch
(
e
)
{
return
cb
(
e
.
message
)
throw
e
}
}
if
(
!
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
]
=
new
SourceHighlighter
()
if
(
!
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
]
=
new
SourceHighlighter
()
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
this
.
highlighters
[
mod
].
currentSourceLocationFromfileName
(
position
,
filePath
,
hexColor
)
this
.
highlighters
[
mod
].
currentSourceLocationFromfileName
(
position
,
filePath
,
hexColor
)
cb
()
}
}
discardHighlight
(
mod
,
cb
)
{
async
discardHighlight
(
mod
)
{
if
(
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
if
(
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
cb
()
}
}
}
}
...
...
src/app/files/fileManager.js
View file @
9b66798d
...
@@ -121,7 +121,8 @@ class FileManager {
...
@@ -121,7 +121,8 @@ class FileManager {
async
getCurrentFile
()
{
async
getCurrentFile
()
{
const
path
=
this
.
currentFile
()
const
path
=
this
.
currentFile
()
if
(
!
path
)
throw
'no file selected'
if
(
!
path
)
throw
new
Error
(
'no file selected'
)
console
.
log
(
'Get current File'
,
path
)
return
path
return
path
}
}
...
@@ -206,12 +207,16 @@ class FileManager {
...
@@ -206,12 +207,16 @@ class FileManager {
}
}
}
}
filesFromPath
(
path
,
cb
)
{
getFilesFromPath
(
path
)
{
var
provider
=
this
.
fileProviderOf
(
path
)
const
provider
=
this
.
fileProviderOf
(
path
)
if
(
provider
)
{
if
(
!
provider
)
throw
new
Error
(
`provider for path
${
path
}
not found`
)
return
provider
.
resolveDirectory
(
path
,
(
error
,
filesTree
)
=>
{
cb
(
error
,
filesTree
)
})
// TODO : Change provider with promise
}
return
new
Promise
((
resolve
,
reject
)
=>
{
cb
(
`provider for path
${
path
}
not found`
)
provider
.
resolveDirectory
(
path
,
(
error
,
filesTree
)
=>
{
if
(
error
)
reject
(
error
)
resolve
(
filesTree
)
})
})
}
}
fileProviderOf
(
file
)
{
fileProviderOf
(
file
)
{
...
...
src/app/tabs/test-tab.js
View file @
9b66798d
...
@@ -98,15 +98,14 @@ module.exports = class TestTab {
...
@@ -98,15 +98,14 @@ module.exports = class TestTab {
var
provider
=
self
.
_deps
.
fileManager
.
fileProviderOf
(
path
)
var
provider
=
self
.
_deps
.
fileManager
.
fileProviderOf
(
path
)
if
(
!
provider
)
return
cb
(
null
,
[])
if
(
!
provider
)
return
cb
(
null
,
[])
var
tests
=
[]
var
tests
=
[]
self
.
_deps
.
fileManager
.
filesFromPath
(
path
,
(
error
,
files
)
=>
{
self
.
_deps
.
fileManager
.
getFilesFromPath
(
path
)
if
(
error
)
return
cb
(
error
)
.
then
((
files
)
=>
{
if
(
!
error
)
{
for
(
var
file
in
files
)
{
for
(
var
file
in
files
)
{
if
(
/.
(
_test.sol
)
$/
.
exec
(
file
))
tests
.
push
(
provider
.
type
+
'/'
+
file
)
if
(
/.
(
_test.sol
)
$/
.
exec
(
file
))
tests
.
push
(
provider
.
type
+
'/'
+
file
)
}
}
cb
(
null
,
tests
)
cb
(
null
,
tests
)
}
}
)
}
)
.
catch
(
err
=>
cb
(
error
)
)
}
}
self
.
_deps
.
filePanel
.
event
.
register
(
'newTestFileCreated'
,
file
=>
{
self
.
_deps
.
filePanel
.
event
.
register
(
'newTestFileCreated'
,
file
=>
{
...
...
src/universal-dapp.js
View file @
9b66798d
...
@@ -231,23 +231,24 @@ UniversalDApp.prototype.getInputs = function (funABI) {
...
@@ -231,23 +231,24 @@ UniversalDApp.prototype.getInputs = function (funABI) {
* SHOULD BE TAKEN CAREFULLY!
* SHOULD BE TAKEN CAREFULLY!
*
*
* @param {Object} tx - transaction.
* @param {Object} tx - transaction.
* @param {Function} callback - callback.
*/
*/
UniversalDApp
.
prototype
.
runTestTx
=
function
(
tx
,
cb
)
{
UniversalDApp
.
prototype
.
runTestTx
=
function
(
tx
)
{
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
error
)
return
cb
(
error
)
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
network
.
name
===
'Main'
&&
network
.
id
===
'1'
)
{
if
(
error
)
reject
(
error
)
return
cb
(
'It is not allowed to make this action against mainnet'
)
if
(
network
.
name
===
'Main'
&&
network
.
id
===
'1'
)
{
}
reject
(
new
Error
(
'It is not allowed to make this action against mainnet'
))
this
.
silentRunTx
(
tx
,
(
error
,
result
)
=>
{
}
if
(
error
)
return
cb
(
error
)
this
.
silentRunTx
(
tx
,
(
error
,
result
)
=>
{
cb
(
null
,
{
if
(
error
)
reject
(
error
)
transactionHash
:
result
.
transactionHash
,
resolve
({
status
:
result
.
result
.
status
,
transactionHash
:
result
.
transactionHash
,
gasUsed
:
'0x'
+
result
.
result
.
gasUsed
.
toString
(
'hex'
),
status
:
result
.
result
.
status
,
error
:
result
.
result
.
vm
.
exceptionError
,
gasUsed
:
'0x'
+
result
.
result
.
gasUsed
.
toString
(
'hex'
),
return
:
result
.
result
.
vm
.
return
?
'0x'
+
result
.
result
.
vm
.
return
.
toString
(
'hex'
)
:
'0x'
,
error
:
result
.
result
.
vm
.
exceptionError
,
createdAddress
:
result
.
result
.
createdAddress
?
'0x'
+
result
.
result
.
createdAddress
.
toString
(
'hex'
)
:
undefined
return
:
result
.
result
.
vm
.
return
?
'0x'
+
result
.
result
.
vm
.
return
.
toString
(
'hex'
)
:
'0x'
,
createdAddress
:
result
.
result
.
createdAddress
?
'0x'
+
result
.
result
.
createdAddress
.
toString
(
'hex'
)
:
undefined
})
})
})
})
})
})
})
...
...
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