new satus icons

pull/1/head
LianaHus 6 years ago
parent 640882f851
commit 1844d2dd05
  1. 33
      src/app/components/vertical-icons-component.js
  2. 8
      src/app/staticanalysis/staticAnalysisView.js
  3. 2
      src/app/tabs/compile-tab.js

@ -52,7 +52,14 @@ class VerticalIconComponent {
listenOnStatus (api) {
if (!api.events) return
const fn = (status) => {
this.setIconStatus(api.profile.name, status)
if (
status.type === 'warning' ||
status.type === 'danger' ||
status.key === 'code' ||
status.key === 'check' ||
(status.key === '' && status.type === '' && status.title === '')) {
this.setIconStatus(api.profile.name, status)
}
}
this.iconStatus[api.profile.name] = fn
api.events.on('statusChanged', this.iconStatus[api.profile.name])
@ -90,17 +97,33 @@ class VerticalIconComponent {
let key = helper.checkSpecialChars(status.key) ? '' : status.key
let type = helper.checkSpecialChars(status.type) ? '' : status.type
let title = helper.checkSpecialChars(status.title) ? '' : status.title
el.appendChild(yo`<span title="${title}" class="badge badge-pill badge-${type} ${css.status}" aria-hidden="true">3</span>`)
let classes = css.status
switch (key) {
case 'check':
classes += ' badge badge-pill badge-' + type + ' text-' + type
break
case 'code':
classes += ' fas fa-sync text-' + type
break
default:
classes += ' badge badge-pill badge-' + type
}
el.appendChild(yo`<span
title="${title}"
class="${classes}"
aria-hidden="true"
>
${key === 'code' ? '' : key === 'check' ? 'o' : key}
</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('border')
//el.classList.add(`border-${type}`)
}
}

@ -99,7 +99,7 @@ staticAnalysisView.prototype.run = function () {
var warningContainer = $('#staticanalysisresult')
warningContainer.empty()
var self = this
if (this.lastCompilationResult) {
if (this.lastCompilationResult && selected.length) {
var warningCount = 0
this.runner.run(this.lastCompilationResult, selected, function (results) {
results.map(function (result, i) {
@ -126,8 +126,10 @@ staticAnalysisView.prototype.run = function () {
self.event.trigger('staticAnaysisWarning', [warningCount])
})
} else {
warningContainer.html('No compiled AST available')
self.event.trigger('staticAnaysisWarning', [0])
if (selected.length) {
warningContainer.html('No compiled AST available')
}
self.event.trigger('staticAnaysisWarning', [-1])
}
}

@ -122,7 +122,7 @@ class CompileTab extends CompilerApi {
)
})
} else {
this.events.emit('statusChanged', {key: 'exclamation', title: 'compilation failed', type: 'danger'})
this.events.emit('statusChanged', {key: data.errors.length.toString(), title: 'compilation failed', type: 'danger'})
}
// Update contract Selection
let contractMap = {}

Loading…
Cancel
Save