|
|
|
@ -80,7 +80,6 @@ class CompileTab extends CompilerApi { |
|
|
|
|
this.events.emit('statusChanged', {key: 'edited', title: 'the content has changed, needs recompilation', type: 'info'}) |
|
|
|
|
} |
|
|
|
|
this.editor.event.register('contentChanged', onContentChanged) |
|
|
|
|
this.editor.event.register('sessionSwitched', onContentChanged) |
|
|
|
|
|
|
|
|
|
this.compiler.event.register('loadingCompiler', () => { |
|
|
|
|
this.events.emit('statusChanged', {key: 'loading', title: 'loading compiler...', type: 'info'}) |
|
|
|
@ -99,20 +98,12 @@ 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() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const cleanupErrors = () => { |
|
|
|
|
this._view.errorContainer.innerHTML = '' |
|
|
|
|
this.events.emit('statusChanged', {key: 'none'}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.compiler.event.register('compilationFinished', (success, data, source) => { |
|
|
|
|
if (success) { |
|
|
|
|
// forwarding the event to the appManager infra
|
|
|
|
@ -140,7 +131,7 @@ class CompileTab extends CompilerApi { |
|
|
|
|
// Update contract Selection
|
|
|
|
|
let contractMap = {} |
|
|
|
|
if (success) this.compiler.visitContracts((contract) => { contractMap[contract.name] = contract }) |
|
|
|
|
let contractSelection = this.contractSelection(Object.keys(contractMap) || []) |
|
|
|
|
let contractSelection = this.contractSelection(Object.keys(contractMap) || [], source.target) |
|
|
|
|
yo.update(this._view.contractSelection, contractSelection) |
|
|
|
|
|
|
|
|
|
if (data['error']) { |
|
|
|
@ -189,20 +180,22 @@ class CompileTab extends CompilerApi { |
|
|
|
|
* Section to select the compiled contract |
|
|
|
|
* @param {string[]} contractList Names of the compiled contracts |
|
|
|
|
*/ |
|
|
|
|
contractSelection (contractList = []) { |
|
|
|
|
contractSelection (contractList = [], sourceFile) { |
|
|
|
|
return contractList.length !== 0 |
|
|
|
|
? yo`<section class="${css.container} clearfix">
|
|
|
|
|
<!-- Select Compiler Version --> |
|
|
|
|
<header class="navbar navbar-light bg-light input-group mb-3 ${css.compilerArticle}"> |
|
|
|
|
<h6 class="bg-light input-group mt-3 mb-1 ${css.compilerArticle}"> |
|
|
|
|
Compilation result for <label class="border-0 px-1 text-dark">${sourceFile}</label> |
|
|
|
|
</h6> |
|
|
|
|
<div class="input-group-prepend"> |
|
|
|
|
<label class="border-0 input-group-text" for="compiledContracts">Contract</label> |
|
|
|
|
</div> |
|
|
|
|
<select onchange="${e => this.selectContract(e.target.value)}" onload="${e => { this.selectedContract = e.value }}" id="compiledContracts" class="custom-select"> |
|
|
|
|
${contractList.map((name) => yo`<option value="${name}">${name}</option>`)} |
|
|
|
|
</select> |
|
|
|
|
</header> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<article class="${css.compilerArticle}"> |
|
|
|
|
<button class="btn btn-primary btn-block" title="Publish on Swarm" onclick="${() => { this.publish() }}"> |
|
|
|
|
<button class="btn btn-secondary btn-block" title="Publish on Swarm" onclick="${() => { this.publish() }}"> |
|
|
|
|
<i class="${css.copyIcon} fas fa-upload" aria-hidden="true"></i> |
|
|
|
|
<span>Publish on Swarm</span> |
|
|
|
|
</button> |
|
|
|
|