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
a9bef6b3
Commit
a9bef6b3
authored
May 02, 2019
by
LianaHus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new keys are defined
parent
5afbb847
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
41 deletions
+63
-41
vertical-icons-component.js
src/app/components/vertical-icons-component.js
+52
-30
analysis-tab.js
src/app/tabs/analysis-tab.js
+3
-3
compile-tab.js
src/app/tabs/compile-tab.js
+8
-8
No files found.
src/app/components/vertical-icons-component.js
View file @
a9bef6b3
...
@@ -51,15 +51,18 @@ class VerticalIconComponent {
...
@@ -51,15 +51,18 @@ class VerticalIconComponent {
listenOnStatus
(
api
)
{
listenOnStatus
(
api
)
{
if
(
!
api
.
events
)
return
if
(
!
api
.
events
)
return
// the list of supported keys. 'none' will remove the status
const
keys
=
[
'edited'
,
'success'
,
'none'
,
'spinner'
,
'fail'
]
const
types
=
[
'error'
,
'warning'
,
'success'
,
'info'
,
''
]
const
fn
=
(
status
)
=>
{
const
fn
=
(
status
)
=>
{
if
(
if
(
!
types
.
includes
(
status
.
type
)
&&
status
.
type
)
throw
new
Error
(
`type should be
${
keys
.
join
()}
`
)
status
.
type
===
'warning'
||
if
(
!
status
.
key
)
throw
new
Error
(
`status key should be defined`
)
status
.
type
===
'danger'
||
status
.
key
===
'code'
||
if
(
typeof
status
.
key
===
'string'
&&
(
!
keys
.
includes
(
status
.
key
)))
{
status
.
key
===
'check'
||
throw
new
Error
(
'key should contain either number or '
+
keys
.
join
())
(
status
.
key
===
''
&&
status
.
type
===
''
&&
status
.
title
===
''
))
{
this
.
setIconStatus
(
api
.
profile
.
name
,
status
)
}
}
this
.
setIconStatus
(
api
.
profile
.
name
,
status
)
}
}
this
.
iconStatus
[
api
.
profile
.
name
]
=
fn
this
.
iconStatus
[
api
.
profile
.
name
]
=
fn
api
.
events
.
on
(
'statusChanged'
,
this
.
iconStatus
[
api
.
profile
.
name
])
api
.
events
.
on
(
'statusChanged'
,
this
.
iconStatus
[
api
.
profile
.
name
])
...
@@ -82,6 +85,33 @@ class VerticalIconComponent {
...
@@ -82,6 +85,33 @@ class VerticalIconComponent {
}
}
/**
/**
* resolve a classes list for @arg key
* @param {Object} key
* @param {Object} type
*/
resolveClasses
(
key
,
type
)
{
let
classes
=
css
.
status
switch
(
key
)
{
case
'success'
:
classes
+=
' fas fa-check-circle text-'
+
type
+
' '
+
css
.
statusCheck
break
case
'edited'
:
classes
+=
' fas fa-sync text-'
+
type
+
' '
+
css
.
statusCheck
break
case
'spinner'
:
classes
+=
' fas fa-spinner text-'
+
type
+
' '
+
css
.
statusCheck
break
case
'fail'
:
classes
+=
' fas fa-exclamation-triangle text-'
+
type
+
' '
+
css
.
statusCheck
break
default
:
{
classes
+=
' badge badge-pill badge-'
+
type
}
}
return
classes
}
/**
* Set a new status for the @arg name
* Set a new status for the @arg name
* @param {String} name
* @param {String} name
* @param {Object} status
* @param {Object} status
...
@@ -93,39 +123,31 @@ class VerticalIconComponent {
...
@@ -93,39 +123,31 @@ class VerticalIconComponent {
if
(
statusEl
)
{
if
(
statusEl
)
{
el
.
removeChild
(
statusEl
)
el
.
removeChild
(
statusEl
)
}
}
if
(
status
.
key
)
{
if
(
status
.
key
===
'none'
)
return
// remove status
let
key
=
helper
.
checkSpecialChars
(
status
.
key
)
?
''
:
status
.
key
let
type
=
helper
.
checkSpecialChars
(
status
.
type
)
?
''
:
status
.
type
let
title
=
helper
.
checkSpecialChars
(
status
.
title
)
?
''
:
status
.
title
let
classes
=
css
.
status
let
text
=
''
switch
(
key
)
{
let
key
=
''
case
'check'
:
if
(
typeof
status
.
key
===
'number'
)
{
classes
+=
' fas fa-check-circle text-'
+
type
+
' '
+
css
.
statusCheck
key
=
status
.
key
.
toString
()
break
text
=
key
case
'code'
:
}
else
key
=
helper
.
checkSpecialChars
(
status
.
key
)
?
''
:
status
.
key
classes
+=
' fas fa-sync text-'
+
type
break
let
type
=
''
default
:
if
(
status
.
type
===
'error'
)
{
classes
+=
' badge badge-pill badge-'
+
type
type
=
'danger'
// to use with bootstrap
}
}
else
type
=
helper
.
checkSpecialChars
(
status
.
type
)
?
''
:
status
.
type
let
title
=
helper
.
checkSpecialChars
(
status
.
title
)
?
''
:
status
.
title
el
.
appendChild
(
yo
`<span
el
.
appendChild
(
yo
`<span
title="
${
title
}
"
title="
${
title
}
"
class="
${
classes
}
"
class="
${
this
.
resolveClasses
(
key
,
type
)
}
"
aria-hidden="true"
aria-hidden="true"
>
>
${
key
===
'code'
||
key
===
'check'
?
''
:
key
}
${
text
}
</span>`
)
</span>`
)
// el.classList = "" doesn't work on all browser use instead
var
classList
=
el
.
classList
while
(
classList
.
length
>
0
)
{
classList
.
remove
(
classList
.
item
(
0
))
}
el
.
classList
.
add
(
`
${
css
.
icon
}
`
)
el
.
classList
.
add
(
`
${
css
.
icon
}
`
)
}
}
}
/**
/**
* Remove an icon from the map
* Remove an icon from the map
...
...
src/app/tabs/analysis-tab.js
View file @
a9bef6b3
...
@@ -30,11 +30,11 @@ class AnalysisTab extends BaseApi {
...
@@ -30,11 +30,11 @@ class AnalysisTab extends BaseApi {
if
(
!
this
.
staticanalysis
)
this
.
staticanalysis
=
new
StaticAnalysis
()
if
(
!
this
.
staticanalysis
)
this
.
staticanalysis
=
new
StaticAnalysis
()
this
.
staticanalysis
.
event
.
register
(
'staticAnaysisWarning'
,
(
count
)
=>
{
this
.
staticanalysis
.
event
.
register
(
'staticAnaysisWarning'
,
(
count
)
=>
{
if
(
count
>
0
)
{
if
(
count
>
0
)
{
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
count
.
toString
(),
title
:
count
+
' warnings'
,
type
:
'warning'
})
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
count
,
title
:
`
${
count
}
warning
${
count
===
1
?
''
:
's'
}
`
,
type
:
'warning'
})
}
else
if
(
count
===
0
)
{
}
else
if
(
count
===
0
)
{
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
check
'
,
title
:
'no warning'
,
type
:
'success'
})
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
success
'
,
title
:
'no warning'
,
type
:
'success'
})
}
else
{
}
else
{
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
'
,
title
:
''
,
type
:
'
'
})
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
none
'
})
}
}
})
})
this
.
registry
.
put
({
api
:
this
.
staticanalysis
,
name
:
'staticanalysis'
})
this
.
registry
.
put
({
api
:
this
.
staticanalysis
,
name
:
'staticanalysis'
})
...
...
src/app/tabs/compile-tab.js
View file @
a9bef6b3
...
@@ -77,7 +77,7 @@ class CompileTab extends CompilerApi {
...
@@ -77,7 +77,7 @@ class CompileTab extends CompilerApi {
listenToEvents
()
{
listenToEvents
()
{
let
onContentChanged
=
()
=>
{
let
onContentChanged
=
()
=>
{
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
code
'
,
title
:
'the content has changed, needs recompilation'
,
type
:
'info'
})
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
edited
'
,
title
:
'the content has changed, needs recompilation'
,
type
:
'info'
})
}
}
this
.
editor
.
event
.
register
(
'contentChanged'
,
onContentChanged
)
this
.
editor
.
event
.
register
(
'contentChanged'
,
onContentChanged
)
this
.
editor
.
event
.
register
(
'sessionSwitched'
,
onContentChanged
)
this
.
editor
.
event
.
register
(
'sessionSwitched'
,
onContentChanged
)
...
@@ -87,7 +87,7 @@ class CompileTab extends CompilerApi {
...
@@ -87,7 +87,7 @@ class CompileTab extends CompilerApi {
})
})
this
.
compiler
.
event
.
register
(
'compilerLoaded'
,
()
=>
{
this
.
compiler
.
event
.
register
(
'compilerLoaded'
,
()
=>
{
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
'
,
title
:
''
,
type
:
'
'
})
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
none
'
})
})
})
this
.
compileTabLogic
.
event
.
on
(
'startingCompilation'
,
()
=>
{
this
.
compileTabLogic
.
event
.
on
(
'startingCompilation'
,
()
=>
{
...
@@ -111,7 +111,7 @@ class CompileTab extends CompilerApi {
...
@@ -111,7 +111,7 @@ class CompileTab extends CompilerApi {
const
cleanupErrors
=
()
=>
{
const
cleanupErrors
=
()
=>
{
this
.
_view
.
errorContainer
.
innerHTML
=
''
this
.
_view
.
errorContainer
.
innerHTML
=
''
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
'
,
title
:
''
,
type
:
'
'
})
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
none
'
})
}
}
this
.
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
this
.
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
...
@@ -120,11 +120,11 @@ class CompileTab extends CompilerApi {
...
@@ -120,11 +120,11 @@ class CompileTab extends CompilerApi {
this
.
events
.
emit
(
'compilationFinished'
,
source
.
target
,
source
,
'soljson'
,
data
)
this
.
events
.
emit
(
'compilationFinished'
,
source
.
target
,
source
,
'soljson'
,
data
)
if
(
data
.
errors
)
{
if
(
data
.
errors
)
{
this
.
events
.
emit
(
'statusChanged'
,
{
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
data
.
errors
.
length
.
toString
()
,
key
:
data
.
errors
.
length
,
title
:
'compilation finished successful with warning'
+
data
.
errors
.
length
>
1
?
's'
:
''
,
title
:
`compilation finished successful with warning
${
data
.
errors
.
length
>
1
?
's'
:
''
}
`
,
type
:
'warning'
type
:
'warning'
})
})
}
else
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
check
'
,
title
:
'compilation successful'
,
type
:
'success'
})
}
else
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
'
success
'
,
title
:
'compilation successful'
,
type
:
'success'
})
// Store the contracts
// Store the contracts
this
.
data
.
contractsDetails
=
{}
this
.
data
.
contractsDetails
=
{}
this
.
compiler
.
visitContracts
((
contract
)
=>
{
this
.
compiler
.
visitContracts
((
contract
)
=>
{
...
@@ -135,8 +135,8 @@ class CompileTab extends CompilerApi {
...
@@ -135,8 +135,8 @@ class CompileTab extends CompilerApi {
)
)
})
})
}
else
{
}
else
{
const
count
=
(
data
.
errors
?
data
.
errors
.
filter
(
error
=>
error
.
severity
===
'error'
).
length
:
0
+
data
.
error
?
1
:
0
)
.
toString
()
const
count
=
(
data
.
errors
?
data
.
errors
.
filter
(
error
=>
error
.
severity
===
'error'
).
length
:
0
+
data
.
error
?
1
:
0
)
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
count
,
title
:
'compilation failed'
,
type
:
'
dange
r'
})
this
.
events
.
emit
(
'statusChanged'
,
{
key
:
count
,
title
:
'compilation failed'
,
type
:
'
erro
r'
})
}
}
// Update contract Selection
// Update contract Selection
let
contractMap
=
{}
let
contractMap
=
{}
...
...
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