diff --git a/apps/remix-ide-e2e/src/commands/executeScript.ts b/apps/remix-ide-e2e/src/commands/executeScript.ts index dbb93e66db..7ab8655529 100644 --- a/apps/remix-ide-e2e/src/commands/executeScript.ts +++ b/apps/remix-ide-e2e/src/commands/executeScript.ts @@ -4,9 +4,8 @@ import EventEmitter from 'events' class ExecuteScript extends EventEmitter { command (this: NightwatchBrowser, script: string): NightwatchBrowser { this.api - .clearEditableContent('*[data-id="terminalCliInput"]') + .clearValue('*[data-id="terminalCliInput"]') .click('*[data-id="terminalCli"]') - .setValue('*[data-id="terminalCliInput"]', [this.api.Keys.CONTROL, 'a', this.api.Keys.DELETE]) .sendKeys('*[data-id="terminalCliInput"]', script) .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 7e176b362a..9036d422ff 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -4,7 +4,7 @@ import init from '../helpers/init' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false) + init(browser, done, 'http://localhost:8080?plugins=solidity,udapp', false) }, 'Should execution a simple console command': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide/src/app/files/fileProvider.js b/apps/remix-ide/src/app/files/fileProvider.js index 3c310e0644..e8b45c2ac8 100644 --- a/apps/remix-ide/src/app/files/fileProvider.js +++ b/apps/remix-ide/src/app/files/fileProvider.js @@ -1,6 +1,7 @@ 'use strict' import { CompilerImports } from '@remix-project/core-plugin' +import { ConsoleLogs } from 'libs/remix-lib/src/helpers/hhconsoleSigs' const EventManager = require('events') const modalDialogCustom = require('../ui/modal-dialog-custom') const tooltip = require('../ui/tooltip') @@ -57,11 +58,11 @@ class FileProvider { this.getNormalizedName(value), true, (loadingMsg) => { tooltip(loadingMsg) }, - (error, content, cleanUrl, type, url) => { + async (error, content, cleanUrl, type, url) => { if (error) { modalDialogCustom.alert(error) } else { - this.addExternal(type + '/' + cleanUrl, content, url) + await this.addExternal(type + '/' + cleanUrl, content, url) } } ) @@ -134,9 +135,11 @@ class FileProvider { if (!await window.remixFileSystem.exists(currentCheck)) { try { await window.remixFileSystem.mkdir(currentCheck) + console.log('folder add', currentCheck, this._normalizePath(currentCheck)) this.event.emit('folderAdded', this._normalizePath(currentCheck)) + console.log("folderd added") } catch (error) { - + console.log(error) } } } @@ -144,9 +147,9 @@ class FileProvider { } // this will not add a folder as readonly but keep the original url to be able to restore it later - addExternal (path, content, url) { + async addExternal (path, content, url) { if (url) this.addNormalizedName(path, url) - return this.set(path, content) + return await this.set(path, content) } isReadOnly (path) { @@ -277,18 +280,21 @@ class FileProvider { path = this.removePrefix(path) if (path.indexOf('/') !== 0) path = '/' + path try { + console.log('res dir', path) const files = await window.remixFileSystem.readdir(path) const ret = {} - + console.log(files) if (files) { for (let element of files) { path = path.replace(/^\/|\/$/g, '') // remove first and last slash element = element.replace(/^\/|\/$/g, '') // remove first and last slash const absPath = (path === '/' ? '' : path) + '/' + element + console.log("stat ", absPath, await window.remixFileSystem.stat(absPath)) ret[absPath.indexOf('/') === 0 ? absPath.substr(1, absPath.length) : absPath] = { isDirectory: (await window.remixFileSystem.stat(absPath)).isDirectory() } // ^ ret does not accept path starting with '/' } } + console.log("return", ret) if (cb) cb(null, ret) return ret } catch (error) { diff --git a/apps/remix-ide/src/app/ui/landing-page/landing-page.js b/apps/remix-ide/src/app/ui/landing-page/landing-page.js index 744b5c988b..bd3adf9b7f 100644 --- a/apps/remix-ide/src/app/ui/landing-page/landing-page.js +++ b/apps/remix-ide/src/app/ui/landing-page/landing-page.js @@ -255,12 +255,12 @@ export class LandingPage extends ViewPlugin { contentImport.import( target, (loadingMsg) => { tooltip(loadingMsg) }, - (error, content, cleanUrl, type, url) => { + async (error, content, cleanUrl, type, url) => { if (error) { modalDialogCustom.alert(title, error.message || error) } else { try { - fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url) + await fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url) this.verticalIcons.select('filePanel') } catch (e) { modalDialogCustom.alert(title, e.message) diff --git a/apps/remix-ide/src/publishToStorage.js b/apps/remix-ide/src/publishToStorage.js index 5803d9a6a6..c01b144d74 100644 --- a/apps/remix-ide/src/publishToStorage.js +++ b/apps/remix-ide/src/publishToStorage.js @@ -21,8 +21,8 @@ export default function publish (storage, fileProvider, fileManager, contract) { })}` modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`Metadata of "${contract.name.toLowerCase()}" was published successfully.
${result}
`) } - }, (item) => { // triggered each time there's a new verified publish (means hash correspond) - fileProvider.addExternal('swarm/' + item.hash, item.content) + }, async (item) => { // triggered each time there's a new verified publish (means hash correspond) + await fileProvider.addExternal('swarm/' + item.hash, item.content) }) } else { publishOnIpfs(contract, fileManager, function (err, uploaded) { @@ -38,8 +38,8 @@ export default function publish (storage, fileProvider, fileManager, contract) { })}` modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`Metadata of "${contract.name.toLowerCase()}" was published successfully.
${result}
`) } - }, (item) => { // triggered each time there's a new verified publish (means hash correspond) - fileProvider.addExternal('ipfs/' + item.hash, item.content) + }, async (item) => { // triggered each time there's a new verified publish (means hash correspond) + await fileProvider.addExternal('ipfs/' + item.hash, item.content) }) } } diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index f834990ac5..732df69d97 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -155,6 +155,10 @@ export class RemixAppManager extends PluginManager { pattern: [], sticky: true }) + //await this.call('filePanel', 'deleteWorkspace', `default_workspace`) + console.log("----------------------------------------------") + await this.call('filePanel', 'createWorkspace', `workspace_${Date.now()}`, true) + await this.call('fileManager', 'setFile', `one/two/files.js` ,"test") } } diff --git a/libs/remix-core-plugin/src/lib/compiler-content-imports.ts b/libs/remix-core-plugin/src/lib/compiler-content-imports.ts index 2e20d5ebb7..84530cd1ee 100644 --- a/libs/remix-core-plugin/src/lib/compiler-content-imports.ts +++ b/libs/remix-core-plugin/src/lib/compiler-content-imports.ts @@ -97,7 +97,7 @@ export class CompilerImports extends Plugin { try { const provider = await this.call('fileManager', 'getProviderOf', null) const path = targetPath || type + '/' + cleanUrl - if (provider) provider.addExternal('.deps/' + path, content, url) + if (provider) await provider.addExternal('.deps/' + path, content, url) } catch (err) { console.error(err) } diff --git a/libs/remix-ui/workspace/src/lib/actions/events.ts b/libs/remix-ui/workspace/src/lib/actions/events.ts index 35beea2f39..3d11dcabe3 100644 --- a/libs/remix-ui/workspace/src/lib/actions/events.ts +++ b/libs/remix-ui/workspace/src/lib/actions/events.ts @@ -140,19 +140,21 @@ const fileAdded = async (filePath: string) => { } const folderAdded = async (folderPath: string) => { + console.log('folder add event', folderPath) const provider = plugin.fileManager.currentFileProvider() - const path = extractParentFromKey(folderPath) || provider.workspace || provider.type || '' + let path = extractParentFromKey(folderPath) || provider.workspace || provider.type || '' const promise = new Promise((resolve) => { provider.resolveDirectory(path, (error, fileTree) => { if (error) console.error(error) - + console.log('resolve', JSON.stringify(fileTree)) resolve(fileTree) }) }) promise.then((files) => { folderPath = folderPath.replace(/^\/+/, '') + console.log('folderd add success', path, folderPath, JSON.stringify(files)) dispatch(folderAddedSuccess(path, folderPath, files)) }).catch((error) => { console.error(error) diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 53891615c2..9b3d2e85fc 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -190,6 +190,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => { }) } + useEffect(() => { + console.log(JSON.stringify(fs.browser.files)) + },[JSON.stringify(fs.browser.files).length]) + const value = { fs, modal,