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
1628905d
Unverified
Commit
1628905d
authored
Mar 15, 2019
by
yann300
Committed by
GitHub
Mar 15, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1702 from ethereum/refactor_tabs_2
refactor/simplify code in the tabs
parents
90933b0d
dd2ba18e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
181 additions
and
333 deletions
+181
-333
app.js
src/app.js
+19
-5
debuggerUI.js
src/app/debugger/debuggerUI.js
+12
-64
fileManager.js
src/app/files/fileManager.js
+2
-2
analysis-tab.js
src/app/tabs/analysis-tab.js
+3
-0
compile-tab.js
src/app/tabs/compile-tab.js
+20
-21
settings-tab.js
src/app/tabs/settings-tab.js
+0
-0
settings-tab-styles.js
src/app/tabs/styles/settings-tab-styles.js
+40
-25
tabbed-menu-styles.js
src/app/tabs/styles/tabbed-menu-styles.js
+0
-36
support-tab.js
src/app/tabs/support-tab.js
+0
-90
tabbed-menu.js
src/app/tabs/tabbed-menu.js
+0
-90
test-tab.js
src/app/tabs/test-tab.js
+0
-0
testTab.js
src/app/tabs/testTab/testTab.js
+85
-0
No files found.
src/app.js
View file @
1628905d
...
...
@@ -46,7 +46,6 @@ const CompileTab = require('./app/tabs/compile-tab')
const
SettingsTab
=
require
(
'./app/tabs/settings-tab'
)
const
AnalysisTab
=
require
(
'./app/tabs/analysis-tab'
)
const
DebuggerTab
=
require
(
'./app/tabs/debugger-tab'
)
// const SupportTab = require('./app/tabs/support-tab')
const
TestTab
=
require
(
'./app/tabs/test-tab'
)
const
RunTab
=
require
(
'./app/tabs/run-tab'
)
const
FilePanel
=
require
(
'./app/panels/file-panel'
)
...
...
@@ -432,7 +431,15 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
let
filePanel
=
new
FilePanel
()
registry
.
put
({
api
:
filePanel
,
name
:
'filepanel'
})
let
compileTab
=
new
CompileTab
(
registry
)
let
compileTab
=
new
CompileTab
(
registry
.
get
(
'editor'
).
api
,
registry
.
get
(
'config'
).
api
,
registry
.
get
(
'renderer'
).
api
,
registry
.
get
(
'fileproviders/swarm'
).
api
,
registry
.
get
(
'filemanager'
).
api
,
registry
.
get
(
'fileproviders'
).
api
,
registry
.
get
(
'pluginmanager'
).
api
)
let
run
=
new
RunTab
(
registry
.
get
(
'udapp'
).
api
,
registry
.
get
(
'udappUI'
).
api
,
...
...
@@ -444,12 +451,19 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry
.
get
(
'pluginmanager'
).
api
,
registry
.
get
(
'compilersartefacts'
).
api
)
let
settings
=
new
SettingsTab
(
self
.
_components
.
registry
)
let
settings
=
new
SettingsTab
(
registry
.
get
(
'config'
).
api
,
registry
.
get
(
'editor'
).
api
,
appManager
)
let
analysis
=
new
AnalysisTab
(
registry
)
let
debug
=
new
DebuggerTab
()
const
landingPage
=
new
LandingPage
(
appManager
,
appStore
)
// let support = new SupportTab()
let
test
=
new
TestTab
(
self
.
_components
.
registry
,
compileTab
)
let
test
=
new
TestTab
(
registry
.
get
(
'filemanager'
).
api
,
registry
.
get
(
'filepanel'
).
api
,
compileTab
)
let
sourceHighlighters
=
registry
.
get
(
'editor'
).
api
.
sourceHighlighters
let
configProvider
=
self
.
_components
.
filesProviders
[
'config'
]
...
...
src/app/debugger/debuggerUI.js
View file @
1628905d
...
...
@@ -12,8 +12,6 @@ var executionContext = require('../../execution-context')
var
globalRegistry
=
require
(
'../../global/registry'
)
var
remixLib
=
require
(
'remix-lib'
)
var
Web3Providers
=
remixLib
.
vm
.
Web3Providers
var
DummyProvider
=
remixLib
.
vm
.
DummyProvider
var
init
=
remixLib
.
init
...
...
@@ -30,72 +28,12 @@ var css = csjs`
}
`
class
ContextManager
{
constructor
()
{
this
.
executionContext
=
executionContext
this
.
web3
=
this
.
executionContext
.
web3
()
this
.
event
=
new
EventManager
()
}
initProviders
()
{
this
.
web3Providers
=
new
Web3Providers
()
this
.
addProvider
(
'DUMMYWEB3'
,
new
DummyProvider
())
this
.
switchProvider
(
'DUMMYWEB3'
)
this
.
addProvider
(
'vm'
,
this
.
executionContext
.
vm
())
this
.
addProvider
(
'injected'
,
this
.
executionContext
.
internalWeb3
())
this
.
addProvider
(
'web3'
,
this
.
executionContext
.
internalWeb3
())
this
.
switchProvider
(
this
.
executionContext
.
getProvider
())
}
getWeb3
()
{
return
this
.
web3
}
addProvider
(
type
,
obj
)
{
this
.
web3Providers
.
addProvider
(
type
,
obj
)
this
.
event
.
trigger
(
'providerAdded'
,
[
type
])
}
switchProvider
(
type
)
{
var
self
=
this
this
.
web3Providers
.
get
(
type
,
function
(
error
,
obj
)
{
if
(
error
)
{
console
.
log
(
'provider '
+
type
+
' not defined'
)
}
else
{
self
.
web3
=
obj
self
.
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
error
||
!
network
)
{
self
.
web3
=
obj
}
else
{
var
webDebugNode
=
init
.
web3DebugNode
(
network
.
name
)
self
.
web3
=
(
!
webDebugNode
?
obj
:
webDebugNode
)
}
self
.
event
.
trigger
(
'providerChanged'
,
[
type
,
self
.
web3
])
})
self
.
event
.
trigger
(
'providerChanged'
,
[
type
,
self
.
web3
])
}
})
}
}
class
DebuggerUI
{
constructor
(
container
)
{
this
.
registry
=
globalRegistry
this
.
event
=
new
EventManager
()
this
.
executionContext
=
executionContext
this
.
contextManager
=
new
ContextManager
()
this
.
contextManager
.
initProviders
()
this
.
contextManager
.
event
.
register
(
'providerChanged'
,
()
=>
{
if
(
this
.
debugger
)
this
.
debugger
.
updateWeb3
(
this
.
contextManager
.
getWeb3
())
})
this
.
isActive
=
false
this
.
sourceHighlighter
=
new
SourceHighlighter
()
...
...
@@ -173,20 +111,30 @@ class DebuggerUI {
if
(
compilers
[
'__last'
])
lastCompilationResult
=
compilers
[
'__last'
]
// TODO debugging with source highlight is disabled. see line 98
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
let
web3
if
(
error
||
!
network
)
{
web3
=
init
.
web3DebugNode
(
executionContext
.
web3
())
}
else
{
var
webDebugNode
=
init
.
web3DebugNode
(
network
.
name
)
web3
=
(
!
webDebugNode
?
executionContext
.
web3
()
:
webDebugNode
)
}
init
.
extendWeb3
(
web3
)
this
.
debugger
=
new
Debugger
({
web3
:
this
.
contextManager
.
getWeb3
()
,
web3
,
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
,
compiler
:
{
lastCompilationResult
}
})
this
.
listenToEvents
()
this
.
debugger
.
debugger
.
updateWeb3
(
this
.
executionContext
.
web3
())
this
.
debugger
.
debug
(
blockNumber
,
txNumber
,
tx
,
()
=>
{
self
.
stepManager
=
new
StepManagerUI
(
this
.
debugger
.
step_manager
)
self
.
vmDebugger
=
new
VmDebugger
(
this
.
debugger
.
vmDebuggerLogic
)
self
.
renderDebugger
()
})
})
}
debug
(
txHash
)
{
...
...
src/app/files/fileManager.js
View file @
1628905d
...
...
@@ -198,10 +198,10 @@ class FileManager extends ApiFactory {
}
getFilesFromPath
(
path
)
{
const
provider
=
this
.
fileProviderOf
(
path
)
if
(
!
provider
)
throw
new
Error
(
`provider for path
${
path
}
not found`
)
// TODO : Change provider with promise
return
new
Promise
((
resolve
,
reject
)
=>
{
const
provider
=
this
.
fileProviderOf
(
path
)
if
(
!
provider
)
return
reject
(
`provider for path
${
path
}
not found`
)
provider
.
resolveDirectory
(
path
,
(
error
,
filesTree
)
=>
{
if
(
error
)
reject
(
error
)
resolve
(
filesTree
)
...
...
src/app/tabs/analysis-tab.js
View file @
1628905d
...
...
@@ -12,6 +12,7 @@ class AnalysisTab extends ApiFactory {
this
.
event
=
new
EventManager
()
this
.
registry
=
registry
}
get
profile
()
{
return
{
name
:
'solidityStaticAnalysis'
,
...
...
@@ -23,6 +24,7 @@ class AnalysisTab extends ApiFactory {
kind
:
'analysis'
}
}
render
()
{
var
staticanalysis
=
new
StaticAnalysis
()
this
.
registry
.
put
({
api
:
staticanalysis
,
name
:
'staticanalysis'
})
...
...
@@ -31,6 +33,7 @@ class AnalysisTab extends ApiFactory {
this
.
el
=
yo
`<div class="
${
css
.
analysisTabView
}
" id="staticanalysisView">
${
staticanalysis
.
render
()}
</div>`
return
this
.
el
}
}
module
.
exports
=
AnalysisTab
src/app/tabs/compile-tab.js
View file @
1628905d
...
...
@@ -21,7 +21,7 @@ import { ApiFactory } from 'remix-plugin'
class
CompileTab
extends
ApiFactory
{
constructor
(
registry
)
{
constructor
(
editor
,
config
,
renderer
,
swarmfileProvider
,
fileManager
,
fileProviders
,
pluginManager
)
{
super
()
this
.
events
=
new
EventEmitter
()
this
.
_view
=
{
...
...
@@ -34,27 +34,26 @@ class CompileTab extends ApiFactory {
this
.
queryParams
=
new
QueryParams
()
// dependencies
this
.
_deps
=
{
editor
:
registry
.
get
(
'editor'
).
api
,
config
:
registry
.
get
(
'config'
).
api
,
renderer
:
registry
.
get
(
'renderer'
).
api
,
swarmfileProvider
:
registry
.
get
(
'fileproviders/swarm'
).
api
,
fileManager
:
registry
.
get
(
'filemanager'
).
api
,
fileProviders
:
registry
.
get
(
'fileproviders'
).
api
,
pluginManager
:
registry
.
get
(
'pluginmanager'
).
api
}
this
.
editor
=
editor
this
.
config
=
config
this
.
renderer
=
renderer
this
.
swarmfileProvider
=
swarmfileProvider
this
.
fileManager
=
fileManager
this
.
fileProviders
=
fileProviders
this
.
pluginManager
=
pluginManager
this
.
data
=
{
contractsDetails
:
{}
}
this
.
compileTabLogic
=
new
CompileTabLogic
(
this
.
queryParams
,
this
.
_deps
.
fileManager
,
this
.
_deps
.
editor
,
this
.
_deps
.
config
,
this
.
_dep
s
.
fileProviders
)
this
.
compileTabLogic
=
new
CompileTabLogic
(
this
.
queryParams
,
this
.
fileManager
,
this
.
editor
,
this
.
config
,
thi
s
.
fileProviders
)
this
.
compiler
=
this
.
compileTabLogic
.
compiler
this
.
compileTabLogic
.
init
()
this
.
compilerContainer
=
new
CompilerContainer
(
this
.
compileTabLogic
,
this
.
_deps
.
editor
,
this
.
_deps
.
config
,
this
.
editor
,
this
.
config
,
this
.
queryParams
)
}
...
...
@@ -82,7 +81,7 @@ class CompileTab extends ApiFactory {
}
})
this
.
_deps
.
fileManager
.
events
.
on
(
'currentFileChanged'
,
(
name
)
=>
{
this
.
fileManager
.
events
.
on
(
'currentFileChanged'
,
(
name
)
=>
{
this
.
compilerContainer
.
currentFile
=
name
})
this
.
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
...
...
@@ -106,7 +105,7 @@ class CompileTab extends ApiFactory {
yo
.
update
(
this
.
_view
.
contractSelection
,
contractSelection
)
if
(
data
[
'error'
])
{
this
.
_deps
.
renderer
.
error
(
data
[
'error'
].
formattedMessage
,
this
.
_view
.
errorContainer
,
{
type
:
data
[
'error'
].
severity
||
'error'
})
this
.
renderer
.
error
(
data
[
'error'
].
formattedMessage
,
this
.
_view
.
errorContainer
,
{
type
:
data
[
'error'
].
severity
||
'error'
})
if
(
data
[
'error'
].
mode
===
'panic'
)
{
return
modalDialogCustom
.
alert
(
yo
`<div><i class="fa fa-exclamation-circle
${
css
.
panicError
}
" aria-hidden="true"></i>
The compiler returned with the following internal error: <br> <b>
${
data
[
'error'
].
formattedMessage
}
.<br>
...
...
@@ -117,12 +116,12 @@ class CompileTab extends ApiFactory {
}
if
(
data
.
errors
&&
data
.
errors
.
length
)
{
data
.
errors
.
forEach
((
err
)
=>
{
if
(
this
.
_deps
.
config
.
get
(
'hideWarnings'
))
{
if
(
this
.
config
.
get
(
'hideWarnings'
))
{
if
(
err
.
severity
!==
'warning'
)
{
this
.
_deps
.
renderer
.
error
(
err
.
formattedMessage
,
this
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
this
.
renderer
.
error
(
err
.
formattedMessage
,
this
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
}
}
else
{
this
.
_deps
.
renderer
.
error
(
err
.
formattedMessage
,
this
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
this
.
renderer
.
error
(
err
.
formattedMessage
,
this
.
_view
.
errorContainer
,
{
type
:
err
.
severity
})
}
})
}
...
...
@@ -215,7 +214,7 @@ class CompileTab extends ApiFactory {
if
(
contract
.
metadata
===
undefined
||
contract
.
metadata
.
length
===
0
)
{
modalDialogCustom
.
alert
(
'This contract may be abstract, may not implement an abstract parent
\'
s methods completely or not invoke an inherited contract
\'
s constructor correctly.'
)
}
else
{
publishOnSwarm
(
contract
,
this
.
_deps
.
fileManager
,
function
(
err
,
uploaded
)
{
publishOnSwarm
(
contract
,
this
.
fileManager
,
function
(
err
,
uploaded
)
{
if
(
err
)
{
try
{
err
=
JSON
.
stringify
(
err
)
...
...
@@ -229,7 +228,7 @@ class CompileTab extends ApiFactory {
modalDialogCustom
.
alert
(
yo
`<span>Metadata published successfully.<br> <pre>
${
result
}
</pre> </span>`
)
}
},
(
item
)
=>
{
// triggered each time there's a new verified publish (means hash correspond)
this
.
_deps
.
swarmfileProvider
.
addReadOnly
(
item
.
hash
,
item
.
content
)
this
.
swarmfileProvider
.
addReadOnly
(
item
.
hash
,
item
.
content
)
})
}
}
...
...
@@ -339,7 +338,7 @@ class CompileTab extends ApiFactory {
this
.
_view
.
errorContainer
=
yo
`<div></div>`
this
.
_view
.
contractSelection
=
this
.
contractSelection
()
this
.
_view
.
compilerContainer
=
this
.
compilerContainer
.
render
()
const
currentFile
=
this
.
_deps
.
fileManager
.
currentFile
()
const
currentFile
=
this
.
fileManager
.
currentFile
()
if
(
currentFile
)
this
.
compilerContainer
.
currentFile
=
currentFile
this
.
_view
.
el
=
yo
`
...
...
src/app/tabs/settings-tab.js
View file @
1628905d
This diff is collapsed.
Click to expand it.
src/app/tabs/styles/settings-tab-styles.js
View file @
1628905d
var
csjs
=
require
(
'csjs-inject'
)
var
css
=
csjs
`
const
css
=
csjs
`
.settingsTabView {
padding: 2%;
display: flex;
}
.info {
margin-bottom:
1
em;
margin-bottom:
.6r
em;
word-break: break-word;
font-size: .8rem;
}
.info h7 {
margin-bottom: .5rem;
}
.title {
font-size: 1.1em;
font-weight: bold;
margin-bottom: 1em;
// font-size: 1.1em;
// font-weight: bold;
// margin-bottom: 1em;
}
.frow {
margin-bottom: .5rem;
}
.crow {
display: flex;
overflow: auto;
clear: both;
padding: .2em;
//
display: flex;
//
overflow: auto;
//
clear: both;
//
padding: .2em;
}
.checkboxText {
font-weight: normal;
...
...
@@ -35,10 +41,6 @@ var css = csjs`
padding: .5em;
font-weight: bold;
}
.select {
font-weight: bold;
margin-top: 1em;
}
.heading {
margin-bottom: 0;
}
...
...
@@ -49,6 +51,7 @@ var css = csjs`
input {
margin-right: 5px;
cursor: pointer;
width: inherit;
}
input[type=radio] {
margin-top: 2px;
...
...
@@ -56,24 +59,36 @@ var css = csjs`
.pluginTextArea {
font-family: unset;
}
.pluginLoad {
vertical-align: top;
}
i.warnIt {
color: var(--warning);
.removePlugin {
cursor: pointer;
}
.icon {
margin-right: .5em;
}
.remixdinstallation {
padding: 3px;
border-radius: 2px;
margin-left: 5px;
}
.savegisttoken {
margin-left: 5px;
}
}
.aPlugin {
display: inline-block;
padding-left: 10px;
padding-top: 4px;
padding-bottom: 6px;
max-width: 100px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
vertical-align: middle;
}
.removePlugin{
padding-left: 7px;
padding-right: 7px;
margin-left: 10px;
}
.inline {
display: inline;
width: 50%;
}
`
module
.
exports
=
css
src/app/tabs/styles/tabbed-menu-styles.js
deleted
100644 → 0
View file @
90933b0d
const
csjs
=
require
(
'csjs-inject'
)
const
css
=
csjs
`
.menu {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
.active {
}
.options {
float: left;
padding-top: 0.7em;
min-width: 60px;
font-size: 0.9em;
cursor: pointer;
font-size: 1em;
text-align: center;
}
.optionViews {
overflow: scroll;
height: 100%;
}
.optionViews > div {
display: none;
}
.optionViews .pre {
word-wrap: break-word;
border-radius: 3px;
display: inline-block;
padding: 0 0.6em;
}
`
module
.
exports
=
css
src/app/tabs/support-tab.js
deleted
100644 → 0
View file @
90933b0d
const
yo
=
require
(
'yo-yo'
)
var
css
=
require
(
'./styles/support-tab-styles'
)
import
{
ApiFactory
}
from
'remix-plugin'
class
SupportTab
extends
ApiFactory
{
constructor
(
localRegistry
)
{
super
()
this
.
el
=
null
this
.
gitterIframe
=
''
this
.
gitterIsLoaded
=
false
}
__showing
()
{
if
(
this
.
gitterIsLoaded
)
return
const
iframe
=
yo
`<iframe class="
${
css
.
chatIframe
}
" src='https://gitter.im/ethereum/remix/~embed'></iframe>`
this
.
gitterIframe
.
parentNode
.
replaceChild
(
iframe
,
this
.
gitterIframe
)
this
.
gitterIframe
=
iframe
this
.
el
.
style
.
display
=
'block'
this
.
gitterIsLoaded
=
true
}
get
profile
()
{
return
{
name
:
'support'
,
methods
:
[],
events
:
[],
icon
:
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03MDQgMTkycTAtMjYtMTktNDV0LTQ1LTE5LTQ1IDE5LTE5IDQ1IDE5IDQ1IDQ1IDE5IDQ1LTE5IDE5LTQ1em04OTYtMzJ2MzIwcTAgMTYtMTIgMjUtOCA3LTIwIDctNCAwLTctMWwtNDQ4LTk2cS0xMS0yLTE4LTExdC03LTIwaC0yNTZ2MTAycTExMSAyMyAxODMuNSAxMTF0NzIuNSAyMDN2ODAwcTAgMjYtMTkgNDV0LTQ1IDE5aC01MTJxLTI2IDAtNDUtMTl0LTE5LTQ1di04MDBxMC0xMDYgNjIuNS0xOTAuNXQxNjEuNS0xMTQuNXYtMTExaC0zMnEtNTkgMC0xMTUgMjMuNXQtOTEuNSA1My02NiA2Ni41LTQwLjUgNTMuNS0xNCAyNC41cS0xNyAzNS01NyAzNS0xNiAwLTI5LTctMjMtMTItMzEuNS0zN3QzLjUtNDlxNS0xMCAxNC41LTI2dDM3LjUtNTMuNSA2MC41LTcwIDg1LTY3IDEwOC41LTUyLjVxLTI1LTQyLTI1LTg2IDAtNjYgNDctMTEzdDExMy00NyAxMTMgNDcgNDcgMTEzcTAgMzMtMTQgNjRoMzAycTAtMTEgNy0yMHQxOC0xMWw0NDgtOTZxMy0xIDctMSAxMiAwIDIwIDcgMTIgOSAxMiAyNXoiLz48L3N2Zz4='
,
description
:
'help center'
}
}
render
()
{
if
(
this
.
el
)
return
this
.
el
this
.
gitterIframe
=
yo
`<div></div>`
const
remixd
=
yo
`
<div class="
${
css
.
info
}
">
<div class=
${
css
.
title
}
>Accessing local files</div>
<div class="
${
css
.
crow
}
">
Remixd is a tool which allow Remix IDE to access files located in your local computer.
it can also be used to setup a development environment.
</div>
<div class="
${
css
.
crow
}
">More infos:</div>
<div class="
${
css
.
crow
}
"><a target="_blank" href="https://github.com/ethereum/remixd"> https://github.com/ethereum/remixd</a></div>
<div class="
${
css
.
crow
}
"><a target="_blank" href="https://remix.readthedocs.io/en/latest/tutorial_remixd_filesystem">http://remix.readthedocs.io/en/latest/tutorial_remixd_filesystem.html</a></div>
<div class="
${
css
.
crow
}
">Installation: <pre class=
${
css
.
remixdinstallation
}
>npm install remixd -g</pre></div>
</div>`
const
localremixd
=
yo
`
<div class="
${
css
.
info
}
">
<div class=
${
css
.
title
}
>Running Remix locally</div>
<div class="
${
css
.
crow
}
">
as a NPM module:
</div>
<a target="_blank" href="https://www.npmjs.com/package/remix-ide">https://www.npmjs.com/package/remix-ide</a>
<pre class=
${
css
.
remixdinstallation
}
>npm install remix-ide -g</pre>
<div class="
${
css
.
crow
}
">
as an electron app:
</div>
<a target="_blank" href="https://github.com/horizon-games/remix-app">https://github.com/horizon-games/remix-app</a>
</div>`
this
.
el
=
yo
`
<div class="
${
css
.
supportTabView
}
" id="supportView">
<div class="
${
css
.
infoBox
}
">
Have a question, found a bug or want to propose a feature? Have a look at the
<a target="_blank" href='https://github.com/ethereum/remix-ide/issues'> issues</a> or check out
<a target="_blank" href='https://remix.readthedocs.io/en/latest/'> the documentation page on Remix</a> or
<a target="_blank" href='https://solidity.readthedocs.io/en/latest/'> Solidity</a>.
</div>
<div class="
${
css
.
chat
}
">
<div class="
${
css
.
chatTitle
}
" onclick=
${()
=>
{
window
.
open
(
'https://gitter.im/ethereum/remix'
)
}}
title
=
'Click to open chat in Gitter'
>
<
div
class
=
"${css.chatTitleText}"
>
ethereum
/
remix
community
chat
<
/div
>
<
/div
>
$
{
this
.
gitterIframe
}
</div>
${
remixd
}
${
localremixd
}
</div>`
return
this
.
el
}
}
module
.
exports
=
SupportTab
src/app/tabs/tabbed-menu.js
deleted
100644 → 0
View file @
90933b0d
var
yo
=
require
(
'yo-yo'
)
var
css
=
require
(
'./styles/tabbed-menu-styles'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
helper
=
require
(
'../../lib/helper'
)
var
EventManager
=
require
(
'../../lib/events'
)
class
TabbedMenu
{
constructor
(
localRegistry
)
{
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
_deps
=
{
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
}
self
.
_view
=
{
el
:
null
,
viewport
:
null
,
tabs
:
{},
contents
:
{}
}
}
render
()
{
const
self
=
this
if
(
self
.
_view
.
el
)
return
self
.
_view
.
el
self
.
_view
.
el
=
yo
`<ul class=
${
css
.
menu
}
>
${
Object
.
values
(
self
.
_view
.
tabs
)}
</ul>`
return
self
.
_view
.
el
}
renderViewport
()
{
const
self
=
this
if
(
self
.
_view
.
viewport
)
return
self
.
_view
.
viewport
self
.
_view
.
viewport
=
yo
`
<div id="optionViews" class=
${
css
.
optionViews
}
>
${
Object
.
values
(
self
.
_view
.
contents
)}
</div>`
return
self
.
_view
.
viewport
}
addTab
(
title
,
cssClass
,
content
)
{
const
self
=
this
if
(
helper
.
checkSpecialChars
(
title
))
return
if
(
self
.
_view
.
contents
[
title
]
||
self
.
_view
.
tabs
[
title
])
throw
new
Error
(
'tab already exists'
)
self
.
_view
.
contents
[
title
]
=
content
self
.
_view
.
tabs
[
title
]
=
yo
`<li class="
${
css
.
options
}
${
cssClass
}
" onclick=
${
function
(
ev
)
{
self
.
selectTab
(
this
)
}
} title=
${
title
}
>
${
title
}
</li>`
if
(
self
.
_view
.
el
)
self
.
_view
.
el
.
appendChild
(
self
.
_view
.
tabs
[
title
])
if
(
self
.
_view
.
viewport
)
self
.
_view
.
viewport
.
appendChild
(
self
.
_view
.
contents
[
title
])
}
removeTabByTitle
(
title
)
{
const
self
=
this
if
(
self
.
_view
.
tabs
[
title
])
{
self
.
_view
.
tabs
[
title
].
parentNode
.
removeChild
(
self
.
_view
.
tabs
[
title
])
}
if
(
self
.
_view
.
contents
[
title
])
{
self
.
_view
.
contents
[
title
].
parentNode
.
removeChild
(
self
.
_view
.
contents
[
title
])
}
delete
self
.
_view
.
contents
[
title
]
delete
self
.
_view
.
tabs
[
title
]
}
getTabByClass
(
tabClass
)
{
const
self
=
this
return
self
.
_view
.
el
.
querySelector
(
`li.
${
tabClass
}
`
)
}
updateTabTitle
(
tabClass
,
title
)
{
const
self
=
this
var
tab
=
self
.
getTabByClass
(
tabClass
)
if
(
tab
)
tab
.
innerHTML
=
title
}
selectTabByTitle
(
title
)
{
const
self
=
this
self
.
selectTab
(
self
.
_view
.
tabs
[
title
])
}
selectTabByClassName
(
tabClass
)
{
const
self
=
this
var
tab
=
self
.
getTabByClass
(
tabClass
)
if
(
tab
)
self
.
selectTab
(
tab
)
return
tab
}
selectTab
(
el
)
{
const
self
=
this
if
(
!
el
.
classList
.
contains
(
css
.
active
))
{
var
nodes
=
Object
.
values
(
self
.
_view
.
tabs
)
for
(
var
i
=
0
;
i
<
nodes
.
length
;
++
i
)
{
nodes
[
i
].
classList
.
remove
(
css
.
active
)
self
.
_view
.
contents
[
nodes
[
i
].
getAttribute
(
'title'
)].
style
.
display
=
'none'
}
}
var
title
=
el
.
getAttribute
(
'title'
)
self
.
_view
.
contents
[
el
.
getAttribute
(
'title'
)].
style
.
display
=
'block'
el
.
classList
.
add
(
css
.
active
)
self
.
_deps
.
app
.
event
.
trigger
(
'tabChanged'
,
[
title
])
}
}
module
.
exports
=
TabbedMenu
src/app/tabs/test-tab.js
View file @
1628905d
This diff is collapsed.
Click to expand it.
src/app/tabs/testTab/testTab.js
0 → 100644
View file @
1628905d
var
helper
=
require
(
'../../../lib/helper.js'
)
var
modalDialogCustom
=
require
(
'../../ui/modal-dialog-custom'
)
class
TestTabLogic
{
constructor
(
fileManager
)
{
this
.
fileManager
=
fileManager
}
generateTestFile
()
{
var
path
=
this
.
fileManager
.
currentPath
()
var
fileProvider
=
this
.
fileManager
.
fileProviderOf
(
path
)
if
(
!
fileProvider
)
return
helper
.
createNonClashingNameWithPrefix
(
path
+
'/test.sol'
,
fileProvider
,
'_test'
,
(
error
,
newFile
)
=>
{
if
(
error
)
return
modalDialogCustom
.
alert
(
'Failed to create file. '
+
newFile
+
' '
+
error
)
if
(
!
fileProvider
.
set
(
newFile
,
this
.
generateTestContractSample
()))
return
modalDialogCustom
.
alert
(
'Failed to create test file '
+
newFile
)
this
.
fileManager
.
switchFile
(
newFile
)
})
}
async
getTests
(
cb
)
{
var
path
=
this
.
fileManager
.
currentPath
()
if
(
!
path
)
return
cb
(
null
,
[])
var
provider
=
this
.
fileManager
.
fileProviderOf
(
path
)
if
(
!
provider
)
return
cb
(
null
,
[])
var
tests
=
[]
let
files
try
{
files
=
await
this
.
fileManager
.
getFilesFromPath
(
path
)
}
catch
(
e
)
{
cb
(
e
.
message
)
}
for
(
var
file
in
files
)
{
if
(
/.
(
_test.sol
)
$/
.
exec
(
file
))
tests
.
push
(
provider
.
type
+
'/'
+
file
)
}
cb
(
null
,
tests
)
}
generateTestContractSample
()
{
return
`pragma solidity >=0.4.0 <0.6.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.
// file name has to end with '_test.sol'
contract test_1 {
function beforeAll() public {
// here should instantiate tested contract
Assert.equal(uint(4), uint(3), "error in before all function");
}
function check1() public {
// use 'Assert' to test the contract
Assert.equal(uint(2), uint(1), "error message");
Assert.equal(uint(2), uint(2), "error message");
}
function check2() public view returns (bool) {
// use the return value (true or false) to test the contract
return true;
}
}
contract test_2 {
function beforeAll() public {
// here should instantiate tested contract
Assert.equal(uint(4), uint(3), "error in before all function");
}
function check1() public {
// use 'Assert' to test the contract
Assert.equal(uint(2), uint(1), "error message");
Assert.equal(uint(2), uint(2), "error message");
}
function check2() public view returns (bool) {
// use the return value (true or false) to test the contract
return true;
}
}`
}
}
module
.
exports
=
TestTabLogic
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