diff --git a/src/app.js b/src/app.js index 7b5d78ec5b..a92e943933 100644 --- a/src/app.js +++ b/src/app.js @@ -28,7 +28,6 @@ var Renderer = require('./app/ui/renderer') var Compiler = require('remix-solidity').Compiler var executionContext = require('./execution-context') var Debugger = require('./app/debugger/debugger') -var StaticAnalysis = require('./app/staticanalysis/staticAnalysisView') var FilePanel = require('./app/panels/file-panel') var EditorPanel = require('./app/panels/editor-panel') var RighthandPanel = require('./app/panels/righthand-panel') @@ -483,19 +482,12 @@ Please make a backup of your contracts and start using http://remix.ethereum.org var renderer = new Renderer() registry.put({api: renderer, name: 'renderer'}) - // ----------------- StaticAnalysis ----------------- - var staticanalysis = new StaticAnalysis() - registry.put({api: staticanalysis, name: 'staticanalysis'}) - // ---------------- Righthand-panel -------------------- self._components.righthandpanel = new RighthandPanel() self._view.rightpanel.appendChild(self._components.righthandpanel.render()) self._components.righthandpanel.init() self._components.righthandpanel.event.register('resize', delta => self._adjustLayout('right', delta)) - var node = document.getElementById('staticanalysisView') - node.insertBefore(staticanalysis.render(), node.childNodes[0]) - // ----------------- Debugger ----------------- self._view.transactionDebugger = new Debugger('#debugger', new SourceHighlighter()) self._view.transactionDebugger.addProvider('vm', executionContext.vm()) diff --git a/src/app/panels/righthand-panel.js b/src/app/panels/righthand-panel.js index aca26f259b..acfa33e690 100644 --- a/src/app/panels/righthand-panel.js +++ b/src/app/panels/righthand-panel.js @@ -57,7 +57,11 @@ module.exports = class RighthandPanel { pluginAPI, self._deps.app, self._deps.compiler, - self._deps.txlistener) + self._deps.txlistener + ) + + var analysisTab = new AnalysisTab(self._components.registry) + analysisTab.event.register('newStaticAnaysisWarningMessage', (msg, settings) => { self._components.compile.addWarning(msg, settings) }) self._components = { pluginManager: pluginManager, @@ -65,7 +69,7 @@ module.exports = class RighthandPanel { compile: new CompileTab(self._components.registry), run: new RunTab(self._components.registry), settings: new SettingsTab(self._components.registry), - analysis: new AnalysisTab(self._components.registry), + analysis: analysisTab, debug: new DebuggerTab(self._components.registry), support: new SupportTab(self._components.registry), test: new TestTab(self._components.registry) diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 16a7c06c04..b937d1ab87 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -1,6 +1,7 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') var remixLib = require('remix-lib') +var StaticAnalysis = require('../staticanalysis/staticAnalysisView') var globalRegistry = require('../../global/registry') var EventManager = remixLib.EventManager @@ -13,12 +14,23 @@ module.exports = class AnalysisTab { self.data = {} self._components = {} self._components.registry = localRegistry || globalRegistry + self._deps = { + rightHandPanel: self._components.registry.get('righthandpanel').api + } } render () { const self = this + var staticanalysis = new StaticAnalysis() + staticanalysis.event.register('staticAnaysisWarning', (count) => { + const msg = `Static Analysis raised ${count} warning(s) that requires your attention. Click here to show the warning(s).` + const settings = { type: 'staticAnalysisWarning', click: () => self._deps.rightHandPanel.focusOn('staticanalysisView'), useSpan: true } + self.event.trigger('newStaticAnaysisWarningMessage', [msg, settings]) + }) + self._components.registry.put({api: staticanalysis, name: 'staticanalysis'}) if (self._view.el) return self._view.el self._view.el = yo` -
` +