Merge pull request #1947 from ethereum/yann300-patch-31

Don't show "edited" in the icon list if tab switch event
pull/1/head
yann300 6 years ago committed by GitHub
commit 563a68a21d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/panels/styles/terminal-styles.js
  2. 23
      src/app/tabs/compile-tab.js
  3. 1
      src/app/tabs/runTab/contractDropdown.js
  4. 5
      src/app/tabs/test-tab.js

@ -93,6 +93,8 @@ var css = csjs`
width : 330px; width : 330px;
padding-left : 20px; padding-left : 20px;
height : 100%; height : 100%;
padding-top : 1px;
padding-bottom : 1px;
} }
.filter { .filter {
padding-right : 0px; padding-right : 0px;

@ -80,7 +80,6 @@ class CompileTab extends CompilerApi {
this.events.emit('statusChanged', {key: 'edited', title: 'the content has changed, needs recompilation', type: 'info'}) 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('contentChanged', onContentChanged)
this.editor.event.register('sessionSwitched', onContentChanged)
this.compiler.event.register('loadingCompiler', () => { this.compiler.event.register('loadingCompiler', () => {
this.events.emit('statusChanged', {key: 'loading', title: 'loading compiler...', type: 'info'}) 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.fileManager.events.on('currentFileChanged', (name) => {
this.compilerContainer.currentFile = name this.compilerContainer.currentFile = name
cleanupErrors()
onContentChanged()
}) })
this.fileManager.events.on('noFileSelected', () => { this.fileManager.events.on('noFileSelected', () => {
this.compilerContainer.currentFile = '' this.compilerContainer.currentFile = ''
cleanupErrors()
}) })
const cleanupErrors = () => {
this._view.errorContainer.innerHTML = ''
this.events.emit('statusChanged', {key: 'none'})
}
this.compiler.event.register('compilationFinished', (success, data, source) => { this.compiler.event.register('compilationFinished', (success, data, source) => {
if (success) { if (success) {
// forwarding the event to the appManager infra // forwarding the event to the appManager infra
@ -140,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']) {
@ -189,20 +180,22 @@ 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}">
Compilation result for <label class="border-0 px-1 text-dark">${sourceFile}</label>
</h6>
<div class="input-group-prepend"> <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-secondary 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>
<span>Publish on Swarm</span> <span>Publish on Swarm</span>
</button> </button>

@ -76,7 +76,6 @@ class ContractDropdownUI {
if (!document.querySelector(`.${css.contractNames}`)) return if (!document.querySelector(`.${css.contractNames}`)) return
document.querySelector(`.${css.contractNames}`).classList.remove(css.contractNamesError) document.querySelector(`.${css.contractNames}`).classList.remove(css.contractNamesError)
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`) var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
contractNames.innerHTML = ''
if (/.(.abi)$/.exec(currentFile)) { if (/.(.abi)$/.exec(currentFile)) {
this.createPanel.style.display = 'none' this.createPanel.style.display = 'none'
this.orLabel.style.display = 'none' this.orLabel.style.display = 'none'

@ -56,11 +56,6 @@ module.exports = class TestTab extends BaseApi {
yo.update(this.testList, yo`<div class=${css.testList}>${testsMessage}</div>`) yo.update(this.testList, yo`<div class=${css.testList}>${testsMessage}</div>`)
if (!this.testsOutput || !this.testsSummary) return if (!this.testsOutput || !this.testsSummary) return
this.testsOutput.hidden = true
this.testsSummary.hidden = true
this.testsOutput.innerHTML = ''
this.testsSummary.innerHTML = ''
}) })
}) })
} }

Loading…
Cancel
Save