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
bb35bb58
Commit
bb35bb58
authored
Oct 13, 2017
by
ninabreznik
Committed by
yann300
Nov 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor run tab (value, create and atAddress buttons, instance title)
parent
037522c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
16 deletions
+42
-16
app.js
src/app.js
+7
-2
run-tab.js
src/app/tabs/run-tab.js
+21
-7
universal-dapp.js
src/universal-dapp.js
+14
-7
No files found.
src/app.js
View file @
bb35bb58
...
@@ -214,8 +214,13 @@ function run () {
...
@@ -214,8 +214,13 @@ function run () {
},
},
getValue
:
(
cb
)
=>
{
getValue
:
(
cb
)
=>
{
try
{
try
{
var
comp
=
$
(
'#value'
).
val
().
split
(
' '
)
var
number
=
document
.
querySelector
(
'#value'
).
value
cb
(
null
,
executionContext
.
web3
().
toWei
(
comp
[
0
],
comp
.
slice
(
1
).
join
(
' '
)))
var
select
=
document
.
getElementById
(
'unit'
)
var
index
=
select
.
selectedIndex
var
selectedUnit
=
select
.
querySelectorAll
(
'option'
)[
index
].
innerHTML
var
unit
=
''
if
(
selectedUnit
===
'wei'
)
{
unit
=
'wei'
}
cb
(
null
,
executionContext
.
web3
().
toWei
(
number
,
unit
))
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
e
)
cb
(
e
)
}
}
...
...
src/app/tabs/run-tab.js
View file @
bb35bb58
...
@@ -45,6 +45,16 @@ var css = csjs`
...
@@ -45,6 +45,16 @@ var css = csjs`
.col2 {
.col2 {
${
styles
.
rightPanel
.
runTab
.
input_RunTab
}
${
styles
.
rightPanel
.
runTab
.
input_RunTab
}
}
}
.col2_1 {
${
styles
.
rightPanel
.
runTab
.
input_RunTab
}
width: 165px;
min-width: 165px;
}
.col2_2 {
${
styles
.
rightPanel
.
runTab
.
dropdown_RunTab
}
width: 82px;
min-width: 82px;
}
.select {
.select {
${
styles
.
rightPanel
.
runTab
.
dropdown_RunTab
}
${
styles
.
rightPanel
.
runTab
.
dropdown_RunTab
}
font-weight: normal;
font-weight: normal;
...
@@ -254,8 +264,8 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
...
@@ -254,8 +264,8 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
}
}
})
})
var
atAddressButtonInput
=
yo
`<input class="
${
css
.
input
}
ataddressinput" placeholder="Enter
contract's address - i.e. 0x60606...
" title="atAddress" />`
var
atAddressButtonInput
=
yo
`<input class="
${
css
.
input
}
ataddressinput" placeholder="Enter
address of contract you want to load
" title="atAddress" />`
var
createButtonInput
=
yo
`<input class="
${
css
.
input
}
" placeholder="" title="
c
reate" />`
var
createButtonInput
=
yo
`<input class="
${
css
.
input
}
" placeholder="" title="
C
reate" />`
var
selectContractNames
=
yo
`<select class="
${
css
.
contractNames
}
" disabled></select>`
var
selectContractNames
=
yo
`<select class="
${
css
.
contractNames
}
" disabled></select>`
var
el
=
yo
`
var
el
=
yo
`
<div class="
${
css
.
container
}
">
<div class="
${
css
.
container
}
">
...
@@ -264,12 +274,12 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
...
@@ -264,12 +274,12 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
</div>
</div>
<div class="
${
css
.
buttons
}
">
<div class="
${
css
.
buttons
}
">
<div class="
${
css
.
button
}
">
<div class="
${
css
.
button
}
">
<div class="
${
css
.
atAddress
}
" onclick=
${
function
()
{
loadFromAddress
(
appAPI
)
}
}>At Address</div>
${
createButtonInput
}
${
atAddressButtonInput
}
<div class="
${
css
.
create
}
" onclick=
${
function
()
{
createInstance
()
}
} >Create</div>
</div>
</div>
<div class="
${
css
.
button
}
">
<div class="
${
css
.
button
}
">
<div class="
${
css
.
create
}
" onclick=
${
function
()
{
createInstance
()
}
} >Create</div>
${
atAddressButtonInput
}
${
createButtonInput
}
<div class="
${
css
.
atAddress
}
" onclick=
${
function
()
{
loadFromAddress
(
appAPI
)
}
}>Load</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -412,7 +422,11 @@ function settings (appAPI, appEvents) {
...
@@ -412,7 +422,11 @@ function settings (appAPI, appEvents) {
</div>
</div>
<div class="
${
css
.
crow
}
">
<div class="
${
css
.
crow
}
">
<div class="
${
css
.
col1_1
}
">Value</div>
<div class="
${
css
.
col1_1
}
">Value</div>
<input type="text" class="
${
css
.
col2
}
" id="value" value="0" title="(e.g. .7 ether ...)">
<input type="text" class="
${
css
.
col2_1
}
" id="value" value="0" title="Default the value is set to be in ether, if you want the value to be in wei, type i.e. 7 wei.">
<select name="unit" class="
${
css
.
col2_2
}
" id="unit">
<option id="unit-eth">eth</option>
<option id="unit-wei">wei</option>
</select>
</div>
</div>
</div>
</div>
`
`
...
...
src/universal-dapp.js
View file @
bb35bb58
...
@@ -36,12 +36,15 @@ var css = csjs`
...
@@ -36,12 +36,15 @@ var css = csjs`
justify-content: space-between;
justify-content: space-between;
align-items: center;
align-items: center;
font-size: 11px;
font-size: 11px;
width: 75%;
min-width: 350px;
min-width: 500px;
overflow: hidden;
overflow: hidden;
word-break: break-word;
word-break: break-word;
line-height: initial;
line-height: initial;
}
}
.titleLine {
display: flex;
align-items: baseline;
}
.titleText {
.titleText {
margin-right: 1em;
margin-right: 1em;
word-break: break-word;
word-break: break-word;
...
@@ -295,13 +298,17 @@ UniversalDApp.prototype.renderInstance = function (contract, address, contractNa
...
@@ -295,13 +298,17 @@ UniversalDApp.prototype.renderInstance = function (contract, address, contractNa
address
=
(
address
.
slice
(
0
,
2
)
===
'0x'
?
''
:
'0x'
)
+
address
.
toString
(
'hex'
)
address
=
(
address
.
slice
(
0
,
2
)
===
'0x'
?
''
:
'0x'
)
+
address
.
toString
(
'hex'
)
var
shortAddress
=
helper
.
shortenAddress
(
address
)
var
shortAddress
=
helper
.
shortenAddress
(
address
)
var
title
=
yo
`<div class="
${
css
.
title
}
" onclick=
${
toggleClass
}
>
var
title
=
yo
`
<div class="
${
css
.
titleText
}
">
${
contractName
}
at
${
shortAddress
}
(
${
context
}
) </div>
<div class=
${
css
.
titleLine
}
>
<i class="fa fa-clipboard
${
css
.
copy
}
" aria-hidden="true" onclick=
${
copyToClipboard
}
title='Copy to clipboard'></i>
<div class="
${
css
.
title
}
" onclick=
${
toggleClass
}
>
</div>`
<div class="
${
css
.
titleText
}
">
${
contractName
}
at
${
shortAddress
}
(
${
context
}
) </div>
</div>
<i class="fa fa-clipboard
${
css
.
copy
}
" aria-hidden="true" onclick=
${
copyToClipboard
}
title='Copy to clipboard'></i>
</div>
`
if
(
self
.
removable_instances
)
{
if
(
self
.
removable_instances
)
{
var
close
=
yo
`<div class="
${
css
.
udappClose
}
" onclick=
${
remove
}
><i class="
${
css
.
closeIcon
}
fa fa-close" aria-hidden="true"></i></div>`
var
close
=
yo
`<div class="
${
css
.
udappClose
}
" onclick=
${
remove
}
><i class="
${
css
.
closeIcon
}
fa fa-close" aria-hidden="true"></i></div>`
title
.
appendChild
(
close
)
title
.
querySelector
(
`.
${
css
.
title
}
`
).
appendChild
(
close
)
}
}
function
toggleClass
()
{
function
toggleClass
()
{
...
...
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