From df0a9694e46fd1588431627a80d9ebe799daeefb Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 12 Feb 2020 09:53:26 +0100 Subject: [PATCH 01/18] using new engine --- package-lock.json | 151 ++++++++---------- package.json | 2 +- src/app.js | 57 +++++-- .../components/plugin-manager-component.js | 8 +- src/app/components/side-panel.js | 2 +- src/app/files/fileManager.js | 3 +- src/app/panels/main-view.js | 34 +--- src/app/panels/tab-proxy.js | 4 +- src/app/panels/terminal.js | 14 +- src/app/udapp/make-udapp.js | 3 +- src/app/ui/auto-complete-popup.js | 2 +- src/app/ui/txLogger.js | 6 +- src/remixAppManager.js | 47 +++--- 13 files changed, 154 insertions(+), 179 deletions(-) diff --git a/package-lock.json b/package-lock.json index f291a48dfe..3611f4e52d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1778,9 +1778,9 @@ "integrity": "sha512-ePDxG9UuU9Kobk90ZUjtmDW8IT9U7aRb1/Rl9683MRNM+ur0ocHL2v7TPH2ajTiVSBUFbbeW8vKIt9jrb0JIAA==" }, "@remixproject/engine": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.2.0.tgz", - "integrity": "sha512-J8UqkQSANp6hKMP5G4/rMYf6j0RJdBYSm4mfkwkpRAZi2/01nPjuBmgbaQ4tFNcwCOjdAMp24ySAKaCj0ciPDA==" + "version": "0.2.0-alpha.1", + "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.2.0-alpha.1.tgz", + "integrity": "sha512-KeYCDBa02MddlyCDSF7YGTZgVcOWeNt4MEcTT/IMpHRyAht0apAq+2MDCMH3l1/wZ3ggiH0ZV12KxM/ZcQ92UQ==" }, "@resolver-engine/core": { "version": "0.3.3", @@ -6737,8 +6737,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -6756,13 +6755,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6775,18 +6772,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -6889,8 +6883,7 @@ }, "inherits": { "version": "2.0.4", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -6900,7 +6893,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6913,20 +6905,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.9.0", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6943,7 +6932,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7024,8 +7012,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -7035,7 +7022,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7111,8 +7097,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -7142,7 +7127,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7160,7 +7144,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7199,13 +7182,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.1.1", - "bundled": true, - "optional": true + "bundled": true } } }, @@ -11274,19 +11255,19 @@ "dependencies": { "ansi-regex": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "code-point-at": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "cross-spawn": { "version": "5.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { @@ -11297,13 +11278,13 @@ }, "decamelize": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "execa": { "version": "0.7.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { @@ -11318,7 +11299,7 @@ }, "find-up": { "version": "2.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { @@ -11327,25 +11308,25 @@ }, "get-caller-file": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", "dev": true }, "get-stream": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "invert-kv": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { @@ -11354,19 +11335,19 @@ }, "is-stream": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "isexe": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "lcid": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { @@ -11375,7 +11356,7 @@ }, "locate-path": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { @@ -11385,7 +11366,7 @@ }, "lru-cache": { "version": "4.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { @@ -11395,7 +11376,7 @@ }, "mem": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { @@ -11404,19 +11385,19 @@ }, "mimic-fn": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimist": { "version": "0.0.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -11425,7 +11406,7 @@ }, "npm-run-path": { "version": "2.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { @@ -11434,13 +11415,13 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "os-locale": { "version": "2.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { @@ -11451,19 +11432,19 @@ }, "p-finally": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-limit": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", "dev": true }, "p-locate": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { @@ -11472,43 +11453,43 @@ }, "path-exists": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "path-key": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "pseudomap": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, "require-directory": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "set-blocking": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "shebang-command": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { @@ -11517,19 +11498,19 @@ }, "shebang-regex": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "string-width": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -11540,7 +11521,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -11549,13 +11530,13 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "which": { "version": "1.3.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { @@ -11564,13 +11545,13 @@ }, "which-module": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "wrap-ansi": { "version": "2.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -11580,19 +11561,19 @@ }, "y18n": { "version": "3.2.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, "yallist": { "version": "2.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs": { "version": "10.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", "dev": true, "requires": { @@ -11612,13 +11593,13 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "cliui": { "version": "3.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { @@ -11629,7 +11610,7 @@ "dependencies": { "string-width": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -11642,7 +11623,7 @@ }, "string-width": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { @@ -11652,13 +11633,13 @@ "dependencies": { "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "strip-ansi": { "version": "4.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { @@ -11671,7 +11652,7 @@ }, "yargs-parser": { "version": "8.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", "dev": true, "requires": { @@ -11680,7 +11661,7 @@ "dependencies": { "camelcase": { "version": "4.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true } @@ -17777,7 +17758,7 @@ "requires": { "underscore": "1.8.3", "web3-core-helpers": "1.0.0-beta.27", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible" + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" }, "dependencies": { "debug": { diff --git a/package.json b/package.json index c711558e10..8874705b7c 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "yo-yoify": "^3.7.3" }, "dependencies": { - "@remixproject/engine": "^0.2.0", + "@remixproject/engine": "^0.2.0-alpha.1", "http-server": "^0.11.1", "remixd": "0.1.8-alpha.10", "standard": "^8.5.0" diff --git a/src/app.js b/src/app.js index f76731f4c8..0475c35c93 100644 --- a/src/app.js +++ b/src/app.js @@ -35,12 +35,14 @@ const DebuggerTab = require('./app/tabs/debugger-tab') const TestTab = require('./app/tabs/test-tab') const FilePanel = require('./app/panels/file-panel') const Editor = require('./app/editor/editor') - +const Terminal = require('./app/panels/terminal') +const ContextualListener = require('./app/editor/contextualListener') import { basicLogo } from './app/ui/svgLogo' import { RunTab, makeUdapp } from './app/udapp' import PanelsResize from './lib/panels-resize' +import { Engine } from '@remixproject/engine' import { RemixAppManager } from './remixAppManager' import { FramingService } from './framingService' import { MainView } from './app/panels/main-view' @@ -229,12 +231,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // APP_MANAGER const appManager = new RemixAppManager({}) + const engine = new Engine(appManager) + await engine.onload() const workspace = appManager.pluginLoader.get() // SERVICES - // ----------------- import content servive ---------------------------- + // ----------------- import content servive ------------------------ const contentImport = new CompilerImport() - // ----------------- theme servive ---------------------------- + // ----------------- theme servive --------------------------------- const themeModule = new ThemeModule(registry) registry.put({api: themeModule, name: 'themeModule'}) themeModule.initTheme(() => { @@ -247,6 +251,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const editor = new Editor({}, themeModule) // wrapper around ace editor registry.put({api: editor, name: 'editor'}) editor.event.register('requiringToSaveCurrentfile', () => fileManager.saveCurrentFile()) + // ----------------- fileManager servive ---------------------------- const fileManager = new FileManager(editor) registry.put({api: fileManager, name: 'filemanager'}) @@ -254,20 +259,38 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const blockchain = new Blockchain(registry.get('config').api) const pluginUdapp = new PluginUDapp(blockchain) - // ----------------- compilation metadata generation servive ---------------------------- + // ----------------- compilation metadata generation servive --------- const compilerMetadataGenerator = new CompilerMetadata(blockchain, fileManager, registry.get('config').api) // ----------------- compilation result service (can keep track of compilation results) ---------------------------- const compilersArtefacts = new CompilersArtefacts() // store all the compilation results (key represent a compiler name) registry.put({api: compilersArtefacts, name: 'compilersartefacts'}) - const {eventsDecoder, txlistener} = makeUdapp(blockchain, compilersArtefacts, (domEl) => mainview.getTerminal().logHtml(domEl)) - // ----------------- network service (resolve network id / name) ---------------------------- + // ----------------- network service (resolve network id / name) ----- const networkModule = new NetworkModule(blockchain) - // ----------------- convert offset to line/column service ---------------------------- - var offsetToLineColumnConverter = new OffsetToLineColumnConverter() + // ----------------- convert offset to line/column service ----------- + const offsetToLineColumnConverter = new OffsetToLineColumnConverter() registry.put({api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter'}) - appManager.register([ + // -------------------Terminal---------------------------------------- + + const terminal = new Terminal( + { appManager, blockchain }, + { + getPosition: (event) => { + var limitUp = 36 + var limitDown = 20 + var height = window.innerHeight + var newpos = (event.pageY < limitUp) ? limitUp : event.pageY + newpos = (newpos < height - limitDown) ? newpos : height - limitDown + return height - newpos + } + } + ) + makeUdapp(blockchain, compilersArtefacts, (domEl) => terminal.logHtml(domEl)) + + const contextualListener = new ContextualListener({editor}) + + engine.register([ contentImport, themeModule, editor, @@ -275,15 +298,17 @@ Please make a backup of your contracts and start using http://remix.ethereum.org compilerMetadataGenerator, compilersArtefacts, networkModule, - offsetToLineColumnConverter + offsetToLineColumnConverter, + contextualListener, + terminal ]) // LAYOUT & SYSTEM VIEWS const appPanel = new MainPanel() - const mainview = new MainView(editor, appPanel, fileManager, appManager, txlistener, eventsDecoder, blockchain) + const mainview = new MainView(contextualListener, editor, appPanel, fileManager, appManager, terminal) registry.put({ api: mainview, name: 'mainview' }) - appManager.register([ + engine.register([ appPanel ]) @@ -306,7 +331,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org self._view.sidepanel.appendChild(sidePanel.render()) document.body.appendChild(hiddenPanel.render()) // Hidden Panel is display none, it can be directly on body - appManager.register([ + engine.register([ menuicons, landingPage, sidePanel, @@ -344,7 +369,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org new Renderer() ) - appManager.register([ + engine.register([ compileTab, run, debug, @@ -354,14 +379,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ]) try { - appManager.register(await appManager.registeredPlugins()) + engine.register(await appManager.registeredPlugins()) } catch (e) { console.log('couldn\'t register iframe plugins', e.message) } await appManager.activate(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'offsetToLineColumnConverter']) await appManager.activate(['mainPanel']) - await appManager.activate(['menuicons', 'home', 'sidePanel', 'pluginManager', 'fileExplorers', 'settings']) + await appManager.activate(['menuicons', 'home', 'sidePanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'terminal']) // Set workspace after initial activation if (Array.isArray(workspace)) await appManager.activate(workspace) diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 2c7f06615d..02194a9b1d 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -88,7 +88,7 @@ class PluginManagerComponent extends ViewPlugin { } renderItem (name) { - const api = this.appManager.getOne(name) + const api = this.appManager.getPlugin(name) if (!api) return const isActive = this.appManager.isActive(name) const displayName = (api.profile.displayName) ? api.profile.displayName : name @@ -106,11 +106,11 @@ class PluginManagerComponent extends ViewPlugin { const activationButton = isActive ? yo` - ` : yo` - ` @@ -144,7 +144,7 @@ class PluginManagerComponent extends ViewPlugin { const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile) this.appManager.registerOne(plugin) - this.appManager.activateOne(profile.name) + this.appManager.activatePlugin(profile.name) } catch (err) { // TODO : Use an alert to handle this error instead of a console.log console.log(`Cannot create Plugin : ${err.message}`) diff --git a/src/app/components/side-panel.js b/src/app/components/side-panel.js index ac110c3a82..05d17e7b8e 100644 --- a/src/app/components/side-panel.js +++ b/src/app/components/side-panel.js @@ -118,7 +118,7 @@ export class SidePanel extends AbstractPanel { let docLink = '' let versionWarning if (this.active) { - const { profile } = this.appManager.getOne(this.active) + const { profile } = this.appManager.getPlugin(this.active) name = profile.displayName ? profile.displayName : profile.name docLink = profile.documentation ? yo`` : '' if (profile.version && profile.version.match(/\b(\w*alpha\w*)\b/g)) { diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 4ec3095bf2..a4518ce2f3 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -9,6 +9,7 @@ const toaster = require('../ui/tooltip') const modalDialogCustom = require('../ui/modal-dialog-custom') const helper = require('../../lib/helper.js') import { Plugin } from '@remixproject/engine' +import { isNative } from '../../remixAppManager.js' import * as packageJson from '../../../package.json' /* @@ -172,7 +173,7 @@ class FileManager extends Plugin { toaster.hide() } if (this.currentRequest) { - if (this.currentRequest.isFromNative) { + if (isNative(this.currentRequest.from)) { this._setFileInternal(path, content) return } diff --git a/src/app/panels/main-view.js b/src/app/panels/main-view.js index c1f981ab94..6e9e2a4f54 100644 --- a/src/app/panels/main-view.js +++ b/src/app/panels/main-view.js @@ -1,11 +1,9 @@ var yo = require('yo-yo') var EventManager = require('../../lib/events') -var Terminal = require('./terminal') var globalRegistry = require('../../global/registry') var { TabProxy } = require('./tab-proxy.js') -var ContextualListener = require('../editor/contextualListener') var ContextView = require('../editor/contextView') var csjs = require('csjs-inject') @@ -20,7 +18,7 @@ var css = csjs` ` export class MainView { - constructor (editor, mainPanel, fileManager, appManager, txListener, eventsDecoder, blockchain) { + constructor (contextualListener, editor, mainPanel, fileManager, appManager, terminal) { var self = this self.event = new EventManager() self._view = {} @@ -29,9 +27,9 @@ export class MainView { self.editor = editor self.fileManager = fileManager self.mainPanel = mainPanel - self.txListener = txListener - self.eventsDecoder = eventsDecoder - self.blockchain = blockchain + self.txListener = globalRegistry.get('txlistener').api + self._components.terminal = terminal + self._components.contextualListener = contextualListener this.appManager = appManager this.init() } @@ -88,32 +86,10 @@ export class MainView { } } - var contextualListener = new ContextualListener({editor: self.editor}) - this.appManager.registerOne(contextualListener) - this.appManager.activate('contextualListener') - - var contextView = new ContextView({contextualListener, editor: self.editor}) + const contextView = new ContextView({contextualListener: self._components.contextualListener, editor: self.editor}) - self._components.contextualListener = contextualListener self._components.contextView = contextView - self._components.terminal = new Terminal({ - appManager: this.appManager, - eventsDecoder: this.eventsDecoder, - txListener: this.txListener, - blockchain: this.blockchain - }, - { - getPosition: (event) => { - var limitUp = 36 - var limitDown = 20 - var height = window.innerHeight - var newpos = (event.pageY < limitUp) ? limitUp : event.pageY - newpos = (newpos < height - limitDown) ? newpos : height - limitDown - return height - newpos - } - }) - self._components.terminal.event.register('resize', delta => self._adjustLayout('top', delta)) if (self.txListener) { self._components.terminal.event.register('listenOnNetWork', (listenOnNetWork) => { diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index d69dbd7e96..47e8e715a5 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -50,7 +50,7 @@ export class TabProxy { }) appManager.event.on('activate', (name) => { - const { profile } = appManager.getOne(name) + const { profile } = appManager.getPlugin(name) if (profile.location === 'mainPanel') { this.addTab( name, @@ -58,7 +58,7 @@ export class TabProxy { () => this.event.emit('switchApp', name), () => { this.event.emit('closeApp', name) - this.appManager.deactivateOne(name) + this.appManager.deactivatePlugin(name) }, profile.icon ) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index f9ea36f932..ba08966454 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -45,7 +45,7 @@ class Terminal extends Plugin { self._api = api self._opts = opts self.data = { - lineLength: opts.lineLength || 80, + lineLength: opts.lineLength || 80, // ??? session: [], activeFilters: { commands: {}, input: '' }, filterFns: {} @@ -95,14 +95,12 @@ class Terminal extends Plugin { self._jsSandboxContext = {} self._jsSandboxRegistered = {} - // TODO move this to the application start. Put it in mainView. - // We should have a HostPlugin which add the terminal. - opts.appManager.register(this) - opts.appManager.activate('terminal') - - if (opts.shell) self._shell = opts.shell + if (opts.shell) self._shell = opts.shell // ??? register(self) } + setTxListener(txListener) { + this._opts.txListener = txListener + } logHtml (html) { var command = this.commands['html'] if (typeof command === 'function') command(html) @@ -441,7 +439,7 @@ class Terminal extends Plugin { self._components.txLogger = new TxLogger(self._opts.eventsDecoder, self._opts.txListener, this, self.blockchain) self._components.txLogger.event.register('debuggingRequested', (hash) => { // TODO should probably be in the run module - if (!self._opts.appManager.isActive('debugger')) self._opts.appManager.activateOne('debugger') + if (!self._opts.appManager.isActive('debugger')) self._opts.appManager.activatePlugin('debugger') this.call('debugger', 'debug', hash) this.call('menuicons', 'select', 'debugger') }) diff --git a/src/app/udapp/make-udapp.js b/src/app/udapp/make-udapp.js index e9a8262718..9b7a247f50 100644 --- a/src/app/udapp/make-udapp.js +++ b/src/app/udapp/make-udapp.js @@ -52,6 +52,5 @@ export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) { } }) txlistener.startListening() - - return {txlistener, eventsDecoder} + registry.put({api: eventsDecoder, name: 'eventsDecoder'}) } diff --git a/src/app/ui/auto-complete-popup.js b/src/app/ui/auto-complete-popup.js index 2163e83143..c4f3176e7a 100644 --- a/src/app/ui/auto-complete-popup.js +++ b/src/app/ui/auto-complete-popup.js @@ -190,7 +190,7 @@ class AutoCompletePopup { extendAutocompletion () { // TODO: this is not using the appManager interface. Terminal should be put as module this.opts.appManager.event.on('activate', (id) => { - const profile = this.opts.appManager.getOne(id).profile + const profile = this.opts.appManager.getPlugin(id).profile if (!profile.methods) return profile.methods.forEach((method) => { const key = `remix.call({name: '${id}', key:'${method}', payload: []}).then((result) => { console.log(result) }).catch((error) => { console.log(error) })` diff --git a/src/app/ui/txLogger.js b/src/app/ui/txLogger.js index 15c45f6982..08c8992600 100644 --- a/src/app/ui/txLogger.js +++ b/src/app/ui/txLogger.js @@ -116,7 +116,7 @@ var css = csjs` * */ class TxLogger { - constructor (eventsDecoder, txListener, terminal, blockchain) { + constructor (terminal, blockchain) { this.event = new EventManager() this.seen = {} function filterTx (value, query) { @@ -125,8 +125,8 @@ class TxLogger { } return false } - this.eventsDecoder = eventsDecoder - this.txListener = txListener + this.eventsDecoder = globalRegistry.get('teventsDecoder').api + this.txListener = globalRegistry.get('txListener').api this.terminal = terminal // dependencies this._deps = { diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 98e35da48e..252a41a8e1 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -1,7 +1,6 @@ /* global localStorage, fetch */ -import { PluginEngine, IframePlugin } from '@remixproject/engine' +import { PluginManager, IframePlugin } from '@remixproject/engine' import { EventEmitter } from 'events' -import { PermissionHandler } from './app/ui/persmission-handler' import QueryParams from './lib/query-params' const requiredModules = [ // services + layout views + system views @@ -9,22 +8,34 @@ const requiredModules = [ // services + layout views + system views 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'fileExplorers', 'terminal', 'settings', 'pluginManager'] -const settings = { - permissionHandler: new PermissionHandler(), - autoActivate: false, - natives: ['vyper', 'workshops', 'ethdoc', 'etherscan'] // Force iframe plugin to be seen as native +export function isNative(name) { + const nativePlugins = ['vyper', 'workshops', 'ethdoc', 'etherscan'] + return nativePlugins.includes(name) } -export class RemixAppManager extends PluginEngine { +export class RemixAppManager extends PluginManager { constructor (plugins) { - super(plugins, settings) + super() this.event = new EventEmitter() this.registered = {} this.pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json' this.pluginLoader = new PluginLoader() } + async canActivate (from, to) { + return true + } + + async canDeactivate (from, to) { + return from.name === 'manager' + } + + async canCall (From, to, method) { + // todo This is the dafault behaviour, we could save user choises in session scope + return true + } + onActivated (plugin) { this.pluginLoader.set(plugin, this.actives) this.event.emit('activate', plugin.name) @@ -36,10 +47,6 @@ export class RemixAppManager extends PluginEngine { }) } - getOne (name) { - return this.registered[name] - } - getIds () { return Object.keys(this.registered) } @@ -55,21 +62,9 @@ export class RemixAppManager extends PluginEngine { this.event.emit('added', plugin.name) } - // TODO check whether this can be removed - ensureActivated (apiName) { - if (!this.isActive(apiName)) this.activateOne(apiName) - this.event.emit('ensureActivated', apiName) - } - - // TODO check whether this can be removed - ensureDeactivated (apiName) { - if (this.isActive(apiName)) this.deactivateOne(apiName) - this.event.emit('ensureDeactivated', apiName) - } - - deactivateOne (name) { + deactivatePlugin (name) { if (requiredModules.includes(name)) return - super.deactivateOne(name) + super.deactivatePlugin(name) } isRequired (name) { From a206b647cceeb28cdfec1fd5a410a04ce5d13c6e Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 12 Feb 2020 16:43:23 +0100 Subject: [PATCH 02/18] typo --- src/app/components/hidden-panel.js | 3 ++- src/app/components/main-panel.js | 4 ++-- src/app/components/panel.js | 2 +- src/app/components/side-panel.js | 6 +----- src/app/ui/txLogger.js | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/app/components/hidden-panel.js b/src/app/components/hidden-panel.js index a76c521f0e..7cae9d04ff 100644 --- a/src/app/components/hidden-panel.js +++ b/src/app/components/hidden-panel.js @@ -13,7 +13,8 @@ const profile = { name: 'hiddenPanel', displayName: 'Hidden Panel', description: '', - version: packageJson.version + version: packageJson.version, + methods: {} } export class HiddenPanel extends AbstractPanel { diff --git a/src/app/components/main-panel.js b/src/app/components/main-panel.js index def2acc62e..082ccb61c5 100644 --- a/src/app/components/main-panel.js +++ b/src/app/components/main-panel.js @@ -20,8 +20,8 @@ const profile = { } export class MainPanel extends AbstractPanel { - constructor (options) { - super(profile, options) + constructor () { + super(profile) } render () { diff --git a/src/app/components/panel.js b/src/app/components/panel.js index fcbecbc397..8601a7bc6a 100644 --- a/src/app/components/panel.js +++ b/src/app/components/panel.js @@ -28,7 +28,7 @@ const css = csjs` /** Abstract class used for hosting the view of a plugin */ export class AbstractPanel extends HostPlugin { - constructor (profile, opts) { + constructor (profile) { super(profile) this.events = new EventEmitter() this.contents = {} diff --git a/src/app/components/side-panel.js b/src/app/components/side-panel.js index 05d17e7b8e..9d11987795 100644 --- a/src/app/components/side-panel.js +++ b/src/app/components/side-panel.js @@ -48,10 +48,6 @@ const css = csjs` } ` -const options = { - default: true -} - const sidePanel = { name: 'sidePanel', displayName: 'Side Panel', @@ -64,7 +60,7 @@ const sidePanel = { export class SidePanel extends AbstractPanel { constructor (appManager, verticalIcons) { - super(sidePanel, options) + super(sidePanel) this.appManager = appManager this.header = this.renderHeader() this.verticalIcons = verticalIcons diff --git a/src/app/ui/txLogger.js b/src/app/ui/txLogger.js index 08c8992600..ef936814d2 100644 --- a/src/app/ui/txLogger.js +++ b/src/app/ui/txLogger.js @@ -125,7 +125,7 @@ class TxLogger { } return false } - this.eventsDecoder = globalRegistry.get('teventsDecoder').api + this.eventsDecoder = globalRegistry.get('eventsDecoder').api this.txListener = globalRegistry.get('txListener').api this.terminal = terminal // dependencies From f9b5b3639b70858130f95c5519d980c935df6c89 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 17 Feb 2020 16:49:37 +0100 Subject: [PATCH 03/18] fixed some errors. Todo: Home is broken --- package-lock.json | 102 ++++++++++++++--------------- src/app.js | 10 +-- src/app/components/hidden-panel.js | 2 +- src/app/components/panel.js | 2 +- src/app/components/side-panel.js | 14 ++-- src/app/panels/terminal.js | 7 +- src/app/ui/auto-complete-popup.js | 4 +- src/app/ui/txLogger.js | 4 +- src/remixAppManager.js | 4 +- 9 files changed, 74 insertions(+), 75 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3611f4e52d..a5bf161a0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11255,19 +11255,19 @@ "dependencies": { "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "code-point-at": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "cross-spawn": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "resolved": false, "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { @@ -11278,13 +11278,13 @@ }, "decamelize": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "resolved": false, "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "execa": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "resolved": false, "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { @@ -11299,7 +11299,7 @@ }, "find-up": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "resolved": false, "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { @@ -11308,25 +11308,25 @@ }, "get-caller-file": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "resolved": false, "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", "dev": true }, "get-stream": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": false, "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "invert-kv": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "resolved": false, "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { @@ -11335,19 +11335,19 @@ }, "is-stream": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "resolved": false, "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "resolved": false, "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "lcid": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "resolved": false, "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { @@ -11356,7 +11356,7 @@ }, "locate-path": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "resolved": false, "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { @@ -11366,7 +11366,7 @@ }, "lru-cache": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "resolved": false, "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true, "requires": { @@ -11376,7 +11376,7 @@ }, "mem": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "resolved": false, "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { @@ -11385,19 +11385,19 @@ }, "mimic-fn": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "resolved": false, "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -11406,7 +11406,7 @@ }, "npm-run-path": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "resolved": false, "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { @@ -11415,13 +11415,13 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "os-locale": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "resolved": false, "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { @@ -11432,19 +11432,19 @@ }, "p-finally": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "resolved": false, "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-limit": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "resolved": false, "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", "dev": true }, "p-locate": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "resolved": false, "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { @@ -11453,43 +11453,43 @@ }, "path-exists": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "resolved": false, "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "path-key": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "resolved": false, "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "pseudomap": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "resolved": false, "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, "require-directory": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "resolved": false, "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "resolved": false, "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "resolved": false, "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "shebang-command": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "resolved": false, "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { @@ -11498,19 +11498,19 @@ }, "shebang-regex": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "resolved": false, "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "resolved": false, "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -11521,7 +11521,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -11530,13 +11530,13 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": false, "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "which": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "resolved": false, "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { @@ -11545,13 +11545,13 @@ }, "which-module": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "resolved": false, "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": false, "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -11561,19 +11561,19 @@ }, "y18n": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "resolved": false, "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, "yallist": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "resolved": false, "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs": { "version": "10.0.3", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", + "resolved": false, "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", "dev": true, "requires": { @@ -11593,13 +11593,13 @@ "dependencies": { "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "resolved": false, "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "cliui": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "resolved": false, "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { @@ -11610,7 +11610,7 @@ "dependencies": { "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -11623,7 +11623,7 @@ }, "string-width": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "resolved": false, "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { @@ -11633,13 +11633,13 @@ "dependencies": { "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "resolved": false, "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "strip-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "resolved": false, "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { @@ -11652,7 +11652,7 @@ }, "yargs-parser": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", + "resolved": false, "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", "dev": true, "requires": { @@ -11661,7 +11661,7 @@ "dependencies": { "camelcase": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "resolved": false, "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true } diff --git a/src/app.js b/src/app.js index 0475c35c93..45d0ac806b 100644 --- a/src/app.js +++ b/src/app.js @@ -384,12 +384,12 @@ Please make a backup of your contracts and start using http://remix.ethereum.org console.log('couldn\'t register iframe plugins', e.message) } - await appManager.activate(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'offsetToLineColumnConverter']) - await appManager.activate(['mainPanel']) - await appManager.activate(['menuicons', 'home', 'sidePanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'terminal']) + await appManager.activatePlugin(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'offsetToLineColumnConverter']) + await appManager.activatePlugin(['mainPanel', 'menuicons']) + await appManager.activatePlugin(['home', 'sidePanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'terminal']) // Set workspace after initial activation - if (Array.isArray(workspace)) await appManager.activate(workspace) + if (Array.isArray(workspace)) await appManager.activatePlugin(workspace) // Load and start the service who manager layout and frame const framingService = new FramingService(sidePanel, menuicons, mainview, this._components.resizeFeature) @@ -415,6 +415,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org } if (isElectron()) { - appManager.activate(['remixd']) + appManager.activatePlugin(['remixd']) } } diff --git a/src/app/components/hidden-panel.js b/src/app/components/hidden-panel.js index 7cae9d04ff..73c6fb26e6 100644 --- a/src/app/components/hidden-panel.js +++ b/src/app/components/hidden-panel.js @@ -14,7 +14,7 @@ const profile = { displayName: 'Hidden Panel', description: '', version: packageJson.version, - methods: {} + methods: [] } export class HiddenPanel extends AbstractPanel { diff --git a/src/app/components/panel.js b/src/app/components/panel.js index 8601a7bc6a..bd1d59d176 100644 --- a/src/app/components/panel.js +++ b/src/app/components/panel.js @@ -1,7 +1,7 @@ import { EventEmitter } from 'events' const csjs = require('csjs-inject') const yo = require('yo-yo') -const { HostPlugin } = require('@remixproject/engine') +import { HostPlugin } from '@remixproject/engine' const css = csjs` .plugins { diff --git a/src/app/components/side-panel.js b/src/app/components/side-panel.js index 9d11987795..604a9521a6 100644 --- a/src/app/components/side-panel.js +++ b/src/app/components/side-panel.js @@ -62,7 +62,8 @@ export class SidePanel extends AbstractPanel { constructor (appManager, verticalIcons) { super(sidePanel) this.appManager = appManager - this.header = this.renderHeader() + this.header = yo`
` + this.renderHeader() this.verticalIcons = verticalIcons // Toggle content @@ -103,18 +104,18 @@ export class SidePanel extends AbstractPanel { * Display content and update the header * @param {String} name The name of the plugin to display */ - showContent (name) { + async showContent (name) { super.showContent(name) - yo.update(this.header, this.renderHeader()) + this.renderHeader() } /** The header of the side panel */ - renderHeader () { + async renderHeader () { let name = ' - ' let docLink = '' let versionWarning if (this.active) { - const { profile } = this.appManager.getPlugin(this.active) + const profile = await this.appManager.getProfile(this.active) name = profile.displayName ? profile.displayName : profile.name docLink = profile.documentation ? yo`` : '' if (profile.version && profile.version.match(/\b(\w*alpha\w*)\b/g)) { @@ -126,13 +127,14 @@ export class SidePanel extends AbstractPanel { } } - return yo` + const header = yo`
${name}
${docLink} ${versionWarning}
` + yo.update(this.header, header) } render () { diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index ba08966454..f333ebc7eb 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -98,9 +98,6 @@ class Terminal extends Plugin { if (opts.shell) self._shell = opts.shell // ??? register(self) } - setTxListener(txListener) { - this._opts.txListener = txListener - } logHtml (html) { var command = this.commands['html'] if (typeof command === 'function') command(html) @@ -137,7 +134,7 @@ class Terminal extends Plugin { self._view.inputSearch = yo` @@ -436,7 +433,7 @@ class Terminal extends Plugin { self._shell('remix.help()', self.commands, () => {}) self.commands.html(intro) - self._components.txLogger = new TxLogger(self._opts.eventsDecoder, self._opts.txListener, this, self.blockchain) + self._components.txLogger = new TxLogger(this, self.blockchain) self._components.txLogger.event.register('debuggingRequested', (hash) => { // TODO should probably be in the run module if (!self._opts.appManager.isActive('debugger')) self._opts.appManager.activatePlugin('debugger') diff --git a/src/app/ui/auto-complete-popup.js b/src/app/ui/auto-complete-popup.js index c4f3176e7a..f9284fc6cb 100644 --- a/src/app/ui/auto-complete-popup.js +++ b/src/app/ui/auto-complete-popup.js @@ -189,8 +189,8 @@ class AutoCompletePopup { extendAutocompletion () { // TODO: this is not using the appManager interface. Terminal should be put as module - this.opts.appManager.event.on('activate', (id) => { - const profile = this.opts.appManager.getPlugin(id).profile + this.opts.appManager.event.on('activate', async (id) => { + const profile = await this.opts.appManager.getProfile(id) if (!profile.methods) return profile.methods.forEach((method) => { const key = `remix.call({name: '${id}', key:'${method}', payload: []}).then((result) => { console.log(result) }).catch((error) => { console.log(error) })` diff --git a/src/app/ui/txLogger.js b/src/app/ui/txLogger.js index ef936814d2..2301ccbc06 100644 --- a/src/app/ui/txLogger.js +++ b/src/app/ui/txLogger.js @@ -125,8 +125,8 @@ class TxLogger { } return false } - this.eventsDecoder = globalRegistry.get('eventsDecoder').api - this.txListener = globalRegistry.get('txListener').api + this.eventsDecoder = globlalRegistry.get('eventsDecoder').api + this.txListener = globlalRegistry.get('txlistener').api this.terminal = terminal // dependencies this._deps = { diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 252a41a8e1..21822642ac 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -8,9 +8,9 @@ const requiredModules = [ // services + layout views + system views 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'fileExplorers', 'terminal', 'settings', 'pluginManager'] -export function isNative(name) { +export function isNative (name) { const nativePlugins = ['vyper', 'workshops', 'ethdoc', 'etherscan'] - return nativePlugins.includes(name) + return nativePlugins.includes(name) || requiredModules.includes(name) } export class RemixAppManager extends PluginManager { From 1a07b6c5a7630fe764e07c9557b09bfb70fde710 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Feb 2020 10:31:55 +0100 Subject: [PATCH 04/18] fix emitting and registering to pluginActivated and pluginDeactivated --- src/app/components/side-panel.js | 2 +- src/app/panels/tab-proxy.js | 17 ++++++++--------- src/app/tabs/test-tab.js | 8 ++++---- src/app/ui/auto-complete-popup.js | 7 +++---- src/remixAppManager.js | 20 +++++++++++++++----- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/app/components/side-panel.js b/src/app/components/side-panel.js index 604a9521a6..a4a5e23245 100644 --- a/src/app/components/side-panel.js +++ b/src/app/components/side-panel.js @@ -127,7 +127,7 @@ export class SidePanel extends AbstractPanel { } } - const header = yo` + const header = yo`
${name}
${docLink} diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index 47e8e715a5..8328e0957f 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -49,25 +49,24 @@ export class TabProxy { }) }) - appManager.event.on('activate', (name) => { - const { profile } = appManager.getPlugin(name) + appManager.event.on('activate', (profile) => { if (profile.location === 'mainPanel') { this.addTab( - name, + profile.name, profile.displayName, - () => this.event.emit('switchApp', name), + () => this.event.emit('switchApp', profile.name), () => { - this.event.emit('closeApp', name) - this.appManager.deactivatePlugin(name) + this.event.emit('closeApp', profile.name) + this.appManager.deactivatePlugin(profile.name) }, profile.icon ) - this.switchTab(name) + this.switchTab(profile.name) } }) - appManager.event.on('deactivate', (name) => { - this.removeTab(name) + appManager.event.on('deactivate', (profile) => { + this.removeTab(profile.name) }) appManager.event.on('ensureActivated', (name) => { diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 28bc2ba059..62d10fe28b 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -30,11 +30,11 @@ module.exports = class TestTab extends ViewPlugin { this.appManager = appManager this.renderer = renderer this.baseurl = 'https://solc-bin.ethereum.org/bin' - appManager.event.on('activate', (name) => { - if (name === 'solidity') this.updateRunAction(fileManager.currentFile()) + appManager.event.on('activate', (profile) => { + if (profile.name === 'solidity') this.updateRunAction(fileManager.currentFile()) }) - appManager.event.on('deactivate', (name) => { - if (name === 'solidity') this.updateRunAction(fileManager.currentFile()) + appManager.event.on('deactivate', (profile) => { + if (profile.name === 'solidity') this.updateRunAction(fileManager.currentFile()) }) } diff --git a/src/app/ui/auto-complete-popup.js b/src/app/ui/auto-complete-popup.js index f9284fc6cb..9a472c503d 100644 --- a/src/app/ui/auto-complete-popup.js +++ b/src/app/ui/auto-complete-popup.js @@ -189,13 +189,12 @@ class AutoCompletePopup { extendAutocompletion () { // TODO: this is not using the appManager interface. Terminal should be put as module - this.opts.appManager.event.on('activate', async (id) => { - const profile = await this.opts.appManager.getProfile(id) + this.opts.appManager.event.on('activate', async (profile) => { if (!profile.methods) return profile.methods.forEach((method) => { - const key = `remix.call({name: '${id}', key:'${method}', payload: []}).then((result) => { console.log(result) }).catch((error) => { console.log(error) })` + const key = `remix.call({name: '${profile.name}', key:'${method}', payload: []}).then((result) => { console.log(result) }).catch((error) => { console.log(error) })` const keyValue = {} - keyValue[key] = `call ${id} - ${method}` + keyValue[key] = `call ${profile.name} - ${method}` if (this.extraCommands.includes(keyValue)) return this.extraCommands.push(keyValue) }) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 21822642ac..2432934043 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -8,7 +8,7 @@ const requiredModules = [ // services + layout views + system views 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'fileExplorers', 'terminal', 'settings', 'pluginManager'] -export function isNative (name) { +export function isNative (name) { const nativePlugins = ['vyper', 'workshops', 'ethdoc', 'etherscan'] return nativePlugins.includes(name) || requiredModules.includes(name) } @@ -36,9 +36,9 @@ export class RemixAppManager extends PluginManager { return true } - onActivated (plugin) { + onPluginActivated (plugin) { this.pluginLoader.set(plugin, this.actives) - this.event.emit('activate', plugin.name) + this.event.emit('activate', plugin) } getAll () { @@ -51,9 +51,9 @@ export class RemixAppManager extends PluginManager { return Object.keys(this.registered) } - onDeactivated (plugin) { + onPluginDeactivated (plugin) { this.pluginLoader.set(plugin, this.actives) - this.event.emit('deactivate', plugin.name) + this.event.emit('deactivate', plugin) } onRegistration (plugin) { @@ -62,6 +62,16 @@ export class RemixAppManager extends PluginManager { this.event.emit('added', plugin.name) } + ensureActivated (apiName) { + if (!this.isActive(apiName)) this.activateOne(apiName) + this.event.emit('ensureActivated', apiName) + } + + ensureDeactivated (apiName) { + if (this.isActive(apiName)) this.deactivateOne(apiName) + this.event.emit('ensureDeactivated', apiName) + } + deactivatePlugin (name) { if (requiredModules.includes(name)) return super.deactivatePlugin(name) From c6a171c18d1bd3e0a451a736ad9e72ae034dd58e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Feb 2020 13:10:28 +0100 Subject: [PATCH 05/18] manager as required module --- src/remixAppManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 2432934043..ef071773bd 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -4,7 +4,7 @@ import { EventEmitter } from 'events' import QueryParams from './lib/query-params' const requiredModules = [ // services + layout views + system views - 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme', 'fileManager', 'contentImport', + 'manager', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme', 'fileManager', 'contentImport', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'fileExplorers', 'terminal', 'settings', 'pluginManager'] From 35a63e508648b27edbd4608337f1da694ccd8da9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Feb 2020 13:11:32 +0100 Subject: [PATCH 06/18] use out of the box profiles --- src/remixAppManager.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index ef071773bd..ad45ef2c75 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -18,7 +18,6 @@ export class RemixAppManager extends PluginManager { constructor (plugins) { super() this.event = new EventEmitter() - this.registered = {} this.pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json' this.pluginLoader = new PluginLoader() } @@ -42,13 +41,13 @@ export class RemixAppManager extends PluginManager { } getAll () { - return Object.keys(this.registered).map((p) => { - return this.registered[p] + return Object.keys(this.profiles).map((p) => { + return this.profiles[p] }) } getIds () { - return Object.keys(this.registered) + return Object.keys(this.profiles) } onPluginDeactivated (plugin) { @@ -57,18 +56,16 @@ export class RemixAppManager extends PluginManager { } onRegistration (plugin) { - if (!this.registered) this.registered = {} - this.registered[plugin.name] = plugin this.event.emit('added', plugin.name) } - ensureActivated (apiName) { - if (!this.isActive(apiName)) this.activateOne(apiName) + async ensureActivated (apiName) { + await this.activatePlugin(apiName) this.event.emit('ensureActivated', apiName) } - ensureDeactivated (apiName) { - if (this.isActive(apiName)) this.deactivateOne(apiName) + async ensureDeactivated (apiName) { + await this.deactivatePlugin(apiName) this.event.emit('ensureDeactivated', apiName) } From c2b97eb00df3e13dee59b8112dbd48060e8baf5b Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Feb 2020 13:11:54 +0100 Subject: [PATCH 07/18] fix doc and remove unused param --- src/app/components/local-plugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/local-plugin.js b/src/app/components/local-plugin.js index bcd2929236..73eb282593 100644 --- a/src/app/components/local-plugin.js +++ b/src/app/components/local-plugin.js @@ -12,7 +12,7 @@ module.exports = class LocalPlugin { /** * Open a modal to create a local plugin - * @param {PluginApi[]} plugins The list of the plugins in the store + * @param {Profile[]} plugins The list of the plugins in the store * @returns {Promise<{api: any, profile: any}>} A promise with the new plugin profile */ open (plugins) { @@ -26,7 +26,7 @@ module.exports = class LocalPlugin { reject(err) } } - modalDialog('Local Plugin', this.form(plugins), + modalDialog('Local Plugin', this.form(), { fn: () => onValidation() }, { fn: () => resolve() } ) From 0222afcd2539cc7ef4c84ef25149deaebd287f7f Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Feb 2020 13:12:13 +0100 Subject: [PATCH 08/18] fix isActive --- src/app/panels/terminal.js | 4 ++-- src/app/tabs/test-tab.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index f333ebc7eb..624f0a268b 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -434,9 +434,9 @@ class Terminal extends Plugin { self.commands.html(intro) self._components.txLogger = new TxLogger(this, self.blockchain) - self._components.txLogger.event.register('debuggingRequested', (hash) => { + self._components.txLogger.event.register('debuggingRequested', async (hash) => { // TODO should probably be in the run module - if (!self._opts.appManager.isActive('debugger')) self._opts.appManager.activatePlugin('debugger') + if (!await self._opts.appManager.isActive('debugger')) await self._opts.appManager.activatePlugin('debugger') this.call('debugger', 'debug', hash) this.call('menuicons', 'select', 'debugger') }) diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 62d10fe28b..7f42a62a8b 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -225,9 +225,9 @@ module.exports = class TestTab extends ViewPlugin { return this.generateFileActionElement } - updateRunAction (currentFile) { + async updateRunAction (currentFile) { let el = yo`` - const isSolidityActive = this.appManager.isActive('solidity') + const isSolidityActive = await this.appManager.isActive('solidity') if (!currentFile || !isSolidityActive) { el.setAttribute('disabled', 'disabled') if (!currentFile) el.setAttribute('title', 'No file selected') From 7a7f2592244179a4c66e3304856dbacdff643739 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Feb 2020 13:12:27 +0100 Subject: [PATCH 09/18] fix plugins list --- .../components/plugin-manager-component.js | 46 +++++++++---------- src/app/tabs/test-tab.js | 4 +- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 02194a9b1d..9fc4961813 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -87,35 +87,32 @@ class PluginManagerComponent extends ViewPlugin { this.appManager.event.on('added', () => { this.reRender() }) } - renderItem (name) { - const api = this.appManager.getPlugin(name) - if (!api) return - const isActive = this.appManager.isActive(name) - const displayName = (api.profile.displayName) ? api.profile.displayName : name + renderItem (profile, isActive) { + const displayName = (profile.displayName) ? profile.displayName : profile.name // Check version of the plugin let versionWarning // Alpha - if (api.profile.version && api.profile.version.match(/\b(\w*alpha\w*)\b/g)) { + if (profile.version && profile.version.match(/\b(\w*alpha\w*)\b/g)) { versionWarning = yo`alpha` } // Beta - if (api.profile.version && api.profile.version.match(/\b(\w*beta\w*)\b/g)) { + if (profile.version && profile.version.match(/\b(\w*beta\w*)\b/g)) { versionWarning = yo`beta` } const activationButton = isActive ? yo` - ` : yo` - ` return yo` -
+
${displayName} @@ -123,7 +120,7 @@ class PluginManagerComponent extends ViewPlugin {
${activationButton}
-

${api.profile.description}

+

${profile.description}

` } @@ -154,25 +151,26 @@ class PluginManagerComponent extends ViewPlugin { render () { // Filtering helpers - const isFiltered = (api) => (api.profile.displayName ? api.profile.displayName : api.name).toLowerCase().includes(this.filter) - const isNotRequired = ({profile}) => !this.appManager.isRequired(profile.name) - const isNotHome = ({profile}) => profile.name !== 'home' - const sortByName = (a, b) => { - const nameA = ((a.profile.displayName) ? a.profile.displayName : a.profile.name).toUpperCase() - const nameB = ((b.profile.displayName) ? b.profile.displayName : b.profile.name).toUpperCase() + const isFiltered = (profile) => (profile.displayName ? profile.displayName : profile.name).toLowerCase().includes(this.filter) + const isNotRequired = (profile) => !this.appManager.isRequired(profile.name) + const isNotHome = (profile) => profile.name !== 'home' + const sortByName = (profileA, profileB) => { + const nameA = ((profileA.displayName) ? profileA.displayName : profileA.name).toUpperCase() + const nameB = ((profileB.displayName) ? profileB.displayName : profileB.name).toUpperCase() return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0 } // Filter all active and inactive modules that are not required - const { actives, inactives } = this.appManager.getAll() + const isActive = (name) => { return this.appManager.actives.includes(name) } + + const {actives, inactives} = this.appManager.getAll() .filter(isFiltered) .filter(isNotRequired) .filter(isNotHome) .sort(sortByName) - .reduce(({actives, inactives}, api) => { - return this.appManager.isActive(api.name) - ? { actives: [...actives, api.name], inactives } - : { inactives: [...inactives, api.name], actives } + .reduce(({actives, inactives}, profile) => { + return isActive(profile.name) ? { actives: [...actives, profile], inactives } + : { inactives: [...inactives, profile], actives } }, { actives: [], inactives: [] }) const activeTile = actives.length !== 0 @@ -203,11 +201,11 @@ class PluginManagerComponent extends ViewPlugin {
${activeTile}
- ${actives.map(name => this.renderItem(name))} + ${actives.map(profile => this.renderItem(profile, isActive(profile.name)))}
${inactiveTile}
- ${inactives.map(name => this.renderItem(name))} + ${inactives.map(profile => this.renderItem(profile, isActive(profile.name)))}
${settings} diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 7f42a62a8b..8aaa9977e5 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -225,9 +225,9 @@ module.exports = class TestTab extends ViewPlugin { return this.generateFileActionElement } - async updateRunAction (currentFile) { + updateRunAction (currentFile) { let el = yo`` - const isSolidityActive = await this.appManager.isActive('solidity') + const isSolidityActive = this.appManager.actives.includes('solidity') if (!currentFile || !isSolidityActive) { el.setAttribute('disabled', 'disabled') if (!currentFile) el.setAttribute('title', 'No file selected') From 50057378dff1b048b27e884390a090fab56c4a3a Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 12 Feb 2020 09:53:26 +0100 Subject: [PATCH 10/18] using new engine --- package-lock.json | 28 +++++++++++++++++++++------- src/app.js | 1 + src/app/panels/terminal.js | 3 +++ src/remixAppManager.js | 7 +++++++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index a5bf161a0b..7e0c19eff0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6755,11 +6755,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6772,15 +6774,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6883,7 +6888,8 @@ }, "inherits": { "version": "2.0.4", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6893,6 +6899,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6905,17 +6912,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.9.0", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6932,6 +6942,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -7012,7 +7023,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7022,6 +7034,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7127,6 +7140,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/app.js b/src/app.js index 45d0ac806b..fffdd7aefc 100644 --- a/src/app.js +++ b/src/app.js @@ -247,6 +247,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org self._view.el.style.visibility = 'visible' }, 1500) }) + // ----------------- editor servive ---------------------------- const editor = new Editor({}, themeModule) // wrapper around ace editor registry.put({api: editor, name: 'editor'}) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index 624f0a268b..538e6bef60 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -98,6 +98,9 @@ class Terminal extends Plugin { if (opts.shell) self._shell = opts.shell // ??? register(self) } + setTxListener(txListener) { + this._opts.txListener = txListener + } logHtml (html) { var command = this.commands['html'] if (typeof command === 'function') command(html) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index ad45ef2c75..31160f84ec 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -35,7 +35,11 @@ export class RemixAppManager extends PluginManager { return true } +<<<<<<< HEAD onPluginActivated (plugin) { +======= + onActivated (plugin) { +>>>>>>> ac82ba81... using new engine this.pluginLoader.set(plugin, this.actives) this.event.emit('activate', plugin) } @@ -59,6 +63,7 @@ export class RemixAppManager extends PluginManager { this.event.emit('added', plugin.name) } +<<<<<<< HEAD async ensureActivated (apiName) { await this.activatePlugin(apiName) this.event.emit('ensureActivated', apiName) @@ -69,6 +74,8 @@ export class RemixAppManager extends PluginManager { this.event.emit('ensureDeactivated', apiName) } +======= +>>>>>>> ac82ba81... using new engine deactivatePlugin (name) { if (requiredModules.includes(name)) return super.deactivatePlugin(name) From f7a39b036eabaf63118b5d0650517ea9868c08d8 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 17 Feb 2020 16:49:37 +0100 Subject: [PATCH 11/18] fixed some errors. Todo: Home is broken --- package-lock.json | 13 +++++++++---- src/app.js | 1 - src/app/panels/terminal.js | 3 --- src/remixAppManager.js | 7 ------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7e0c19eff0..8401a852ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6737,7 +6737,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -7110,7 +7111,8 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7158,6 +7160,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7196,11 +7199,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.1.1", - "bundled": true + "bundled": true, + "optional": true } } }, diff --git a/src/app.js b/src/app.js index fffdd7aefc..45d0ac806b 100644 --- a/src/app.js +++ b/src/app.js @@ -247,7 +247,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org self._view.el.style.visibility = 'visible' }, 1500) }) - // ----------------- editor servive ---------------------------- const editor = new Editor({}, themeModule) // wrapper around ace editor registry.put({api: editor, name: 'editor'}) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index 538e6bef60..624f0a268b 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -98,9 +98,6 @@ class Terminal extends Plugin { if (opts.shell) self._shell = opts.shell // ??? register(self) } - setTxListener(txListener) { - this._opts.txListener = txListener - } logHtml (html) { var command = this.commands['html'] if (typeof command === 'function') command(html) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 31160f84ec..ad45ef2c75 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -35,11 +35,7 @@ export class RemixAppManager extends PluginManager { return true } -<<<<<<< HEAD onPluginActivated (plugin) { -======= - onActivated (plugin) { ->>>>>>> ac82ba81... using new engine this.pluginLoader.set(plugin, this.actives) this.event.emit('activate', plugin) } @@ -63,7 +59,6 @@ export class RemixAppManager extends PluginManager { this.event.emit('added', plugin.name) } -<<<<<<< HEAD async ensureActivated (apiName) { await this.activatePlugin(apiName) this.event.emit('ensureActivated', apiName) @@ -74,8 +69,6 @@ export class RemixAppManager extends PluginManager { this.event.emit('ensureDeactivated', apiName) } -======= ->>>>>>> ac82ba81... using new engine deactivatePlugin (name) { if (requiredModules.includes(name)) return super.deactivatePlugin(name) From 1426cad1a638c506c493942d9f871b4fe9d52485 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 26 Feb 2020 11:19:28 +0100 Subject: [PATCH 12/18] update after review --- package-lock.json | 47 ++++++------------- package.json | 2 +- src/app.js | 6 +-- .../components/plugin-manager-component.js | 20 +++++--- src/app/panels/tab-proxy.js | 18 +++---- src/app/panels/terminal.js | 2 +- src/app/tabs/test-tab.js | 8 ++-- 7 files changed, 44 insertions(+), 59 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8401a852ab..f32c87ee4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1778,9 +1778,9 @@ "integrity": "sha512-ePDxG9UuU9Kobk90ZUjtmDW8IT9U7aRb1/Rl9683MRNM+ur0ocHL2v7TPH2ajTiVSBUFbbeW8vKIt9jrb0JIAA==" }, "@remixproject/engine": { - "version": "0.2.0-alpha.1", - "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.2.0-alpha.1.tgz", - "integrity": "sha512-KeYCDBa02MddlyCDSF7YGTZgVcOWeNt4MEcTT/IMpHRyAht0apAq+2MDCMH3l1/wZ3ggiH0ZV12KxM/ZcQ92UQ==" + "version": "0.2.0-alpha.4", + "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.2.0-alpha.4.tgz", + "integrity": "sha512-AY6HaF7Y4fR1oOdz60B2zt+gGftaT5fZWSl5ka7UuDHZUzeouNMx4O1+Uk4376Mv+M3vdmpGFo6KgfsZj6wSJw==" }, "@resolver-engine/core": { "version": "0.3.3", @@ -6737,8 +6737,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -6756,13 +6755,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6775,18 +6772,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -6889,8 +6883,7 @@ }, "inherits": { "version": "2.0.4", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -6900,7 +6893,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6913,20 +6905,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.9.0", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6943,7 +6932,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7024,8 +7012,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -7035,7 +7022,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7111,8 +7097,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -7142,7 +7127,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7160,7 +7144,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7199,13 +7182,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.1.1", - "bundled": true, - "optional": true + "bundled": true } } }, diff --git a/package.json b/package.json index 8874705b7c..a6952b179a 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "yo-yoify": "^3.7.3" }, "dependencies": { - "@remixproject/engine": "^0.2.0-alpha.1", + "@remixproject/engine": "^0.2.0-alpha.4", "http-server": "^0.11.1", "remixd": "0.1.8-alpha.10", "standard": "^8.5.0" diff --git a/src/app.js b/src/app.js index 45d0ac806b..d17876303d 100644 --- a/src/app.js +++ b/src/app.js @@ -308,9 +308,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const mainview = new MainView(contextualListener, editor, appPanel, fileManager, appManager, terminal) registry.put({ api: mainview, name: 'mainview' }) - engine.register([ - appPanel - ]) + engine.register(appPanel) // those views depend on app_manager const menuicons = new VerticalIcons(appManager) @@ -415,6 +413,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org } if (isElectron()) { - appManager.activatePlugin(['remixd']) + appManager.activatePlugin('remixd') } } diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 9fc4961813..9c5fde5e4c 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -87,7 +87,11 @@ class PluginManagerComponent extends ViewPlugin { this.appManager.event.on('added', () => { this.reRender() }) } - renderItem (profile, isActive) { + isActive (name) { + return this.appManager.actives.includes(name) + } + + renderItem (profile) { const displayName = (profile.displayName) ? profile.displayName : profile.name // Check version of the plugin @@ -101,11 +105,12 @@ class PluginManagerComponent extends ViewPlugin { versionWarning = yo`beta` } - const activationButton = isActive + const activationButton = this.isActive(profile.name) ? yo` ` + + ` : yo` ` : yo` - ` @@ -166,8 +169,6 @@ class PluginManagerComponent extends ViewPlugin { } // Filter all active and inactive modules that are not required - - const {actives, inactives} = this.appManager.getAll() .filter(isFiltered) .filter(isNotRequired) From c8b2a8ee0c3977e6400353e5475b49dd8537c469 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 28 Feb 2020 13:17:52 +0100 Subject: [PATCH 14/18] style fix --- src/app/components/plugin-manager-component.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index d8b9d06839..3260a8bccb 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -107,7 +107,10 @@ class PluginManagerComponent extends ViewPlugin { const activationButton = this.isActive(profile.name) ? yo` - ` From 1fb145927547589707cb7f6a08298fe30b60e1eb Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 28 Feb 2020 14:10:24 +0100 Subject: [PATCH 15/18] fixing the test --- test-browser/tests/pluginManager.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test-browser/tests/pluginManager.js b/test-browser/tests/pluginManager.js index 9cdb0c1de5..7a0c13c88f 100644 --- a/test-browser/tests/pluginManager.js +++ b/test-browser/tests/pluginManager.js @@ -22,20 +22,20 @@ module.exports = { 'Should Search for plugins': function (browser) { browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys('debugger') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') - .clearValue('*[data-id="pluginManagerComponentSearchInput"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys('Deploy & run transactions') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonudapp"]') - .clearValue('*[data-id="pluginManagerComponentSearchInput"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys('ZoKrates') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonZoKrates"]') - .clearValue('*[data-id="pluginManagerComponentSearchInput"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys(browser.Keys.ENTER) + .click('*[data-id="pluginManagerComponentSearchInput"]') + .keys('debugger') + .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') + .clearValue('*[data-id="pluginManagerComponentSearchInput"]') + .click('*[data-id="pluginManagerComponentSearchInput"]') + .keys('Deploy & run transactions') + .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonudapp"]') + .clearValue('*[data-id="pluginManagerComponentSearchInput"]') + .click('*[data-id="pluginManagerComponentSearchInput"]') + .keys('ZoKrates') + .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonZoKrates"]') + .clearValue('*[data-id="pluginManagerComponentSearchInput"]') + .click('*[data-id="pluginManagerComponentSearchInput"]') + .keys(browser.Keys.ENTER) }, 'Should activate plugins': function (browser) { From c4ca82a9f8e0f2b58cfae8e8953d2dfeb327a0e4 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 28 Feb 2020 16:51:54 +0100 Subject: [PATCH 16/18] switched off test for permition dialog --- src/remixAppManager.js | 2 +- test-browser/tests/pluginManager.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index ad45ef2c75..809a5b136b 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -23,7 +23,7 @@ export class RemixAppManager extends PluginManager { } async canActivate (from, to) { - return true + return from.name === 'manager' } async canDeactivate (from, to) { diff --git a/test-browser/tests/pluginManager.js b/test-browser/tests/pluginManager.js index 7a0c13c88f..2f036e4f27 100644 --- a/test-browser/tests/pluginManager.js +++ b/test-browser/tests/pluginManager.js @@ -58,6 +58,7 @@ module.exports = { .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonudapp"]') }, + /* 'Should grant plugin permission (ZOKRATES)': function (browser) { browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') .click('*[data-id="pluginManagerSettingsButton"]') @@ -92,6 +93,7 @@ module.exports = { .assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet') .modalFooterOKClick() }, + */ 'Should connect a local plugin': function (browser) { browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') @@ -124,6 +126,6 @@ module.exports = { .assert.containsText('*[data-id="tooltipPopup"]', 'Cannot create Plugin : This name has already been used') .end() }, - + tearDown: sauce } From 85ab98fe42a744eb6e1eb3e7bac08837b026b41c Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 28 Feb 2020 18:31:33 +0100 Subject: [PATCH 17/18] standart --- test-browser/tests/pluginManager.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test-browser/tests/pluginManager.js b/test-browser/tests/pluginManager.js index 2f036e4f27..5b2442b48b 100644 --- a/test-browser/tests/pluginManager.js +++ b/test-browser/tests/pluginManager.js @@ -126,6 +126,5 @@ module.exports = { .assert.containsText('*[data-id="tooltipPopup"]', 'Cannot create Plugin : This name has already been used') .end() }, - tearDown: sauce } From 10b52bd8091b644a4e96f4e2d06abb8b53ede7dd Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 2 Mar 2020 14:10:45 +0100 Subject: [PATCH 18/18] fixed local plugin registration --- src/app.js | 2 +- src/app/components/local-plugin.js | 1 - src/app/components/plugin-manager-component.js | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app.js b/src/app.js index d17876303d..12e7b7ec8c 100644 --- a/src/app.js +++ b/src/app.js @@ -315,7 +315,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const landingPage = new LandingPage(appManager, menuicons) const sidePanel = new SidePanel(appManager, menuicons) const hiddenPanel = new HiddenPanel() - const pluginManagerComponent = new PluginManagerComponent(appManager) + const pluginManagerComponent = new PluginManagerComponent(appManager, engine) const filePanel = new FilePanel(appManager) let settings = new SettingsTab( registry.get('config').api, diff --git a/src/app/components/local-plugin.js b/src/app/components/local-plugin.js index 73eb282593..f71e10d7bb 100644 --- a/src/app/components/local-plugin.js +++ b/src/app/components/local-plugin.js @@ -9,7 +9,6 @@ const defaultProfile = { } module.exports = class LocalPlugin { - /** * Open a modal to create a local plugin * @param {Profile[]} plugins The list of the plugins in the store diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 3260a8bccb..2b95d250e7 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -72,7 +72,7 @@ const profile = { class PluginManagerComponent extends ViewPlugin { - constructor (appManager) { + constructor (appManager, engine) { super(profile) this.event = new EventEmitter() this.appManager = appManager @@ -85,6 +85,7 @@ class PluginManagerComponent extends ViewPlugin { this.appManager.event.on('activate', () => { this.reRender() }) this.appManager.event.on('deactivate', () => { this.reRender() }) this.appManager.event.on('added', () => { this.reRender() }) + this.engine = engine } isActive (name) { @@ -149,10 +150,9 @@ class PluginManagerComponent extends ViewPlugin { if (this.appManager.getIds().includes(profile.name)) { throw new Error('This name has already been used') } - const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile) - this.appManager.registerOne(plugin) - this.appManager.activatePlugin(profile.name) + this.engine.register(plugin) + this.appManager.activatePlugin(plugin.name) } catch (err) { // TODO : Use an alert to handle this error instead of a console.log console.log(`Cannot create Plugin : ${err.message}`)