fix reference and display workspace name

pull/1021/head
yann300 4 years ago
parent f945c04b3d
commit 4e242bc614
  1. 2
      apps/remix-ide/src/app.js
  2. 13
      apps/remix-ide/src/app/ui/landing-page/landing-page.js
  3. 7
      apps/remix-ide/src/migrateFileSystem.js

@ -325,11 +325,11 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// those views depend on app_manager
const menuicons = new VerticalIcons(appManager)
const landingPage = new LandingPage(appManager, menuicons)
const sidePanel = new SidePanel(appManager, menuicons)
const hiddenPanel = new HiddenPanel()
const pluginManagerComponent = new PluginManagerComponent(appManager, engine)
const filePanel = new FilePanel(appManager)
const landingPage = new LandingPage(appManager, menuicons, fileManager, filePanel)
const settings = new SettingsTab(
registry.get('config').api,
editor,

@ -1,5 +1,6 @@
import * as packageJson from '../../../../../../package.json'
import { ViewPlugin } from '@remixproject/engine-web'
import { migrateToWorkspace } from '../../../migrateFileSystem'
const yo = require('yo-yo')
const csjs = require('csjs-inject')
@ -112,9 +113,11 @@ const profile = {
}
export class LandingPage extends ViewPlugin {
constructor (appManager, verticalIcons) {
constructor (appManager, verticalIcons, fileManager, filePanel) {
super(profile)
this.profile = profile
this.fileManager = fileManager
this.filePanel = filePanel
this.appManager = appManager
this.verticalIcons = verticalIcons
this.gistHandler = new GistHandler()
@ -385,8 +388,12 @@ export class LandingPage extends ViewPlugin {
const migrateWorkspace = async () => {
tooltip('migrating workspace...')
await migrateToWorkspace(globalRegistry.get('fileManager').api, globalRegistry.get('filePanel').api)
tooltip('done.')
try {
const workspaceName = await migrateToWorkspace(this.fileManager, this.filePanel)
tooltip('done. ' + workspaceName + ' created.')
} catch (e) {
return tooltip(e.message)
}
}
const img = yo`<img class=${css.logoImg} src="assets/img/guitarRemiCroped.webp" onclick="${() => playRemi()}"></img>`

@ -26,13 +26,14 @@ export async function migrateToWorkspace (fileManager, filePanel) {
const workspaceProvider = fileManager.getProvider('workspace')
const files = await browserProvider.copyFolderToJson('/')
console.log(files)
if (Object.keys(files).length > 0) {
const workspaceName = 'workspace_migrated_' + Date.now()
const workspaceName = 'workspace_migrated_' + Date.now()
if (Object.keys(files).length > 0) {
const workspacePath = joinPath('browser', workspaceProvider.workspacesPath, workspaceName)
await filePanel.processCreateWorkspace(workspaceName)
filePanel.getWorkspaces() // refresh list
await populateWorkspace(workspacePath, files, browserProvider)
}
}
return workspaceName
}
const populateWorkspace = async (workspace, json, browserProvider) => {

Loading…
Cancel
Save