Merge pull request #1727 from ethereum/swap_it_workspace

swap_it_workspaces
pull/3094/head
yann300 6 years ago committed by GitHub
commit 2d710c20e9
  1. 2
      src/app.js
  2. 3
      src/app/panels/file-panel.js
  3. 3
      src/app/tabs/analysis-tab.js
  4. 3
      src/app/tabs/run-tab.js
  5. 3
      src/app/tabs/test-tab.js
  6. 14
      src/app/ui/landing-page/generate.js
  7. 50
      src/app/ui/landing-page/workspace.js
  8. 6
      src/framingService.js
  9. 4
      src/remixAppManager.js
  10. 10
      test-browser/helpers/contracts.js
  11. 6
      test-browser/helpers/init.js
  12. 6
      test-browser/tests/ballot.js
  13. 6
      test-browser/tests/compiling.js
  14. 4
      test-browser/tests/sharedFolderExplorer.js
  15. 2
      test-browser/tests/simpleContract.js
  16. 2
      test-browser/tests/staticanalysis.js
  17. 2
      test-browser/tests/units/testRecorder.js

@ -459,7 +459,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
let configProvider = self._components.filesProviders['config']
appManager.init([
{ profile: homepageProfile(), api: generateHomePage() },
{ profile: homepageProfile(), api: generateHomePage(appManager, appStore) },
{ profile: this.profile(), api: this },
{ profile: udapp.profile(), api: udapp },
{ profile: fileManager.profile(), api: fileManager },

@ -169,7 +169,8 @@ function filepanel (localRegistry) {
self.profile = function () {
return {
name: 'file explorers',
name: 'fileExplorers',
displayName: 'file explorers',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=',

@ -11,7 +11,8 @@ class AnalysisTab {
}
profile () {
return {
name: 'solidity static analysis',
name: 'solidityStaticAnalysis',
displayName: 'solidity static analysis',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=',

@ -149,7 +149,8 @@ class RunTab {
profile () {
return {
name: 'run transactions',
name: 'run',
displayName: 'run transactions',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=',

@ -25,7 +25,8 @@ module.exports = class TestTab {
}
profile () {
return {
name: 'solidity unit testing',
name: 'solidityUnitTesting',
displayName: 'solidity unit testing',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjMwNCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjMwNCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzI4IDQ0OGwtMzg0IDcwNGg3Njh6bS0xMjgwIDBsLTM4NCA3MDRoNzY4em04MjEtMTkycS0xNCA0MC00NS41IDcxLjV0LTcxLjUgNDUuNXYxMjkxaDYwOHExNCAwIDIzIDl0OSAyM3Y2NHEwIDE0LTkgMjN0LTIzIDloLTEzNDRxLTE0IDAtMjMtOXQtOS0yM3YtNjRxMC0xNCA5LTIzdDIzLTloNjA4di0xMjkxcS00MC0xNC03MS41LTQ1LjV0LTQ1LjUtNzEuNWgtNDkxcS0xNCAwLTIzLTl0LTktMjN2LTY0cTAtMTQgOS0yM3QyMy05aDQ5MXEyMS01NyA3MC05Mi41dDExMS0zNS41IDExMSAzNS41IDcwIDkyLjVoNDkxcTE0IDAgMjMgOXQ5IDIzdjY0cTAgMTQtOSAyM3QtMjMgOWgtNDkxem0tMTgxIDE2cTMzIDAgNTYuNS0yMy41dDIzLjUtNTYuNS0yMy41LTU2LjUtNTYuNS0yMy41LTU2LjUgMjMuNS0yMy41IDU2LjUgMjMuNSA1Ni41IDU2LjUgMjMuNXptMTA4OCA4ODBxMCA3My00Ni41IDEzMXQtMTE3LjUgOTEtMTQ0LjUgNDkuNS0xMzkuNSAxNi41LTEzOS41LTE2LjUtMTQ0LjUtNDkuNS0xMTcuNS05MS00Ni41LTEzMXEwLTExIDM1LTgxdDkyLTE3NC41IDEwNy0xOTUuNSAxMDItMTg0IDU2LTEwMHExOC0zMyA1Ni0zM3Q1NiAzM3E0IDcgNTYgMTAwdDEwMiAxODQgMTA3IDE5NS41IDkyIDE3NC41IDM1IDgxem0tMTI4MCAwcTAgNzMtNDYuNSAxMzF0LTExNy41IDkxLTE0NC41IDQ5LjUtMTM5LjUgMTYuNS0xMzkuNS0xNi41LTE0NC41LTQ5LjUtMTE3LjUtOTEtNDYuNS0xMzFxMC0xMSAzNS04MXQ5Mi0xNzQuNSAxMDctMTk1LjUgMTAyLTE4NCA1Ni0xMDBxMTgtMzMgNTYtMzN0NTYgMzNxNCA3IDU2IDEwMHQxMDIgMTg0IDEwNyAxOTUuNSA5MiAxNzQuNSAzNSA4MXoiLz48L3N2Zz4=',

@ -1,6 +1,7 @@
/* global alert */
/* global */
import LandingPage from './landing-page'
import Section from './section'
import { defaultWorkspaces } from './workspace'
export function homepageProfile () {
return {
@ -13,7 +14,8 @@ export function homepageProfile () {
}
}
export function generateHomePage () {
export function generateHomePage (appManager) {
/*
var actions1 = [
{label: 'new file', type: `callback`, payload: () => { alert(`-new file created-`) }},
{label: 'import from GitHub', type: `callback`, payload: () => { alert(`-imported from GitHub-`) }},
@ -51,6 +53,12 @@ export function generateHomePage () {
var section3 = new Section('Learn', actions3)
var section4 = new Section('Plugins', actions4)
var section5 = new Section('Help', actions5)
*/
return new LandingPage([section1, section2, section3, section4, section5])
var sectionsWorkspaces = []
defaultWorkspaces(appManager).forEach((workspace) => {
sectionsWorkspaces.push({label: workspace.title, type: 'callback', payload: () => { workspace.activate() }})
})
var sectionWorkspace = new Section('Workspaces', sectionsWorkspaces)
return new LandingPage([sectionWorkspace])
}

@ -0,0 +1,50 @@
export class Workspace {
constructor (title, description, activate, deactivate) {
this.title = title
this.description = description
this.activate = activate
this.deactivate = deactivate
}
}
export const defaultWorkspaces = (appManager, appStore) => {
return [
new Workspace('Close All Modules', '', () => {
appStore.getActives()
.filter(({profile}) => !profile.required)
.forEach((profile) => { appManager.deactivateOne(profile.name) })
}, () => {}),
new Workspace('Solidity Basic', '', () => {
appManager.ensureActivated('solidity')
}, () => {}),
new Workspace('Solidity Unit testing', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('solidityUnitTesting')
}, () => {}),
new Workspace('Solidity Full Environement', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
appManager.ensureActivated('solidityStaticAnalysis')
appManager.ensureActivated('solidityUnitTesting')
}, () => {}),
new Workspace('Vyper Basic', '', () => {
appManager.ensureActivated('vyper')
}, () => {}),
new Workspace('Pipeline', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
appManager.ensureActivated('pipeline')
}, () => {}),
new Workspace('Deploy and Run Solidity', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
}, () => {}),
new Workspace('Deploy and Run Vyper', '', () => {
appManager.ensureActivated('vyper')
appManager.ensureActivated('run')
}, () => {}),
new Workspace('Debugger', '', () => {
appManager.ensureActivated('debugger')
}, () => {})
]
}

@ -2,12 +2,12 @@ export default {
start: (appStore, swapPanelApi, verticalIconApi, mainPanelApi, resizeFeature) => {
swapPanelApi.event.on('toggle', (moduleName) => {
resizeFeature.panel1.clientWidth !== 0 ? resizeFeature.minimize() : resizeFeature.maximise()
if (moduleName === 'file explorers') {
if (moduleName === 'fileExplorers') {
mainPanelApi.showContent('code editor')
}
})
swapPanelApi.event.on('showing', (moduleName) => {
if (moduleName === 'file explorers') {
if (moduleName === 'fileExplorers') {
mainPanelApi.showContent('code editor')
}
resizeFeature.panel1.clientWidth === 0 ? resizeFeature.maximise() : ''
@ -21,7 +21,7 @@ export default {
})
// mainPanelApi.event.on('showing', (moduleName) => {})
verticalIconApi.select('file explorers')
verticalIconApi.select('fileExplorers')
verticalIconApi.select('homepage')
resizeFeature.minimize()
}

@ -14,6 +14,10 @@ export class RemixAppManager extends AppManagerApi {
}
}
ensureActivated (module) {
if (!this.store.isActive(module)) this.activateOne(module)
}
proxy () {
// that's temporary. should be removed when we can have proper notification registration
return this.data.proxy

@ -50,14 +50,14 @@ function getCompiledContracts (browser, compiled, callback) {
}
function selectContract (browser, contractName, callback) {
browser.clickLaunchIcon('settings').clickLaunchIcon('run transactions')
browser.clickLaunchIcon('settings').clickLaunchIcon('run')
.setValue('#runTabView select[class^="contractNames"]', contractName).perform(() => {
callback()
})
}
function createContract (browser, inputParams, callback) {
browser.clickLaunchIcon('settings').clickLaunchIcon('run transactions')
browser.clickLaunchIcon('settings').clickLaunchIcon('run')
.setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () {
browser.click('#runTabView button[class^="instanceButton"]').pause(500).perform(function () { callback() })
})
@ -217,7 +217,7 @@ function setEditorValue (value, callback) {
}
function addInstance (browser, address, isValidFormat, isValidChecksum, callback) {
browser.clickLaunchIcon('run transactions').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
browser.clickLaunchIcon('run').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
browser.click('div[class^="atAddress"]')
.execute(function () {
var ret = document.querySelector('div[class^="modalBody"] div').innerHTML
@ -265,7 +265,7 @@ function modalFooterOKClick () {
}
function addFile (browser, name, content, done) {
browser.clickLaunchIcon('run transactions').clickLaunchIcon('file explorers').click('.newFile')
browser.clickLaunchIcon('run').clickLaunchIcon('fileExplorers').click('.newFile')
.perform((client, done) => {
browser.execute(function (fileName) {
if (fileName !== 'Untitled.sol') {
@ -372,7 +372,7 @@ function useFilter (browser, filter, test, done) {
}
function switchFile (browser, name, done) {
browser.clickLaunchIcon('settings').clickLaunchIcon('file explorers')
browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers')
.click('li[key="' + name + '"]')
.pause(2000)
.perform(() => {

@ -22,10 +22,10 @@ function initModules (browser, callback) {
document.querySelector('div[title="pluginManager"]').scrollTop = document.querySelector('div[title="pluginManager"]').scrollHeight
}, [], function () {
browser.click('#pluginManager div[title="solidity"] button')
.click('#pluginManager div[title="run transactions"] button')
.click('#pluginManager div[title="solidity static analysis"] button')
.click('#pluginManager div[title="run"] button')
.click('#pluginManager div[title="solidityStaticAnalysis"] button')
.click('#pluginManager div[title="debugger"] button')
.click('#icon-panel div[title="file explorers"]')
.click('#icon-panel div[title="fileExplorers"]')
.perform(() => { callback() })
})
}

@ -34,7 +34,7 @@ function runTests (browser, testData) {
contractHelper.testContracts(browser, 'Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'], function () {
done()
})
}).clickLaunchIcon('run transactions')
}).clickLaunchIcon('run')
.setValue('input[placeholder="uint8 _numProposals"]', '1')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
@ -65,7 +65,7 @@ function runTests (browser, testData) {
done()
})
})
.clickLaunchIcon('run transactions')
.clickLaunchIcon('run')
.click('div[class^="udappClose"]')
.perform((client, done) => {
console.log('ballot.abi')
@ -79,7 +79,7 @@ function runTests (browser, testData) {
done()
})
})
.clickLaunchIcon('file explorers')
.clickLaunchIcon('fileExplorers')
.perform((client, done) => {
console.log('addInstance 0x692a70D2e424a56D2C6C27aA97D1a86395877b3A')
contractHelper.addInstance(browser, '0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true, () => {

@ -38,7 +38,7 @@ function runTests (browser) {
function testSimpleContract (browser, callback) {
contractHelper.testContracts(browser, 'Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract'], function () {
browser.clickLaunchIcon('run transactions')
browser.clickLaunchIcon('run')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2)')
@ -69,7 +69,7 @@ function testSimpleContract (browser, callback) {
function testReturnValues (browser, callback) {
contractHelper.testContracts(browser, 'returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues'], function () {
browser.clickLaunchIcon('run transactions')
browser.clickLaunchIcon('run')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2)')
@ -107,7 +107,7 @@ function testReturnValues (browser, callback) {
function testInputValues (browser, callback) {
contractHelper.testContracts(browser, 'inputValues.sol', sources[2]['browser/inputValues.sol'], ['test'], function () {
browser.clickLaunchIcon('run transactions')
browser.clickLaunchIcon('run')
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2)')

@ -71,7 +71,7 @@ function runTests (browser, testData) {
}
browser
.waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('file explorers')
.clickLaunchIcon('fileExplorers')
.click('.websocketconn')
.waitForElementVisible('#modal-footer-ok', 10000)
.click('#modal-footer-ok')
@ -132,7 +132,7 @@ function runTests (browser, testData) {
testImportFromRemixd(browser, () => { done() })
})
.perform(function () {
browser.clickLaunchIcon('file explorers').click('[data-path="localhost"]') // collapse and expand
browser.clickLaunchIcon('fileExplorers').click('[data-path="localhost"]') // collapse and expand
.waitForElementNotVisible('[data-path="localhost/folder1"]')
.click('[data-path="localhost"]')
.waitForElementVisible('[data-path="localhost/folder1"]')

@ -24,7 +24,7 @@ function runTests (browser) {
browser
.waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity')
.clickLaunchIcon('file explorers')
.clickLaunchIcon('fileExplorers')
.click('#swap-panel label[data-path="browser"]')
.perform(() => {
// the first fn is used to pass browser to the other ones.

@ -40,7 +40,7 @@ function runTests (browser) {
.clickLaunchIcon('solidity')
contractHelper.testContracts(browser, 'Untitled.sol', sources[0]['browser/Untitled.sol'], ['TooMuchGas', 'test1', 'test2'], function () {
browser
.clickLaunchIcon('solidity static analysis')
.clickLaunchIcon('solidityStaticAnalysis')
.click('#staticanalysisView button')
.waitForElementPresent('#staticanalysisresult .staticAnalysisWarning', 2000, true, function () {
dom.listSelectorContains(['browser/Untitled.sol:2:33:Use of tx.origin',

@ -10,7 +10,7 @@ module.exports = {
browser.clickLaunchIcon = contractHelper.clickLaunchIcon
contractHelper.addFile(browser, 'scenario.json', {content: records}, () => {
browser
.clickLaunchIcon('run transactions')
.clickLaunchIcon('run')
.click('div[class^="cardContainer"] i[class^="arrow"]')
.click('#runTabView .runtransaction')
.waitForElementPresent('.instance:nth-of-type(2)')

Loading…
Cancel
Save