Merge branch 'master' into master

pull/3094/head
yann300 7 years ago committed by GitHub
commit 6ded27c45c
  1. 19
      src/app/tabs/compile-tab.js
  2. 5
      src/universal-dapp-styles.js

@ -31,6 +31,7 @@ module.exports = class CompileTab {
contractEl: null contractEl: null
} }
self.data = { self.data = {
hideWarnings: self._opts.config.get('hideWarnings') || false,
autoCompile: self._opts.config.get('autoCompile'), autoCompile: self._opts.config.get('autoCompile'),
compileTimeout: null, compileTimeout: null,
contractsDetails: {}, contractsDetails: {},
@ -115,7 +116,13 @@ module.exports = class CompileTab {
if (data.errors && data.errors.length) { if (data.errors && data.errors.length) {
error = true error = true
data.errors.forEach(function (err) { data.errors.forEach(function (err) {
self._opts.renderer.error(err.formattedMessage, self._view.errorContainer, {type: err.severity}) if (self._opts.config.get('hideWarnings')) {
if (err.severity !== 'warning') {
self._opts.renderer.error(err.formattedMessage, self._view.errorContainer, {type: err.severity})
}
} else {
self._opts.renderer.error(err.formattedMessage, self._view.errorContainer, {type: err.severity})
}
}) })
} }
if (!error && data.contracts) { if (!error && data.contracts) {
@ -139,7 +146,9 @@ module.exports = class CompileTab {
self._view.compileIcon = yo`<i class="fa fa-refresh ${css.icon}" aria-hidden="true"></i>` self._view.compileIcon = yo`<i class="fa fa-refresh ${css.icon}" aria-hidden="true"></i>`
self._view.compileButton = yo`<div class="${css.compileButton}" onclick=${compile} id="compile" title="Compile source code">${self._view.compileIcon} Start to compile</div>` self._view.compileButton = yo`<div class="${css.compileButton}" onclick=${compile} id="compile" title="Compile source code">${self._view.compileIcon} Start to compile</div>`
self._view.autoCompile = yo`<input class="${css.autocompile}" onchange=${updateAutoCompile} id="autoCompile" type="checkbox" title="Auto compile">` self._view.autoCompile = yo`<input class="${css.autocompile}" onchange=${updateAutoCompile} id="autoCompile" type="checkbox" title="Auto compile">`
self._view.hideWarningsBox = yo`<input class="${css.autocompile}" onchange=${hideWarnings} id="hideWarningsBox" type="checkbox" title="Hide warnings">`
if (self.data.autoCompile) self._view.autoCompile.setAttribute('checked', '') if (self.data.autoCompile) self._view.autoCompile.setAttribute('checked', '')
if (self.data.hideWarnings) self._view.hideWarningsBox.setAttribute('checked', '')
self._view.compileContainer = yo` self._view.compileContainer = yo`
<div class="${css.compileContainer}"> <div class="${css.compileContainer}">
<div class="${css.compileButtons}"> <div class="${css.compileButtons}">
@ -149,6 +158,10 @@ module.exports = class CompileTab {
<span class="${css.autocompileText}">Auto compile</span> <span class="${css.autocompileText}">Auto compile</span>
</div> </div>
${self._view.warnCompilationSlow} ${self._view.warnCompilationSlow}
<div class=${css.hideWarningsContainer}>
${self._view.hideWarningsBox}
<span class="${css.autocompileText}">Hide warnings</span>
</div>
</div> </div>
</div>` </div>`
self._view.errorContainer = yo`<div class='error'></div>` self._view.errorContainer = yo`<div class='error'></div>`
@ -221,6 +234,10 @@ module.exports = class CompileTab {
function copyBytecode () { function copyBytecode () {
copyContractProperty('bytecode') copyContractProperty('bytecode')
} }
function hideWarnings (event) {
self._opts.config.set('hideWarnings', self._view.hideWarningsBox.checked)
self._api.runCompiler()
}
function details () { function details () {
const select = self._view.contractNames const select = self._view.contractNames
if (select.children.length > 0 && select.selectedIndex >= 0) { if (select.children.length > 0 && select.selectedIndex >= 0) {

@ -241,6 +241,11 @@ var css = csjs`
padding-right: 26px; padding-right: 26px;
padding-top: 5px; padding-top: 5px;
float: right; float: right;
},
.hideWarningsContainer {
display: flex;
align-items: center;
margin-left: 2%
} }
` `

Loading…
Cancel
Save