From e0d932d8b08d2f4ff28728132d62a247e66d0dc1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 2 Oct 2020 10:12:05 +0200 Subject: [PATCH 1/3] deactivatePluginsFromUrl --- apps/remix-ide/src/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 87fab9f7c5..e15bb59aaa 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -405,6 +405,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // Set workspace after initial activation if (Array.isArray(workspace)) { appManager.activatePlugin(workspace).then(() => { + try { + if (params.deactivateplugins) { + appManager.deactivatePlugin(params.deactivateplugins.split(',')) + } + } catch (e) { + console.log(e) + } + // If plugins are loaded from the URL params, we focus on the last one. if (pluginLoader.current === 'queryParams' && workspace.length > 0) menuicons.select(workspace[workspace.length - 1]) From 89e4b2b36ed7f48480aa52558ec1f48918172017 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 5 Oct 2020 10:37:51 +0200 Subject: [PATCH 2/3] add e2e tests - deactivate plugins --- apps/remix-ide-e2e/src/tests/workspace.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index d2739b2e64..78735f9a5d 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -5,7 +5,7 @@ import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp&plugincall=fileManager//open//3_Ballot.sol', false) + init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp&plugincall=fileManager//open//3_Ballot.sol&deactivateplugins=home', false) }, 'CheckSolidityActivatedAndUDapp': function (browser: NightwatchBrowser) { @@ -20,7 +20,12 @@ module.exports = { .pause(5000) .getEditorValue((content) => { browser.assert.ok(content.indexOf('contract Ballot {') != -1, 'content doesn\'t include Ballot contract') - }) + }) + }, + + 'Home page should be deactivated': function (browser: NightwatchBrowser) { + browser + .waitForElementNotPresent('[data-id="landingPageHomeContainer"]') .end() }, From 536816f8eb86ac05b2c491b57d6c18896bc1d477 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 5 Oct 2020 10:49:31 +0200 Subject: [PATCH 3/3] renaming: - plugins => activate - pluginCall => call - deactivatePlugin => deactivate --- apps/remix-ide-e2e/src/tests/workspace.test.ts | 2 +- apps/remix-ide/src/app.js | 8 ++++---- apps/remix-ide/src/remixAppManager.js | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 78735f9a5d..0dbccb98ec 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -5,7 +5,7 @@ import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp&plugincall=fileManager//open//3_Ballot.sol&deactivateplugins=home', false) + init(browser, done, 'http://127.0.0.1:8080?activate=solidity,udapp&call=fileManager//open//3_Ballot.sol&deactivate=home', false) }, 'CheckSolidityActivatedAndUDapp': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index e15bb59aaa..926ef0f880 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -406,8 +406,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org if (Array.isArray(workspace)) { appManager.activatePlugin(workspace).then(() => { try { - if (params.deactivateplugins) { - appManager.deactivatePlugin(params.deactivateplugins.split(',')) + if (params.deactivate) { + appManager.deactivatePlugin(params.deactivate.split(',')) } } catch (e) { console.log(e) @@ -416,8 +416,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // If plugins are loaded from the URL params, we focus on the last one. if (pluginLoader.current === 'queryParams' && workspace.length > 0) menuicons.select(workspace[workspace.length - 1]) - if (params.plugincall) { - const callDetails = params.plugincall.split('//') + if (params.call) { + const callDetails = params.call.split('//') if (callDetails.length > 1) { toolTip(`initiating ${callDetails[0]} ...`) // @todo(remove the timeout when activatePlugin is on 0.3.0) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 7e79bcdd35..6dbd09aac8 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -135,13 +135,13 @@ class PluginLoader { this.loaders['queryParams'] = { set: () => {}, get: () => { - const { plugins } = queryParams.get() - if (!plugins) return [] - return plugins.split(',') + const { activate } = queryParams.get() + if (!activate) return [] + return activate.split(',') } } - this.current = queryParams.get()['plugins'] ? 'queryParams' : 'localStorage' + this.current = queryParams.get()['activate'] ? 'queryParams' : 'localStorage' } set (plugin, actives) {