From a6825bc0e5924039f95fa681b21ad189405da8e1 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 29 Apr 2019 20:03:26 +0200 Subject: [PATCH] added warnings status update --- src/app/tabs/compile-tab.js | 11 +++++++++-- src/app/ui/renderer.js | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 3a8275ca1f..7663adf87a 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -111,7 +111,13 @@ class CompileTab extends CompilerApi { if (success) { // forwarding the event to the appManager infra this.events.emit('compilationFinished', source.target, source, 'soljson', data) - this.events.emit('statusChanged', {key: 'check', title: 'compilation successful', type: 'success'}) + if (data.errors) { + this.events.emit('statusChanged', { + key: data.errors.length.toString(), + title: 'compilation finished successful with warning' + data.errors.length > 1 ? 's' : '', + type: 'warning' + }) + } else this.events.emit('statusChanged', {key: 'check', title: 'compilation successful', type: 'success'}) // Store the contracts this.data.contractsDetails = {} this.compiler.visitContracts((contract) => { @@ -122,7 +128,8 @@ class CompileTab extends CompilerApi { ) }) } else { - this.events.emit('statusChanged', {key: data.errors.length.toString(), title: 'compilation failed', type: 'danger'}) + const count = errorList.filter(error => error.severity === 'error').length.toString() + this.events.emit('statusChanged', {key: count, title: 'compilation failed', type: 'danger'}) } // Update contract Selection let contractMap = {} diff --git a/src/app/ui/renderer.js b/src/app/ui/renderer.js index 138a32434e..a3914397ff 100644 --- a/src/app/ui/renderer.js +++ b/src/app/ui/renderer.js @@ -89,7 +89,8 @@ Renderer.prototype.error = function (message, container, opt) { var $pre = $(opt.useSpan ? yo`` : yo`
`).html(message)
 
-  var $error = $(yo`
`).prepend($pre) + let classList = opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning' + var $error = $(yo`
`).prepend($pre) $(container).append($error) $error.click((ev) => {