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
398e123c
Commit
398e123c
authored
Dec 03, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move runCompiler to compile tab
parent
391dfbba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
42 deletions
+39
-42
app.js
src/app.js
+1
-38
compile-tab.js
src/app/tabs/compile-tab.js
+38
-4
No files found.
src/app.js
View file @
398e123c
...
@@ -226,35 +226,7 @@ class App {
...
@@ -226,35 +226,7 @@ class App {
self
.
_adjustLayout
(
'left'
,
self
.
data
.
_layout
.
left
.
offset
)
self
.
_adjustLayout
(
'left'
,
self
.
data
.
_layout
.
left
.
offset
)
self
.
_adjustLayout
(
'right'
,
self
.
data
.
_layout
.
right
.
offset
)
self
.
_adjustLayout
(
'right'
,
self
.
data
.
_layout
.
right
.
offset
)
return
self
.
_view
.
el
return
self
.
_view
.
el
}
}
runCompiler
()
{
const
self
=
this
if
(
self
.
_components
.
righthandpanel
.
debugger
().
isDebuggerActive
())
return
self
.
_components
.
fileManager
.
saveCurrentFile
()
self
.
_components
.
editorpanel
.
getEditor
().
clearAnnotations
()
var
currentFile
=
self
.
_components
.
config
.
get
(
'currentFile'
)
if
(
currentFile
)
{
if
(
/.
(
.sol
)
$/
.
exec
(
currentFile
))
{
// only compile *.sol file.
var
target
=
currentFile
var
sources
=
{}
var
provider
=
self
.
_components
.
fileManager
.
fileProviderOf
(
currentFile
)
if
(
provider
)
{
provider
.
get
(
target
,
(
error
,
content
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
sources
[
target
]
=
{
content
}
self
.
_components
.
compiler
.
compile
(
sources
,
target
)
}
})
}
else
{
console
.
log
(
'cannot compile '
+
currentFile
+
'. Does not belong to any explorer'
)
}
}
}
}
startdebugging
(
txHash
)
{
startdebugging
(
txHash
)
{
const
self
=
this
const
self
=
this
self
.
event
.
trigger
(
'debuggingRequested'
,
[])
self
.
event
.
trigger
(
'debuggingRequested'
,
[])
...
@@ -376,15 +348,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -376,15 +348,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
return
'Are you sure you want to leave?'
return
'Are you sure you want to leave?'
}
}
// Run the compiler instead of trying to save the website
$
(
window
).
keydown
(
function
(
e
)
{
// ctrl+s or command+s
if
((
e
.
metaKey
||
e
.
ctrlKey
)
&&
e
.
keyCode
===
83
)
{
e
.
preventDefault
()
self
.
runCompiler
()
}
})
registry
.
put
({
api
:
msg
=>
self
.
_components
.
editorpanel
.
logHtmlMessage
(
msg
),
name
:
'logCallback'
})
registry
.
put
({
api
:
msg
=>
self
.
_components
.
editorpanel
.
logHtmlMessage
(
msg
),
name
:
'logCallback'
})
// ----------------- Compiler -----------------
// ----------------- Compiler -----------------
...
...
src/app/tabs/compile-tab.js
View file @
398e123c
...
@@ -42,7 +42,6 @@ module.exports = class CompileTab {
...
@@ -42,7 +42,6 @@ module.exports = class CompileTab {
self
.
_components
.
queryParams
=
new
QueryParams
()
self
.
_components
.
queryParams
=
new
QueryParams
()
// dependencies
// dependencies
self
.
_deps
=
{
self
.
_deps
=
{
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
,
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
,
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
...
@@ -71,7 +70,7 @@ module.exports = class CompileTab {
...
@@ -71,7 +70,7 @@ module.exports = class CompileTab {
function
scheduleCompilation
()
{
function
scheduleCompilation
()
{
if
(
!
self
.
_deps
.
config
.
get
(
'autoCompile'
))
return
if
(
!
self
.
_deps
.
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
.
_deps
.
app
.
runCompiler
(),
self
.
data
.
timeout
)
self
.
data
.
compileTimeout
=
window
.
setTimeout
(()
=>
self
.
runCompiler
(),
self
.
data
.
timeout
)
}
}
self
.
_deps
.
compiler
.
event
.
register
(
'compilationDuration'
,
function
tabHighlighting
(
speed
)
{
self
.
_deps
.
compiler
.
event
.
register
(
'compilationDuration'
,
function
tabHighlighting
(
speed
)
{
if
(
!
self
.
_view
.
warnCompilationSlow
)
return
if
(
!
self
.
_view
.
warnCompilationSlow
)
return
...
@@ -165,6 +164,15 @@ module.exports = class CompileTab {
...
@@ -165,6 +164,15 @@ module.exports = class CompileTab {
})
})
}
}
})
})
// Run the compiler instead of trying to save the website
$
(
window
).
keydown
(
function
(
e
)
{
// ctrl+s or command+s
if
((
e
.
metaKey
||
e
.
ctrlKey
)
&&
e
.
keyCode
===
83
)
{
e
.
preventDefault
()
self
.
runCompiler
()
}
})
}
}
addWarning
(
msg
,
settings
)
{
addWarning
(
msg
,
settings
)
{
const
self
=
this
const
self
=
this
...
@@ -183,7 +191,7 @@ module.exports = class CompileTab {
...
@@ -183,7 +191,7 @@ module.exports = class CompileTab {
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
.
_deps
.
compiler
.
setOptimize
(
self
.
data
.
optimize
)
self
.
_deps
.
compiler
.
setOptimize
(
self
.
data
.
optimize
)
self
.
_deps
.
app
.
runCompiler
()
self
.
runCompiler
()
}
}
self
.
_deps
.
compiler
.
event
.
register
(
'compilerLoaded'
,
(
version
)
=>
self
.
setVersionText
(
version
))
self
.
_deps
.
compiler
.
event
.
register
(
'compilerLoaded'
,
(
version
)
=>
self
.
setVersionText
(
version
))
...
@@ -279,7 +287,7 @@ module.exports = class CompileTab {
...
@@ -279,7 +287,7 @@ module.exports = class CompileTab {
'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
.
_deps
.
config
.
set
(
'autoCompile'
,
self
.
_view
.
autoCompile
.
checked
)
}
function
updateAutoCompile
(
event
)
{
self
.
_deps
.
config
.
set
(
'autoCompile'
,
self
.
_view
.
autoCompile
.
checked
)
}
function
compile
(
event
)
{
self
.
_deps
.
app
.
runCompiler
()
}
function
compile
(
event
)
{
self
.
runCompiler
()
}
function
hideWarnings
(
event
)
{
function
hideWarnings
(
event
)
{
self
.
_deps
.
config
.
set
(
'hideWarnings'
,
self
.
_view
.
hideWarningsBox
.
checked
)
self
.
_deps
.
config
.
set
(
'hideWarnings'
,
self
.
_view
.
hideWarningsBox
.
checked
)
compile
()
compile
()
...
@@ -452,6 +460,32 @@ module.exports = class CompileTab {
...
@@ -452,6 +460,32 @@ module.exports = class CompileTab {
callback
(
allversions
,
selectedVersion
)
callback
(
allversions
,
selectedVersion
)
})
})
}
}
runCompiler
()
{
const
self
=
this
self
.
_deps
.
fileManager
.
saveCurrentFile
()
self
.
_deps
.
editor
.
clearAnnotations
()
var
currentFile
=
self
.
_deps
.
config
.
get
(
'currentFile'
)
if
(
currentFile
)
{
if
(
/.
(
.sol
)
$/
.
exec
(
currentFile
))
{
// only compile *.sol file.
var
target
=
currentFile
var
sources
=
{}
var
provider
=
self
.
_deps
.
fileManager
.
fileProviderOf
(
currentFile
)
if
(
provider
)
{
provider
.
get
(
target
,
(
error
,
content
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
sources
[
target
]
=
{
content
}
self
.
compiler
.
compile
(
sources
,
target
)
}
})
}
else
{
console
.
log
(
'cannot compile '
+
currentFile
+
'. Does not belong to any explorer'
)
}
}
}
}
}
}
const
css
=
csjs
`
const
css
=
csjs
`
...
...
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