From b360ebe02a01d16697eded0fd8e190718037cbd3 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 26 Apr 2019 13:31:54 +0200 Subject: [PATCH 01/11] remove status --- src/app/components/vertical-icons-component.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/vertical-icons-component.js b/src/app/components/vertical-icons-component.js index 0d6a44743e..b85d84fc6c 100644 --- a/src/app/components/vertical-icons-component.js +++ b/src/app/components/vertical-icons-component.js @@ -90,7 +90,7 @@ class VerticalIconComponent { let key = helper.checkSpecialChars(status.key) ? '' : status.key let type = helper.checkSpecialChars(status.type) ? '' : status.type let title = helper.checkSpecialChars(status.title) ? '' : status.title - el.appendChild(yo``) + el.appendChild(yo``) // el.classList = "" doesn't work on all browser use instead var classList = el.classList @@ -99,8 +99,8 @@ class VerticalIconComponent { } el.classList.add(`${css.icon}`) - el.classList.add('border') - el.classList.add(`border-${type}`) + //el.classList.add('border') + //el.classList.add(`border-${type}`) } } From 640882f851bf04d8bcb662fc4af318bbde03dfa5 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 2 May 2019 22:45:45 +0200 Subject: [PATCH 02/11] new satus icons --- src/app/tabs/analysis-tab.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 196252d45a..54cd001f05 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -29,10 +29,12 @@ class AnalysisTab extends BaseApi { render () { if (!this.staticanalysis) this.staticanalysis = new StaticAnalysis() this.staticanalysis.event.register('staticAnaysisWarning', (count) => { - if (count) { - this.events.emit('statusChanged', {key: 'exclamation-triangle', title: count + ' warnings', type: 'warning'}) - } else { + if (count > 0) { + this.events.emit('statusChanged', {key: count.toString(), title: count + ' warnings', type: 'warning'}) + } else if (count === 0) { this.events.emit('statusChanged', {key: 'check', title: 'no warning', type: 'success'}) + } else { + this.events.emit('statusChanged', {key: '', title: '', type: ''}) } }) this.registry.put({api: this.staticanalysis, name: 'staticanalysis'}) From 1844d2dd05ece3ac8ff6e1ad0b84fed6953ceabc Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 26 Apr 2019 20:04:14 +0200 Subject: [PATCH 03/11] new satus icons --- .../components/vertical-icons-component.js | 33 ++++++++++++++++--- src/app/staticanalysis/staticAnalysisView.js | 8 +++-- src/app/tabs/compile-tab.js | 2 +- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/app/components/vertical-icons-component.js b/src/app/components/vertical-icons-component.js index b85d84fc6c..41c41b9067 100644 --- a/src/app/components/vertical-icons-component.js +++ b/src/app/components/vertical-icons-component.js @@ -52,7 +52,14 @@ class VerticalIconComponent { listenOnStatus (api) { if (!api.events) return const fn = (status) => { - this.setIconStatus(api.profile.name, status) + if ( + status.type === 'warning' || + status.type === 'danger' || + status.key === 'code' || + status.key === 'check' || + (status.key === '' && status.type === '' && status.title === '')) { + this.setIconStatus(api.profile.name, status) + } } this.iconStatus[api.profile.name] = fn api.events.on('statusChanged', this.iconStatus[api.profile.name]) @@ -90,17 +97,33 @@ class VerticalIconComponent { let key = helper.checkSpecialChars(status.key) ? '' : status.key let type = helper.checkSpecialChars(status.type) ? '' : status.type let title = helper.checkSpecialChars(status.title) ? '' : status.title - el.appendChild(yo``) + + let classes = css.status + switch (key) { + case 'check': + classes += ' badge badge-pill badge-' + type + ' text-' + type + break + case 'code': + classes += ' fas fa-sync text-' + type + break + default: + classes += ' badge badge-pill badge-' + type + } + + el.appendChild(yo``) // el.classList = "" doesn't work on all browser use instead var classList = el.classList while (classList.length > 0) { classList.remove(classList.item(0)) } - el.classList.add(`${css.icon}`) - //el.classList.add('border') - //el.classList.add(`border-${type}`) } } diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index beace33ca6..d44b2108da 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -99,7 +99,7 @@ staticAnalysisView.prototype.run = function () { var warningContainer = $('#staticanalysisresult') warningContainer.empty() var self = this - if (this.lastCompilationResult) { + if (this.lastCompilationResult && selected.length) { var warningCount = 0 this.runner.run(this.lastCompilationResult, selected, function (results) { results.map(function (result, i) { @@ -126,8 +126,10 @@ staticAnalysisView.prototype.run = function () { self.event.trigger('staticAnaysisWarning', [warningCount]) }) } else { - warningContainer.html('No compiled AST available') - self.event.trigger('staticAnaysisWarning', [0]) + if (selected.length) { + warningContainer.html('No compiled AST available') + } + self.event.trigger('staticAnaysisWarning', [-1]) } } diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index e5cb75a7ac..3a8275ca1f 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -122,7 +122,7 @@ class CompileTab extends CompilerApi { ) }) } else { - this.events.emit('statusChanged', {key: 'exclamation', title: 'compilation failed', type: 'danger'}) + this.events.emit('statusChanged', {key: data.errors.length.toString(), title: 'compilation failed', type: 'danger'}) } // Update contract Selection let contractMap = {} From 78c6eba428b1eea3798c14674bf7918fea50c9a4 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 26 Apr 2019 20:33:30 +0200 Subject: [PATCH 04/11] new icon for check --- src/app/components/vertical-icons-component.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/components/vertical-icons-component.js b/src/app/components/vertical-icons-component.js index 41c41b9067..35a25b1841 100644 --- a/src/app/components/vertical-icons-component.js +++ b/src/app/components/vertical-icons-component.js @@ -101,7 +101,7 @@ class VerticalIconComponent { let classes = css.status switch (key) { case 'check': - classes += ' badge badge-pill badge-' + type + ' text-' + type + classes += ' fas fa-check-circle text-' + type + ' ' + css.statusCheck break case 'code': classes += ' fas fa-sync text-' + type @@ -115,7 +115,7 @@ class VerticalIconComponent { class="${classes}" aria-hidden="true" > - ${key === 'code' ? '' : key === 'check' ? 'o' : key} + ${key === 'code' || key === 'check' ? '' : key} `) // el.classList = "" doesn't work on all browser use instead @@ -285,6 +285,9 @@ const css = csjs` bottom: 0; right: 0; } + .statusCheck { + font-size: 1.2em; + } .statusWithBG border-radius: 8px; background-color: var(--danger); From eba224cc56017a7450804df45f71f2fe50d02460 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 29 Apr 2019 20:03:26 +0200 Subject: [PATCH 05/11] 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) => { From da10ef0d00574ab003d5862091af4622f9cd8648 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 29 Apr 2019 20:04:32 +0200 Subject: [PATCH 06/11] standard --- src/app/tabs/compile-tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 7663adf87a..5382ae27eb 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -128,7 +128,7 @@ class CompileTab extends CompilerApi { ) }) } else { - const count = errorList.filter(error => error.severity === 'error').length.toString() + const count = data.errors.filter(error => error.severity === 'error').length.toString() this.events.emit('statusChanged', {key: count, title: 'compilation failed', type: 'danger'}) } // Update contract Selection From e8509680961d060a92b9323d156da365ccf49f1c Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 30 Apr 2019 10:35:36 +0200 Subject: [PATCH 07/11] compiler result: check error as well --- src/app/tabs/compile-tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 5382ae27eb..b445b46356 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -128,7 +128,7 @@ class CompileTab extends CompilerApi { ) }) } else { - const count = data.errors.filter(error => error.severity === 'error').length.toString() + const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + data.error ? 1 : 0).toString() this.events.emit('statusChanged', {key: count, title: 'compilation failed', type: 'danger'}) } // Update contract Selection From ddfc094a0b22c759a2774ad9c659230a3dec2b76 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 30 Apr 2019 14:21:18 +0200 Subject: [PATCH 08/11] -restyle errors on compiler tab -check for fatal error as well -remove errors after file switch --- src/app/staticanalysis/staticAnalysisView.js | 2 +- src/app/tabs/compile-tab.js | 9 ++++++++- src/app/tabs/compileTab/compilerContainer.js | 1 + src/app/ui/renderer.js | 2 +- src/app/ui/styles/renderer-styles.js | 4 ---- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index d44b2108da..bc5b97bb0b 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -120,7 +120,7 @@ staticAnalysisView.prototype.run = function () { } warningCount++ var msg = yo`${location} ${item.warning} ${item.more ? yo`
more
` : yo``}
` - self._deps.renderer.error(msg, warningContainer, {type: 'staticAnalysisWarning', useSpan: true}) + self._deps.renderer.error(msg, warningContainer, {type: 'staticAnalysisWarning alert alert-warning', useSpan: true}) }) }) self.event.trigger('staticAnaysisWarning', [warningCount]) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index b445b46356..f33a3da743 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -99,14 +99,21 @@ class CompileTab extends CompilerApi { this.fileManager.events.on('currentFileChanged', (name) => { this.compilerContainer.currentFile = name + cleanupErrors() onContentChanged() }) this.fileManager.events.on('noFileSelected', () => { this.compilerContainer.currentFile = '' + cleanupErrors() onContentChanged() }) + const cleanupErrors = () => { + this._view.errorContainer.innerHTML = '' + this.events.emit('statusChanged', {key: '', title: '', type: ''}) + } + this.compiler.event.register('compilationFinished', (success, data, source) => { if (success) { // forwarding the event to the appManager infra @@ -259,7 +266,7 @@ class CompileTab extends CompilerApi { var result = yo`
${uploaded.map((value) => { return yo`
${value.filename} :
${value.output.url}
` })}
` - modalDialogCustom.alert(yo`Metadata published successfully.
${result}
`) + modalDialogCustom.alert(yo`Metadata published successfully.
${result}
`) } }, (item) => { // triggered each time there's a new verified publish (means hash correspond) this.swarmfileProvider.addReadOnly(item.hash, item.content) diff --git a/src/app/tabs/compileTab/compilerContainer.js b/src/app/tabs/compileTab/compilerContainer.js index 5ed1bf7bae..6b6ba50c66 100644 --- a/src/app/tabs/compileTab/compilerContainer.js +++ b/src/app/tabs/compileTab/compilerContainer.js @@ -40,6 +40,7 @@ class CompilerContainer { } activate () { + this.currentFile = this.config.get('currentFile') this.listenToEvents() } diff --git a/src/app/ui/renderer.js b/src/app/ui/renderer.js index a3914397ff..6d9ee500a1 100644 --- a/src/app/ui/renderer.js +++ b/src/app/ui/renderer.js @@ -90,7 +90,7 @@ Renderer.prototype.error = function (message, container, opt) { var $pre = $(opt.useSpan ? yo`` : yo`
`).html(message)
 
   let classList = opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning'
-  var $error = $(yo`
`).prepend($pre) + var $error = $(yo`
`).prepend($pre) $(container).append($error) $error.click((ev) => { diff --git a/src/app/ui/styles/renderer-styles.js b/src/app/ui/styles/renderer-styles.js index 2a143a165a..2cb023dfdf 100644 --- a/src/app/ui/styles/renderer-styles.js +++ b/src/app/ui/styles/renderer-styles.js @@ -40,16 +40,12 @@ var css = yo`