From 2c618e248f2ec70d75501eb96d72bedd80bcd981 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Apr 2019 19:54:07 +0200 Subject: [PATCH 01/11] swicth to debugger and display editor upon workspace selection --- src/app.js | 4 ++-- src/app/ui/landing-page/landing-page.js | 4 ++-- src/app/ui/landing-page/workspace.js | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app.js b/src/app.js index 70d7c3e947..7e027f90b3 100644 --- a/src/app.js +++ b/src/app.js @@ -416,7 +416,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const swapPanelApi = new SwapPanelApi(swapPanelComponent, verticalIconsComponent) // eslint-disable-line const mainPanelApi = new SwapPanelApi(mainPanelComponent, verticalIconsComponent) // eslint-disable-line const verticalIconsApi = new VerticalIconsApi(verticalIconsComponent) // eslint-disable-line - + registry.put({api: verticalIconsApi, name: 'verticalicon'}) registry.put({api: appManager.proxy(), name: 'pluginmanager'}) pluginManagerComponent.setApp(appManager) @@ -458,7 +458,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ) let analysis = new AnalysisTab(registry) let debug = new DebuggerTab() - const landingPage = new LandingPage(appManager, appStore) + const landingPage = new LandingPage(appManager, appStore, registry) let test = new TestTab( registry.get('filemanager').api, registry.get('filepanel').api, diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 02e7871512..c364e9f16e 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -45,7 +45,7 @@ import Section from './section' export class LandingPage extends ApiFactory { - constructor (appManager, appStore) { + constructor (appManager, appStore, registry) { super() this.sections = [] let load = function (item) { @@ -132,7 +132,7 @@ export class LandingPage extends ApiFactory { this.sectionWorkspaceMain = [] this.sectionWorkspaceOthers = [] - defaultWorkspaces(appManager).forEach((workspace) => { + defaultWorkspaces(appManager, registry).forEach((workspace) => { if (workspace.isMain) { this.sectionWorkspaceMain.push({ label: workspace.title, diff --git a/src/app/ui/landing-page/workspace.js b/src/app/ui/landing-page/workspace.js index 9189be0a6b..695d5ee2ec 100644 --- a/src/app/ui/landing-page/workspace.js +++ b/src/app/ui/landing-page/workspace.js @@ -8,7 +8,7 @@ export class Workspace { } } -export const defaultWorkspaces = (appManager) => { +export const defaultWorkspaces = (appManager, registry) => { return [ new Workspace( 'Solidity', @@ -19,6 +19,8 @@ export const defaultWorkspaces = (appManager) => { appManager.ensureActivated('run') appManager.ensureActivated('solidityStaticAnalysis') appManager.ensureActivated('solidityUnitTesting') + registry.get('filemanager').api.switchFile() + registry.get('verticalicon').api.select('solidity') }, () => {}), new Workspace( 'Vyper', @@ -27,6 +29,8 @@ export const defaultWorkspaces = (appManager) => { () => { appManager.ensureActivated('vyper') appManager.ensureActivated('run') + registry.get('filemanager').api.switchFile() + registry.get('verticalicon').api.select('solidity') }, () => {}), new Workspace('Debugger', 'Debug transactions with remix', false, () => { appManager.ensureActivated('debugger') From b78bfb4c70ffae3384a502c69659e3ec21fac860 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Apr 2019 19:54:22 +0200 Subject: [PATCH 02/11] display swappanel at load --- src/framingService.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/framingService.js b/src/framingService.js index 5731f3e699..0021b15ae1 100644 --- a/src/framingService.js +++ b/src/framingService.js @@ -13,6 +13,5 @@ export default { verticalIconApi.select('fileExplorers') mainPanelApi.showContent('home') - resizeFeature.minimize() } } From b6c5ad6885b91cd7db6bdba60af78fbe3083515e Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Apr 2019 19:54:39 +0200 Subject: [PATCH 03/11] fix currentFileChanged event --- src/app/files/fileManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 3dbb822555..6ab67d9c74 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -192,8 +192,8 @@ class FileManager extends ApiFactory { if (fileList.length) { _switchFile(browserProvider.type + '/' + fileList[0]) } else { - this.events.emit('currentFileChanged') this._deps.editor.displayEmptyReadOnlySession() + this.events.emit('noFileSelected') } }) } From 3dc104d11e3a76ce077ba795e7392b02c4eff107 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Apr 2019 19:54:57 +0200 Subject: [PATCH 04/11] fix terminal minimzing --- src/app/panels/editor-panel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/panels/editor-panel.js b/src/app/panels/editor-panel.js index 91c4810042..206ef8ab80 100644 --- a/src/app/panels/editor-panel.js +++ b/src/app/panels/editor-panel.js @@ -127,7 +127,7 @@ class EditorPanel { if (delta === undefined) { layout.show = !layout.show if (layout.show) delta = layout.offset - else delta = containerHeight + else delta = 0 } else { layout.show = true self._deps.config.set(`terminal-${direction}-offset`, delta) From 129ba4b8a15709b5110d7e25374b0d343e10ea67 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Apr 2019 19:55:24 +0200 Subject: [PATCH 05/11] expand file explorer at load --- src/app/files/file-explorer.js | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 1ca85827e9..0d9de5d4b9 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -210,24 +210,9 @@ function fileExplorer (localRegistry, files, menuItems) { self.treeView.event.register('nodeClick', function (path, childrenContainer) { if (!childrenContainer) return if (childrenContainer.style.display === 'none') return - - files.resolveDirectory(path, (error, fileTree) => { - if (error) console.error(error) - if (!fileTree) return - var newTree = normalize(path, fileTree) - self.treeView.updateNodeFromJSON(path, newTree, true) - }) + self.updatePath(path) }) - function normalize (path, filesList) { - var prefix = path.split('/')[0] - var newList = {} - Object.keys(filesList).forEach(key => { - newList[prefix + '/' + key] = filesList[key].isDirectory ? {} : { '/content': true } - }) - return newList - } - // register to main app, trigger when the current file in the editor changed self._deps.fileManager.events.on('currentFileChanged', (newFile) => { const explorer = self._deps.fileManager.fileProviderOf(newFile) @@ -310,6 +295,15 @@ function fileExplorer (localRegistry, files, menuItems) { } } +fileExplorer.prototype.updatePath = function (path) { + this.files.resolveDirectory(path, (error, fileTree) => { + if (error) console.error(error) + if (!fileTree) return + var newTree = normalize(path, fileTree) + this.treeView.updateNodeFromJSON(path, newTree, true) + }) +} + fileExplorer.prototype.hide = function () { if (this.container) this.container.style.display = 'none' } @@ -547,7 +541,17 @@ fileExplorer.prototype.ensureRoot = function (cb) { self.container.appendChild(element) self.element = element if (cb) cb() + self.treeView.expand(self.files.type) + }) +} + +function normalize (path, filesList) { + var prefix = path.split('/')[0] + var newList = {} + Object.keys(filesList).forEach(key => { + newList[prefix + '/' + key] = filesList[key].isDirectory ? {} : { '/content': true } }) + return newList } module.exports = fileExplorer From 290f00bc1484c0ebb634a893343a21823f4c7dea Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Apr 2019 20:44:26 +0200 Subject: [PATCH 06/11] remove config provider --- src/app.js | 6 ------ src/app/files/fileManager.js | 3 --- src/app/panels/file-panel.js | 7 ------- 3 files changed, 16 deletions(-) diff --git a/src/app.js b/src/app.js index 7e027f90b3..f0b963203e 100644 --- a/src/app.js +++ b/src/app.js @@ -17,7 +17,6 @@ var GistHandler = require('./lib/gist-handler') var helper = require('./lib/helper') var Storage = remixLib.Storage var Browserfiles = require('./app/files/browser-files') -var BrowserfilesTree = require('./app/files/browser-files-tree') var SharedFolder = require('./app/files/shared-folder') var Config = require('./config') var Renderer = require('./app/ui/renderer') @@ -140,10 +139,7 @@ class App extends ApiFactory { self._components.filesProviders = {} self._components.filesProviders['browser'] = new Browserfiles(fileStorage) - self._components.filesProviders['config'] = new BrowserfilesTree('config', configStorage) - self._components.filesProviders['config'].init() registry.put({api: self._components.filesProviders['browser'], name: 'fileproviders/browser'}) - registry.put({api: self._components.filesProviders['config'], name: 'fileproviders/config'}) var remixd = new Remixd(65520) registry.put({api: remixd, name: 'remixd'}) @@ -465,7 +461,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org compileTab ) let sourceHighlighters = registry.get('editor').api.sourceHighlighters - let configProvider = self._components.filesProviders['config'] appManager.init([ this.api(), @@ -473,7 +468,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org udapp.api(), fileManager.api(), sourceHighlighters.api(), - configProvider.api(), txListenerModule.api(), filePanel.api(), // { profile: support.profile(), api: support }, diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 6ab67d9c74..c4cc3a9d63 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -26,18 +26,15 @@ class FileManager extends ApiFactory { config: this._components.registry.get('config').api, browserExplorer: this._components.registry.get('fileproviders/browser').api, localhostExplorer: this._components.registry.get('fileproviders/localhost').api, - configExplorer: this._components.registry.get('fileproviders/config').api, gistExplorer: this._components.registry.get('fileproviders/gist').api, filesProviders: this._components.registry.get('fileproviders').api } this._deps.browserExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) this._deps.localhostExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) - this._deps.configExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) this._deps.gistExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) this._deps.browserExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) this._deps.localhostExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) - this._deps.configExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) this._deps.gistExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) this._deps.localhostExplorer.event.register('errored', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) this._deps.localhostExplorer.event.register('closed', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index d63ecdacec..04f69ea2b0 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -47,7 +47,6 @@ module.exports = class Filepanel extends ApiFactory { var swarmExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['swarm']) var githubExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['github']) var gistExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['gist'], ['updateGist']) - var configExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['config']) var httpExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['http']) var httpsExplorer = new FileExplorer(self._components.registry, self._deps.fileProviders['https']) @@ -72,7 +71,6 @@ module.exports = class Filepanel extends ApiFactory {
${fileExplorer.init()}
-
${configExplorer.init()}
${fileSystemExplorer.init()}
${swarmExplorer.init()}
${githubExplorer.init()}
@@ -89,7 +87,6 @@ module.exports = class Filepanel extends ApiFactory { self.event = event var element = template() fileExplorer.ensureRoot() - configExplorer.ensureRoot() self._deps.fileProviders['localhost'].event.register('connecting', (event) => { }) @@ -109,10 +106,6 @@ module.exports = class Filepanel extends ApiFactory { self._deps.fileManager.switchFile(path) }) - configExplorer.events.register('focus', function (path) { - self._deps.fileManager.switchFile(path) - }) - fileSystemExplorer.events.register('focus', function (path) { self._deps.fileManager.switchFile(path) }) From de25f5d3b2eef3cc745931188bea4ff699972c4d Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 4 Apr 2019 20:47:10 +0200 Subject: [PATCH 07/11] typo --- src/app/ui/landing-page/workspace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/ui/landing-page/workspace.js b/src/app/ui/landing-page/workspace.js index 695d5ee2ec..a2cdf4779e 100644 --- a/src/app/ui/landing-page/workspace.js +++ b/src/app/ui/landing-page/workspace.js @@ -30,7 +30,7 @@ export const defaultWorkspaces = (appManager, registry) => { appManager.ensureActivated('vyper') appManager.ensureActivated('run') registry.get('filemanager').api.switchFile() - registry.get('verticalicon').api.select('solidity') + registry.get('verticalicon').api.select('vyper') }, () => {}), new Workspace('Debugger', 'Debug transactions with remix', false, () => { appManager.ensureActivated('debugger') From 1185855aadb19a5c5d00e67a071ee5aff9eedb02 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 5 Apr 2019 08:17:42 +0200 Subject: [PATCH 08/11] remove registry param --- src/app.js | 2 +- src/app/ui/landing-page/landing-page.js | 2 +- src/app/ui/landing-page/workspace.js | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/app.js b/src/app.js index f0b963203e..36f663474e 100644 --- a/src/app.js +++ b/src/app.js @@ -454,7 +454,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ) let analysis = new AnalysisTab(registry) let debug = new DebuggerTab() - const landingPage = new LandingPage(appManager, appStore, registry) + const landingPage = new LandingPage(appManager, appStore) let test = new TestTab( registry.get('filemanager').api, registry.get('filepanel').api, diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index c364e9f16e..f1aa8eb4d7 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -45,7 +45,7 @@ import Section from './section' export class LandingPage extends ApiFactory { - constructor (appManager, appStore, registry) { + constructor (appManager, appStore) { super() this.sections = [] let load = function (item) { diff --git a/src/app/ui/landing-page/workspace.js b/src/app/ui/landing-page/workspace.js index a2cdf4779e..ed8b3f2d57 100644 --- a/src/app/ui/landing-page/workspace.js +++ b/src/app/ui/landing-page/workspace.js @@ -1,3 +1,5 @@ +let globalRegistry = require('../../../global/registry') + export class Workspace { constructor (title, description, isMain, activate, deactivate) { this.title = title @@ -8,7 +10,7 @@ export class Workspace { } } -export const defaultWorkspaces = (appManager, registry) => { +export const defaultWorkspaces = (appManager) => { return [ new Workspace( 'Solidity', @@ -19,8 +21,8 @@ export const defaultWorkspaces = (appManager, registry) => { appManager.ensureActivated('run') appManager.ensureActivated('solidityStaticAnalysis') appManager.ensureActivated('solidityUnitTesting') - registry.get('filemanager').api.switchFile() - registry.get('verticalicon').api.select('solidity') + globalRegistry.get('filemanager').api.switchFile() + globalRegistry.get('verticalicon').api.select('solidity') }, () => {}), new Workspace( 'Vyper', @@ -29,8 +31,8 @@ export const defaultWorkspaces = (appManager, registry) => { () => { appManager.ensureActivated('vyper') appManager.ensureActivated('run') - registry.get('filemanager').api.switchFile() - registry.get('verticalicon').api.select('vyper') + globalRegistry.get('filemanager').api.switchFile() + globalRegistry.get('verticalicon').api.select('vyper') }, () => {}), new Workspace('Debugger', 'Debug transactions with remix', false, () => { appManager.ensureActivated('debugger') From e053258229fc45b83bfef47b4f7ef37474d04696 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 5 Apr 2019 08:23:47 +0200 Subject: [PATCH 09/11] typo --- src/app/components/vertical-icons-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/vertical-icons-component.js b/src/app/components/vertical-icons-component.js index 85d4da45c2..2ba596b807 100644 --- a/src/app/components/vertical-icons-component.js +++ b/src/app/components/vertical-icons-component.js @@ -38,7 +38,7 @@ class VerticalIconComponent { if (!api.events) return let fn = this.iconStatus[api.profile.name] if (fn) { - api.events.remove('statusChanged', fn) + api.events.removeListener('statusChanged', fn) delete this.iconStatus[api.profile.name] } } From aa780b1e89af0f32c5ea6c2f17a46992d1ec5ae7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 5 Apr 2019 08:24:09 +0200 Subject: [PATCH 10/11] remove uneeded param --- src/app/ui/landing-page/landing-page.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index f1aa8eb4d7..02e7871512 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -132,7 +132,7 @@ export class LandingPage extends ApiFactory { this.sectionWorkspaceMain = [] this.sectionWorkspaceOthers = [] - defaultWorkspaces(appManager, registry).forEach((workspace) => { + defaultWorkspaces(appManager).forEach((workspace) => { if (workspace.isMain) { this.sectionWorkspaceMain.push({ label: workspace.title, From 8ce5561f5812c6e57a882a6fb7e5b9aa4552e7d2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 5 Apr 2019 08:56:07 +0200 Subject: [PATCH 11/11] fix test --- test-browser/helpers/init.js | 2 +- test-browser/tests/simpleContract.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test-browser/helpers/init.js b/test-browser/helpers/init.js index 5e014be5fc..0ac0db2928 100644 --- a/test-browser/helpers/init.js +++ b/test-browser/helpers/init.js @@ -19,7 +19,7 @@ module.exports = function (browser, callback) { function initModules (browser, callback) { browser.click('#icon-panel div[plugin="pluginManager"]') .execute(function () { - document.querySelector('div[title="pluginManager"]').scrollTop = document.querySelector('div[title="pluginManager"]').scrollHeight + document.querySelector('div[id="pluginManager"]').scrollTop = document.querySelector('div[id="pluginManager"]').scrollHeight }, [], function () { browser.click('#pluginManager article[title="solidity"] button') .click('#pluginManager article[title="run"] button') diff --git a/test-browser/tests/simpleContract.js b/test-browser/tests/simpleContract.js index c76a15305e..6b76b83989 100644 --- a/test-browser/tests/simpleContract.js +++ b/test-browser/tests/simpleContract.js @@ -25,7 +25,6 @@ function runTests (browser) { .waitForElementVisible('#icon-panel', 10000) .clickLaunchIcon('solidity') .clickLaunchIcon('fileExplorers') - .click('#swap-panel label[data-path="browser"]') .perform(() => { // the first fn is used to pass browser to the other ones. async.waterfall([function (callback) { callback(null, browser) },