warning if static analysis report not empty

pull/1/head
yann300 8 years ago
parent 20d8b428e8
commit 83b60ae480
  1. 2
      assets/css/browser-solidity.css
  2. 24
      src/app.js
  3. 12
      src/app/staticanalysis/staticAnalysisView.js

@ -178,7 +178,7 @@ body {
#header #options li {
float: left;
padding: 0.5em 0.6em;
padding: 0.3em 0.6em;
font-size: 1em;
cursor: pointer;
background-color: transparent;

@ -110,6 +110,27 @@ var run = function () {
self.event.trigger('tabChanged', [cls])
}
function triggerTabWarning (target, cb) {
target = '#header #menu ' + target
$(target).css('background-color', '#d2ca24')
animateTab(target, function () {
$(target).css('opacity', '1')
animateTab(target, function () {
$(target).css('background-color', 'transparent')
$(target).css('opacity', '1')
if (cb) { cb() }
})
})
}
function animateTab (target, cb) {
$(target).animate({
'opacity': 0.3
}, 800, function () {
cb()
})
}
// ------------------ gist publish --------------
$('#gist').click(function () {
@ -449,6 +470,9 @@ var run = function () {
var staticanalysis = new StaticAnalysis(compiler.event, renderer, editor, offsetToLineColumnConverter)
$('#staticanalysisView').append(staticanalysis.render())
staticanalysis.event.register('warning', function () {
triggerTabWarning('.staticanalysisView')
})
var autoCompile = document.querySelector('#autoCompile').checked

@ -2,8 +2,10 @@
var StaticAnalysisRunner = require('./staticAnalysisRunner.js')
var yo = require('yo-yo')
var $ = require('jquery')
var EventManager = require('../../lib/eventManager')
function staticAnalysisView (compilerEvent, renderer, editor, offsetToColumnConverter) {
this.event = new EventManager()
this.view = null
this.renderer = renderer
this.editor = editor
@ -17,6 +19,7 @@ function staticAnalysisView (compilerEvent, renderer, editor, offsetToColumnConv
$('#staticanalysisresult').empty()
if (success) {
self.lastCompilationResult = data
self.run()
}
})
}
@ -77,16 +80,21 @@ staticAnalysisView.prototype.run = function () {
self.renderer.error(location + ' ' + item.warning, warningContainer, false, 'warning')
})
})
if (warningContainer.html() === '') {
warningContainer.html('No warning to report')
} else {
self.event.trigger('warning', [])
}
})
} else {
warningContainer.html('No compiled AST available')
}
}
module.exports = staticAnalysisView
function renderModules (modules) {
return modules.map(function (item, i) {
return yo`<div><input type="checkbox" name="staticanalysismodule" checked='true' index=${i} >${item.name} (${item.description})</div>`
})
}
module.exports = staticAnalysisView

Loading…
Cancel
Save