Commit 749438cb authored by yann300's avatar yann300

display current file name for compilation result

parent 29c76ef5
...@@ -131,7 +131,7 @@ class CompileTab extends CompilerApi { ...@@ -131,7 +131,7 @@ class CompileTab extends CompilerApi {
// Update contract Selection // Update contract Selection
let contractMap = {} let contractMap = {}
if (success) this.compiler.visitContracts((contract) => { contractMap[contract.name] = contract }) 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) yo.update(this._view.contractSelection, contractSelection)
if (data['error']) { if (data['error']) {
...@@ -180,18 +180,20 @@ class CompileTab extends CompilerApi { ...@@ -180,18 +180,20 @@ class CompileTab extends CompilerApi {
* Section to select the compiled contract * Section to select the compiled contract
* @param {string[]} contractList Names of the compiled contracts * @param {string[]} contractList Names of the compiled contracts
*/ */
contractSelection (contractList = []) { contractSelection (contractList = [], sourceFile) {
return contractList.length !== 0 return contractList.length !== 0
? yo`<section class="${css.container} clearfix"> ? yo`<section class="${css.container} clearfix">
<!-- Select Compiler Version --> <!-- 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}">
<div class="input-group-prepend"> 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> <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">
<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>`)} ${contractList.map((name) => yo`<option value="${name}">${name}</option>`)}
</select> </select>
</header> </div>
<article class="${css.compilerArticle}"> <article class="${css.compilerArticle}">
<button class="btn btn-primary btn-block" title="Publish on Swarm" onclick="${() => { this.publish() }}"> <button class="btn btn-primary btn-block" title="Publish on Swarm" onclick="${() => { this.publish() }}">
<i class="${css.copyIcon} fas fa-upload" aria-hidden="true"></i> <i class="${css.copyIcon} fas fa-upload" aria-hidden="true"></i>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment