|
|
@ -1,10 +1,10 @@ |
|
|
|
import React from 'react' // eslint-disable-line
|
|
|
|
import React from 'react' // eslint-disable-line
|
|
|
|
import { ViewPlugin } from '@remixproject/engine-web' |
|
|
|
import { ViewPlugin } from '@remixproject/engine-web' |
|
|
|
import ReactDOM from 'react-dom' |
|
|
|
|
|
|
|
import { EventEmitter } from 'events' |
|
|
|
import { EventEmitter } from 'events' |
|
|
|
import {RemixUiStaticAnalyser} from '@remix-ui/static-analyser' // eslint-disable-line
|
|
|
|
import {RemixUiStaticAnalyser} from '@remix-ui/static-analyser' // eslint-disable-line
|
|
|
|
import * as packageJson from '../../../../../package.json' |
|
|
|
import * as packageJson from '../../../../../package.json' |
|
|
|
import Registry from '../state/registry' |
|
|
|
import Registry from '../state/registry' |
|
|
|
|
|
|
|
import { ViewPluginUI } from '../components/ViewPluginUI' |
|
|
|
|
|
|
|
|
|
|
|
var EventManager = require('../../lib/events') |
|
|
|
var EventManager = require('../../lib/events') |
|
|
|
|
|
|
|
|
|
|
@ -35,6 +35,7 @@ class AnalysisTab extends ViewPlugin { |
|
|
|
offsetToLineColumnConverter: this.registry.get( |
|
|
|
offsetToLineColumnConverter: this.registry.get( |
|
|
|
'offsettolinecolumnconverter').api |
|
|
|
'offsettolinecolumnconverter').api |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.dispatch = null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async onActivation () { |
|
|
|
async onActivation () { |
|
|
@ -43,33 +44,40 @@ class AnalysisTab extends ViewPlugin { |
|
|
|
await this.call('manager', 'activatePlugin', 'solidity') |
|
|
|
await this.call('manager', 'activatePlugin', 'solidity') |
|
|
|
} |
|
|
|
} |
|
|
|
this.renderComponent() |
|
|
|
this.renderComponent() |
|
|
|
|
|
|
|
this.event.register('staticAnaysisWarning', (count) => { |
|
|
|
|
|
|
|
if (count > 0) { |
|
|
|
|
|
|
|
this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning' }) |
|
|
|
|
|
|
|
} else if (count === 0) { |
|
|
|
|
|
|
|
this.emit('statusChanged', { key: 'succeed', title: 'no warning', type: 'success' }) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// count ==-1 no compilation result
|
|
|
|
|
|
|
|
this.emit('statusChanged', { key: 'none' }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setDispatch (dispatch) { |
|
|
|
|
|
|
|
this.dispatch = dispatch |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
render () { |
|
|
|
return this.element |
|
|
|
return <div id='staticAnalyserView'><ViewPluginUI plugin={this} /></div> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateComponent(state) { |
|
|
|
|
|
|
|
return <RemixUiStaticAnalyser |
|
|
|
|
|
|
|
registry={state.registry} |
|
|
|
|
|
|
|
analysisModule={state} |
|
|
|
|
|
|
|
event={state.event} |
|
|
|
|
|
|
|
/> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderComponent () { |
|
|
|
renderComponent () { |
|
|
|
ReactDOM.render( |
|
|
|
this.dispatch({ |
|
|
|
<RemixUiStaticAnalyser |
|
|
|
registry: this.registry, |
|
|
|
registry={this.registry} |
|
|
|
analysisModule: this, |
|
|
|
analysisModule={this} |
|
|
|
event: this.event |
|
|
|
event={this.event} |
|
|
|
}) |
|
|
|
/>, |
|
|
|
|
|
|
|
this.element, |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
this.event.register('staticAnaysisWarning', (count) => { |
|
|
|
|
|
|
|
if (count > 0) { |
|
|
|
|
|
|
|
this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning' }) |
|
|
|
|
|
|
|
} else if (count === 0) { |
|
|
|
|
|
|
|
this.emit('statusChanged', { key: 'succeed', title: 'no warning', type: 'success' }) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// count ==-1 no compilation result
|
|
|
|
|
|
|
|
this.emit('statusChanged', { key: 'none' }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|