Unverified Commit f6ce8384 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #2677 from ethereum/publish-metadata

Added Metadata Contract Name To Success Modal
parents bffc5431 4fd44cc6
...@@ -316,6 +316,7 @@ class CompileTab extends ViewPlugin { ...@@ -316,6 +316,7 @@ class CompileTab extends ViewPlugin {
publish (storage) { publish (storage) {
if (this.selectedContract) { if (this.selectedContract) {
var contract = this.data.contractsDetails[this.selectedContract] var contract = this.data.contractsDetails[this.selectedContract]
if (contract.metadata === undefined || contract.metadata.length === 0) { if (contract.metadata === undefined || contract.metadata.length === 0) {
modalDialogCustom.alert('This contract may be abstract, may not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.') modalDialogCustom.alert('This contract may be abstract, may not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.')
} else { } else {
...@@ -331,7 +332,7 @@ class CompileTab extends ViewPlugin { ...@@ -331,7 +332,7 @@ class CompileTab extends ViewPlugin {
var result = yo`<div>${uploaded.map((value) => { var result = yo`<div>${uploaded.map((value) => {
return yo`<div><b>${value.filename}</b> : <pre>${value.output.url}</pre></div>` return yo`<div><b>${value.filename}</b> : <pre>${value.output.url}</pre></div>`
})}</div>` })}</div>`
modalDialogCustom.alert(yo`<span>Metadata published successfully.<br> <pre>${result}</pre> </span>`) modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`<span>Metadata of "${contract.name.toLowerCase()}" was published successfully.<br> <pre>${result}</pre> </span>`)
} }
}, (item) => { // triggered each time there's a new verified publish (means hash correspond) }, (item) => { // triggered each time there's a new verified publish (means hash correspond)
this.fileProvider.addExternal('swarm/' + item.hash, item.content) this.fileProvider.addExternal('swarm/' + item.hash, item.content)
...@@ -348,7 +349,7 @@ class CompileTab extends ViewPlugin { ...@@ -348,7 +349,7 @@ class CompileTab extends ViewPlugin {
var result = yo`<div>${uploaded.map((value) => { var result = yo`<div>${uploaded.map((value) => {
return yo`<div><b>${value.filename}</b> : <pre>${value.output.url}</pre></div>` return yo`<div><b>${value.filename}</b> : <pre>${value.output.url}</pre></div>`
})}</div>` })}</div>`
modalDialogCustom.alert(yo`<span>Metadata published successfully.<br> <pre>${result}</pre> </span>`) modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`<span>Metadata of "${contract.name.toLowerCase()}" was published successfully.<br> <pre>${result}</pre> </span>`)
} }
}, (item) => { // triggered each time there's a new verified publish (means hash correspond) }, (item) => { // triggered each time there's a new verified publish (means hash correspond)
this.fileProvider.addExternal('ipfs/' + item.hash, item.content) this.fileProvider.addExternal('ipfs/' + item.hash, item.content)
......
...@@ -3,8 +3,9 @@ var yo = require('yo-yo') ...@@ -3,8 +3,9 @@ var yo = require('yo-yo')
var css = require('./styles/modal-dialog-custom-styles') var css = require('./styles/modal-dialog-custom-styles')
module.exports = { module.exports = {
alert: function (text) { alert: function (title, text) {
return modal('', yo`<div>${text}</div>`, null, { label: null }) if (text) return modal(title, yo`<div>${text}</div>`, null, { label: null })
return modal('', yo`<div>${title}</div>`, null, { label: null })
}, },
prompt: function (title, text, inputValue, ok, cancel, focus) { prompt: function (title, text, inputValue, ok, cancel, focus) {
return prompt(title, text, false, inputValue, ok, cancel, focus) return prompt(title, text, false, inputValue, ok, cancel, focus)
......
...@@ -17,7 +17,7 @@ module.exports = { ...@@ -17,7 +17,7 @@ module.exports = {
.verifyContracts(['Ballot']) .verifyContracts(['Ballot'])
.click('#publishOnIpfs') .click('#publishOnIpfs')
.getModalBody((value, done) => { .getModalBody((value, done) => {
if (value.indexOf('Metadata published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '') if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '')
if (value.indexOf('dweb:/ipfs') === -1) browser.assert.fail('ipfs deploy failed', '', '') if (value.indexOf('dweb:/ipfs') === -1) browser.assert.fail('ipfs deploy failed', '', '')
done() done()
}) })
...@@ -28,7 +28,7 @@ module.exports = { ...@@ -28,7 +28,7 @@ module.exports = {
browser browser
.click('#publishOnSwarm') .click('#publishOnSwarm')
.getModalBody((value, done) => { .getModalBody((value, done) => {
if (value.indexOf('Metadata published successfully.') === -1) browser.assert.fail('swarm deploy failed', '', '') if (value.indexOf('Metadata of "ballot" was successfully.') === -1) browser.assert.fail('swarm deploy failed', '', '')
if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '') if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '')
done() done()
}) })
......
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